@jetroai/mcp-server 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +599 -0
  2. package/package.json +20 -0
package/index.js ADDED
@@ -0,0 +1,599 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
+ var E_=Object.create;var zs=Object.defineProperty;var O_=Object.getOwnPropertyDescriptor;var N_=Object.getOwnPropertyNames;var R_=Object.getPrototypeOf,D_=Object.prototype.hasOwnProperty;var j=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Pn=(e,t)=>{for(var r in t)zs(e,r,{get:t[r],enumerable:!0})},A_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of N_(t))!D_.call(e,i)&&i!==r&&zs(e,i,{get:()=>t[i],enumerable:!(n=O_(t,i))||n.enumerable});return e};var mf=(e,t,r)=>(r=e!=null?E_(R_(e)):{},A_(t||!e||!e.__esModule?zs(r,"default",{value:e,enumerable:!0}):r,e));var qi=j(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.regexpCode=ae.getEsmExportName=ae.getProperty=ae.safeStringify=ae.stringify=ae.strConcat=ae.addCodeArg=ae.str=ae._=ae.nil=ae._Code=ae.Name=ae.IDENTIFIER=ae._CodeOrName=void 0;var Ui=class{};ae._CodeOrName=Ui;ae.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Sr=class extends Ui{constructor(t){if(super(),!ae.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ae.Name=Sr;var ft=class extends Ui{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Sr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ae._Code=ft;ae.nil=new ft("");function Rg(e,...t){let r=[e[0]],n=0;for(;n<t.length;)$d(r,t[n]),r.push(e[++n]);return new ft(r)}ae._=Rg;var _d=new ft("+");function Dg(e,...t){let r=[Mi(e[0])],n=0;for(;n<t.length;)r.push(_d),$d(r,t[n]),r.push(_d,Mi(e[++n]));return wk(r),new ft(r)}ae.str=Dg;function $d(e,t){t instanceof ft?e.push(...t._items):t instanceof Sr?e.push(t):e.push(zk(t))}ae.addCodeArg=$d;function wk(e){let t=1;for(;t<e.length-1;){if(e[t]===_d){let r=kk(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function kk(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Sr||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Sr))return`"${e}${t.slice(1)}`}function Sk(e,t){return t.emptyStr()?e:e.emptyStr()?t:Dg`${e}${t}`}ae.strConcat=Sk;function zk(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Mi(Array.isArray(e)?e.join(","):e)}function Ik(e){return new ft(Mi(e))}ae.stringify=Ik;function Mi(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ae.safeStringify=Mi;function jk(e){return typeof e=="string"&&ae.IDENTIFIER.test(e)?new ft(`.${e}`):Rg`[${e}]`}ae.getProperty=jk;function Pk(e){if(typeof e=="string"&&ae.IDENTIFIER.test(e))return new ft(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ae.getEsmExportName=Pk;function Tk(e){return new ft(e.toString())}ae.regexpCode=Tk});var wd=j(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.ValueScope=Ge.ValueScopeName=Ge.Scope=Ge.varKinds=Ge.UsedValueState=void 0;var We=qi(),bd=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Za;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Za||(Ge.UsedValueState=Za={}));Ge.varKinds={const:new We.Name("const"),let:new We.Name("let"),var:new We.Name("var")};var Ua=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof We.Name?t:this.name(t)}name(t){return new We.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Ge.Scope=Ua;var Ma=class extends We.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,We._)`.${new We.Name(r)}[${n}]`}};Ge.ValueScopeName=Ma;var Ek=(0,We._)`\n`,xd=class extends Ua{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Ek:We.nil}}get(){return this._scope}name(t){return new Ma(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:o}=i,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[o];if(s){let l=s.get(a);if(l)return l}else s=this._values[o]=new Map;s.set(a,i);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,i.setValue(r,{property:o,itemIndex:u}),i}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,We._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let o=We.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,Za.Started);let l=r(u);if(l){let d=this.opts.es5?Ge.varKinds.var:Ge.varKinds.const;o=(0,We._)`${o}${d} ${u} = ${l};${this.opts._n}`}else if(l=i?.(u))o=(0,We._)`${o}${l}${this.opts._n}`;else throw new bd(u);c.set(u,Za.Completed)})}return o}};Ge.ValueScope=xd});var W=j(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var ne=qi(),bt=wd(),cr=qi();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return cr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return cr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return cr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return cr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return cr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return cr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return cr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return cr.Name}});var Va=wd();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Va.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Va.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Va.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Va.varKinds}});X.operators={GT:new ne._Code(">"),GTE:new ne._Code(">="),LT:new ne._Code("<"),LTE:new ne._Code("<="),EQ:new ne._Code("==="),NEQ:new ne._Code("!=="),NOT:new ne._Code("!"),OR:new ne._Code("||"),AND:new ne._Code("&&"),ADD:new ne._Code("+")};var Jt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},kd=class extends Jt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?bt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=pn(this.rhs,t,r)),this}get names(){return this.rhs instanceof ne._CodeOrName?this.rhs.names:{}}},qa=class extends Jt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof ne.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=pn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof ne.Name?{}:{...this.lhs.names};return Fa(t,this.rhs)}},Sd=class extends qa{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},zd=class extends Jt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Id=class extends Jt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},jd=class extends Jt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Pd=class extends Jt{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=pn(this.code,t,r),this}get names(){return this.code instanceof ne._CodeOrName?this.code.names:{}}},Li=class extends Jt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(t,r)||(Ok(t,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>jr(t,r.names),{})}},Bt=class extends Li{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Td=class extends Li{},dn=class extends Bt{};dn.kind="else";var zr=class e extends Bt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new dn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Ag(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=pn(this.condition,t,r),this}get names(){let t=super.names;return Fa(t,this.condition),this.else&&jr(t,this.else.names),t}};zr.kind="if";var Ir=class extends Bt{};Ir.kind="for";var Ed=class extends Ir{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=pn(this.iteration,t,r),this}get names(){return jr(super.names,this.iteration.names)}},Od=class extends Ir{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?bt.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=Fa(super.names,this.from);return Fa(t,this.to)}},La=class extends Ir{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=pn(this.iterable,t,r),this}get names(){return jr(super.names,this.iterable.names)}},Fi=class extends Bt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Fi.kind="func";var Vi=class extends Li{render(t){return"return "+super.render(t)}};Vi.kind="return";var Nd=class extends Bt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&jr(t,this.catch.names),this.finally&&jr(t,this.finally.names),t}},Ji=class extends Bt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ji.kind="catch";var Bi=class extends Bt{render(t){return"finally"+super.render(t)}};Bi.kind="finally";var Rd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
4
+ `:""},this._extScope=t,this._scope=new bt.Scope({parent:t}),this._nodes=[new Td]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new kd(t,o,n)),o}const(t,r,n){return this._def(bt.varKinds.const,t,r,n)}let(t,r,n){return this._def(bt.varKinds.let,t,r,n)}var(t,r,n){return this._def(bt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new qa(t,r,n))}add(t,r){return this._leafNode(new Sd(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==ne.nil&&this._leafNode(new Pd(t)),this}object(...t){let r=["{"];for(let[n,i]of t)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ne.addCodeArg)(r,i));return r.push("}"),new ne._Code(r)}if(t,r,n){if(this._blockNode(new zr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new zr(t))}else(){return this._elseNode(new dn)}endIf(){return this._endBlockNode(zr,dn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Ed(t),r)}forRange(t,r,n,i,o=this.opts.es5?bt.varKinds.var:bt.varKinds.let){let a=this._scope.toName(t);return this._for(new Od(o,a,r,n),()=>i(a))}forOf(t,r,n,i=bt.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=r instanceof ne.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ne._)`${a}.length`,s=>{this.var(o,(0,ne._)`${a}[${s}]`),n(o)})}return this._for(new La("of",i,o,r),()=>n(o))}forIn(t,r,n,i=this.opts.es5?bt.varKinds.var:bt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,ne._)`Object.keys(${r})`,n);let o=this._scope.toName(t);return this._for(new La("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(Ir)}label(t){return this._leafNode(new zd(t))}break(t){return this._leafNode(new Id(t))}return(t){let r=new Vi;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Vi)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new Nd;if(this._blockNode(i),this.code(t),r){let o=this.name("e");this._currNode=i.catch=new Ji(o),r(o)}return n&&(this._currNode=i.finally=new Bi,this.code(n)),this._endBlockNode(Ji,Bi)}throw(t){return this._leafNode(new jd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=ne.nil,n,i){return this._blockNode(new Fi(t,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Fi)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof zr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};X.CodeGen=Rd;function jr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Fa(e,t){return t instanceof ne._CodeOrName?jr(e,t.names):e}function pn(e,t,r){if(e instanceof ne.Name)return n(e);if(!i(e))return e;return new ne._Code(e._items.reduce((o,a)=>(a instanceof ne.Name&&(a=n(a)),a instanceof ne._Code?o.push(...a._items):o.push(a),o),[]));function n(o){let a=r[o.str];return a===void 0||t[o.str]!==1?o:(delete t[o.str],a)}function i(o){return o instanceof ne._Code&&o._items.some(a=>a instanceof ne.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function Ok(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Ag(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,ne._)`!${Dd(e)}`}X.not=Ag;var Nk=Cg(X.operators.AND);function Rk(...e){return e.reduce(Nk)}X.and=Rk;var Dk=Cg(X.operators.OR);function Ak(...e){return e.reduce(Dk)}X.or=Ak;function Cg(e){return(t,r)=>t===ne.nil?r:r===ne.nil?t:(0,ne._)`${Dd(t)} ${e} ${Dd(r)}`}function Dd(e){return e instanceof ne.Name?e:(0,ne._)`(${e})`}});var ie=j(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.checkStrictMode=ee.getErrorPath=ee.Type=ee.useFunc=ee.setEvaluated=ee.evaluatedPropsToName=ee.mergeEvaluated=ee.eachItem=ee.unescapeJsonPointer=ee.escapeJsonPointer=ee.escapeFragment=ee.unescapeFragment=ee.schemaRefOrVal=ee.schemaHasRulesButRef=ee.schemaHasRules=ee.checkUnknownRules=ee.alwaysValidSchema=ee.toHash=void 0;var me=W(),Ck=qi();function Zk(e){let t={};for(let r of e)t[r]=!0;return t}ee.toHash=Zk;function Uk(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Mg(e,t),!qg(t,e.self.RULES.all))}ee.alwaysValidSchema=Uk;function Mg(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let i=n.RULES.keywords;for(let o in t)i[o]||Vg(e,`unknown keyword: "${o}"`)}ee.checkUnknownRules=Mg;function qg(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}ee.schemaHasRules=qg;function Mk(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}ee.schemaHasRulesButRef=Mk;function qk({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,me._)`${r}`}return(0,me._)`${e}${t}${(0,me.getProperty)(n)}`}ee.schemaRefOrVal=qk;function Lk(e){return Lg(decodeURIComponent(e))}ee.unescapeFragment=Lk;function Fk(e){return encodeURIComponent(Cd(e))}ee.escapeFragment=Fk;function Cd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}ee.escapeJsonPointer=Cd;function Lg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}ee.unescapeJsonPointer=Lg;function Vk(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}ee.eachItem=Vk;function Zg({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,o,a,s)=>{let c=a===void 0?o:a instanceof me.Name?(o instanceof me.Name?e(i,o,a):t(i,o,a),a):o instanceof me.Name?(t(i,a,o),o):r(o,a);return s===me.Name&&!(c instanceof me.Name)?n(i,c):c}}ee.mergeEvaluated={props:Zg({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,me._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,me._)`${r} || {}`).code((0,me._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,me._)`${r} || {}`),Zd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Fg}),items:Zg({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,me._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,me._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Fg(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,me._)`{}`);return t!==void 0&&Zd(e,r,t),r}ee.evaluatedPropsToName=Fg;function Zd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,me._)`${t}${(0,me.getProperty)(n)}`,!0))}ee.setEvaluated=Zd;var Ug={};function Jk(e,t){return e.scopeValue("func",{ref:t,code:Ug[t.code]||(Ug[t.code]=new Ck._Code(t.code))})}ee.useFunc=Jk;var Ad;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ad||(ee.Type=Ad={}));function Bk(e,t,r){if(e instanceof me.Name){let n=t===Ad.Num;return r?n?(0,me._)`"[" + ${e} + "]"`:(0,me._)`"['" + ${e} + "']"`:n?(0,me._)`"/" + ${e}`:(0,me._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,me.getProperty)(e).toString():"/"+Cd(e)}ee.getErrorPath=Bk;function Vg(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}ee.checkStrictMode=Vg});var Kt=j(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});var Ce=W(),Kk={data:new Ce.Name("data"),valCxt:new Ce.Name("valCxt"),instancePath:new Ce.Name("instancePath"),parentData:new Ce.Name("parentData"),parentDataProperty:new Ce.Name("parentDataProperty"),rootData:new Ce.Name("rootData"),dynamicAnchors:new Ce.Name("dynamicAnchors"),vErrors:new Ce.Name("vErrors"),errors:new Ce.Name("errors"),this:new Ce.Name("this"),self:new Ce.Name("self"),scope:new Ce.Name("scope"),json:new Ce.Name("json"),jsonPos:new Ce.Name("jsonPos"),jsonLen:new Ce.Name("jsonLen"),jsonPart:new Ce.Name("jsonPart")};Ud.default=Kk});var Ki=j(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extendErrors=Ze.resetErrorsCount=Ze.reportExtraError=Ze.reportError=Ze.keyword$DataError=Ze.keywordError=void 0;var oe=W(),Ja=ie(),Je=Kt();Ze.keywordError={message:({keyword:e})=>(0,oe.str)`must pass "${e}" keyword validation`};Ze.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,oe.str)`"${e}" keyword must be ${t} ($data)`:(0,oe.str)`"${e}" keyword is invalid ($data)`};function Hk(e,t=Ze.keywordError,r,n){let{it:i}=e,{gen:o,compositeRule:a,allErrors:s}=i,c=Kg(e,t,r);n??(a||s)?Jg(o,c):Bg(i,(0,oe._)`[${c}]`)}Ze.reportError=Hk;function Wk(e,t=Ze.keywordError,r){let{it:n}=e,{gen:i,compositeRule:o,allErrors:a}=n,s=Kg(e,t,r);Jg(i,s),o||a||Bg(n,Je.default.vErrors)}Ze.reportExtraError=Wk;function Gk(e,t){e.assign(Je.default.errors,t),e.if((0,oe._)`${Je.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,oe._)`${Je.default.vErrors}.length`,t),()=>e.assign(Je.default.vErrors,null)))}Ze.resetErrorsCount=Gk;function Xk({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",i,Je.default.errors,s=>{e.const(a,(0,oe._)`${Je.default.vErrors}[${s}]`),e.if((0,oe._)`${a}.instancePath === undefined`,()=>e.assign((0,oe._)`${a}.instancePath`,(0,oe.strConcat)(Je.default.instancePath,o.errorPath))),e.assign((0,oe._)`${a}.schemaPath`,(0,oe.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,oe._)`${a}.schema`,r),e.assign((0,oe._)`${a}.data`,n))})}Ze.extendErrors=Xk;function Jg(e,t){let r=e.const("err",t);e.if((0,oe._)`${Je.default.vErrors} === null`,()=>e.assign(Je.default.vErrors,(0,oe._)`[${r}]`),(0,oe._)`${Je.default.vErrors}.push(${r})`),e.code((0,oe._)`${Je.default.errors}++`)}function Bg(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;i.$async?r.throw((0,oe._)`new ${e.ValidationError}(${t})`):(r.assign((0,oe._)`${n}.errors`,t),r.return(!1))}var Pr={keyword:new oe.Name("keyword"),schemaPath:new oe.Name("schemaPath"),params:new oe.Name("params"),propertyName:new oe.Name("propertyName"),message:new oe.Name("message"),schema:new oe.Name("schema"),parentSchema:new oe.Name("parentSchema")};function Kg(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,oe._)`{}`:Yk(e,t,r)}function Yk(e,t,r={}){let{gen:n,it:i}=e,o=[Qk(i,r),eS(e,r)];return tS(e,t,o),n.object(...o)}function Qk({errorPath:e},{instancePath:t}){let r=t?(0,oe.str)`${e}${(0,Ja.getErrorPath)(t,Ja.Type.Str)}`:e;return[Je.default.instancePath,(0,oe.strConcat)(Je.default.instancePath,r)]}function eS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,oe.str)`${t}/${e}`;return r&&(i=(0,oe.str)`${i}${(0,Ja.getErrorPath)(r,Ja.Type.Str)}`),[Pr.schemaPath,i]}function tS(e,{params:t,message:r},n){let{keyword:i,data:o,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Pr.keyword,i],[Pr.params,typeof t=="function"?t(e):t||(0,oe._)`{}`]),c.messages&&n.push([Pr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Pr.schema,a],[Pr.parentSchema,(0,oe._)`${l}${d}`],[Je.default.data,o]),u&&n.push([Pr.propertyName,u])}});var Wg=j(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.boolOrEmptySchema=fn.topBoolOrEmptySchema=void 0;var rS=Ki(),nS=W(),iS=Kt(),oS={message:"boolean schema is false"};function aS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Hg(e,!1):typeof r=="object"&&r.$async===!0?t.return(iS.default.data):(t.assign((0,nS._)`${n}.errors`,null),t.return(!0))}fn.topBoolOrEmptySchema=aS;function sS(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Hg(e)):r.var(t,!0)}fn.boolOrEmptySchema=sS;function Hg(e,t){let{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,rS.reportError)(i,oS,void 0,t)}});var Md=j(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.getRules=mn.isJSONType=void 0;var cS=["string","number","integer","boolean","null","object","array"],uS=new Set(cS);function lS(e){return typeof e=="string"&&uS.has(e)}mn.isJSONType=lS;function dS(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}mn.getRules=dS});var qd=j(ur=>{"use strict";Object.defineProperty(ur,"__esModule",{value:!0});ur.shouldUseRule=ur.shouldUseGroup=ur.schemaHasRulesForType=void 0;function pS({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Gg(e,n)}ur.schemaHasRulesForType=pS;function Gg(e,t){return t.rules.some(r=>Xg(e,r))}ur.shouldUseGroup=Gg;function Xg(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}ur.shouldUseRule=Xg});var Hi=j(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.reportTypeError=Ue.checkDataTypes=Ue.checkDataType=Ue.coerceAndCheckDataType=Ue.getJSONTypes=Ue.getSchemaTypes=Ue.DataType=void 0;var fS=Md(),mS=qd(),hS=Ki(),H=W(),Yg=ie(),hn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(hn||(Ue.DataType=hn={}));function gS(e){let t=Qg(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ue.getSchemaTypes=gS;function Qg(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(fS.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ue.getJSONTypes=Qg;function vS(e,t){let{gen:r,data:n,opts:i}=e,o=yS(t,i.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0,mS.schemaHasRulesForType)(e,t[0]));if(a){let s=Fd(t,n,i.strictNumbers,hn.Wrong);r.if(s,()=>{o.length?_S(e,t,o):Vd(e)})}return a}Ue.coerceAndCheckDataType=vS;var ev=new Set(["string","number","integer","boolean","null"]);function yS(e,t){return t?e.filter(r=>ev.has(r)||t==="array"&&r==="array"):[]}function _S(e,t,r){let{gen:n,data:i,opts:o}=e,a=n.let("dataType",(0,H._)`typeof ${i}`),s=n.let("coerced",(0,H._)`undefined`);o.coerceTypes==="array"&&n.if((0,H._)`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,H._)`${i}[0]`).assign(a,(0,H._)`typeof ${i}`).if(Fd(t,i,o.strictNumbers),()=>n.assign(s,i))),n.if((0,H._)`${s} !== undefined`);for(let u of r)(ev.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),Vd(e),n.endIf(),n.if((0,H._)`${s} !== undefined`,()=>{n.assign(i,s),$S(e,s)});function c(u){switch(u){case"string":n.elseIf((0,H._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,H._)`"" + ${i}`).elseIf((0,H._)`${i} === null`).assign(s,(0,H._)`""`);return;case"number":n.elseIf((0,H._)`${a} == "boolean" || ${i} === null
5
+ || (${a} == "string" && ${i} && ${i} == +${i})`).assign(s,(0,H._)`+${i}`);return;case"integer":n.elseIf((0,H._)`${a} === "boolean" || ${i} === null
6
+ || (${a} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(s,(0,H._)`+${i}`);return;case"boolean":n.elseIf((0,H._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(s,!1).elseIf((0,H._)`${i} === "true" || ${i} === 1`).assign(s,!0);return;case"null":n.elseIf((0,H._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(s,null);return;case"array":n.elseIf((0,H._)`${a} === "string" || ${a} === "number"
7
+ || ${a} === "boolean" || ${i} === null`).assign(s,(0,H._)`[${i}]`)}}}function $S({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,H._)`${t} !== undefined`,()=>e.assign((0,H._)`${t}[${r}]`,n))}function Ld(e,t,r,n=hn.Correct){let i=n===hn.Correct?H.operators.EQ:H.operators.NEQ,o;switch(e){case"null":return(0,H._)`${t} ${i} null`;case"array":o=(0,H._)`Array.isArray(${t})`;break;case"object":o=(0,H._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a((0,H._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return(0,H._)`typeof ${t} ${i} ${e}`}return n===hn.Correct?o:(0,H.not)(o);function a(s=H.nil){return(0,H.and)((0,H._)`typeof ${t} == "number"`,s,r?(0,H._)`isFinite(${t})`:H.nil)}}Ue.checkDataType=Ld;function Fd(e,t,r,n){if(e.length===1)return Ld(e[0],t,r,n);let i,o=(0,Yg.toHash)(e);if(o.array&&o.object){let a=(0,H._)`typeof ${t} != "object"`;i=o.null?a:(0,H._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object}else i=H.nil;o.number&&delete o.integer;for(let a in o)i=(0,H.and)(i,Ld(a,t,r,n));return i}Ue.checkDataTypes=Fd;var bS={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,H._)`{type: ${e}}`:(0,H._)`{type: ${t}}`};function Vd(e){let t=xS(e);(0,hS.reportError)(t,bS)}Ue.reportTypeError=Vd;function xS(e){let{gen:t,data:r,schema:n}=e,i=(0,Yg.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}});var rv=j(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.assignDefaults=void 0;var gn=W(),wS=ie();function kS(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let i in r)tv(e,i,r[i].default);else t==="array"&&Array.isArray(n)&&n.forEach((i,o)=>tv(e,o,i.default))}Ba.assignDefaults=kS;function tv(e,t,r){let{gen:n,compositeRule:i,data:o,opts:a}=e;if(r===void 0)return;let s=(0,gn._)`${o}${(0,gn.getProperty)(t)}`;if(i){(0,wS.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,gn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,gn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,gn._)`${s} = ${(0,gn.stringify)(r)}`)}});var mt=j(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.validateUnion=le.validateArray=le.usePattern=le.callValidateCode=le.schemaProperties=le.allSchemaProperties=le.noPropertyInData=le.propertyInData=le.isOwnProperty=le.hasPropFunc=le.reportMissingProp=le.checkMissingProp=le.checkReportMissingProp=void 0;var ye=W(),Jd=ie(),lr=Kt(),SS=ie();function zS(e,t){let{gen:r,data:n,it:i}=e;r.if(Kd(r,n,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ye._)`${t}`},!0),e.error()})}le.checkReportMissingProp=zS;function IS({gen:e,data:t,it:{opts:r}},n,i){return(0,ye.or)(...n.map(o=>(0,ye.and)(Kd(e,t,o,r.ownProperties),(0,ye._)`${i} = ${o}`)))}le.checkMissingProp=IS;function jS(e,t){e.setParams({missingProperty:t},!0),e.error()}le.reportMissingProp=jS;function nv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ye._)`Object.prototype.hasOwnProperty`})}le.hasPropFunc=nv;function Bd(e,t,r){return(0,ye._)`${nv(e)}.call(${t}, ${r})`}le.isOwnProperty=Bd;function PS(e,t,r,n){let i=(0,ye._)`${t}${(0,ye.getProperty)(r)} !== undefined`;return n?(0,ye._)`${i} && ${Bd(e,t,r)}`:i}le.propertyInData=PS;function Kd(e,t,r,n){let i=(0,ye._)`${t}${(0,ye.getProperty)(r)} === undefined`;return n?(0,ye.or)(i,(0,ye.not)(Bd(e,t,r))):i}le.noPropertyInData=Kd;function iv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}le.allSchemaProperties=iv;function TS(e,t){return iv(t).filter(r=>!(0,Jd.alwaysValidSchema)(e,t[r]))}le.schemaProperties=TS;function ES({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:a},s,c,u){let l=u?(0,ye._)`${e}, ${t}, ${n}${i}`:t,d=[[lr.default.instancePath,(0,ye.strConcat)(lr.default.instancePath,o)],[lr.default.parentData,a.parentData],[lr.default.parentDataProperty,a.parentDataProperty],[lr.default.rootData,lr.default.rootData]];a.opts.dynamicRef&&d.push([lr.default.dynamicAnchors,lr.default.dynamicAnchors]);let f=(0,ye._)`${l}, ${r.object(...d)}`;return c!==ye.nil?(0,ye._)`${s}.call(${c}, ${f})`:(0,ye._)`${s}(${f})`}le.callValidateCode=ES;var OS=(0,ye._)`new RegExp`;function NS({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,o=i(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,ye._)`${i.code==="new RegExp"?OS:(0,SS.useFunc)(e,i)}(${r}, ${n})`})}le.usePattern=NS;function RS(e){let{gen:t,data:r,keyword:n,it:i}=e,o=t.name("valid");if(i.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(o,!0),a(()=>t.break()),o;function a(s){let c=t.const("len",(0,ye._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Jd.Type.Num},o),t.if((0,ye.not)(o),s)})}}le.validateArray=RS;function DS(e){let{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Jd.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ye._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ye.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}le.validateUnion=DS});var sv=j(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.validateKeywordUsage=Pt.validSchemaType=Pt.funcKeywordCode=Pt.macroKeywordCode=void 0;var Be=W(),Tr=Kt(),AS=mt(),CS=Ki();function ZS(e,t){let{gen:r,keyword:n,schema:i,parentSchema:o,it:a}=e,s=t.macro.call(a.self,i,o,a),c=av(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Be.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Pt.macroKeywordCode=ZS;function US(e,t){var r;let{gen:n,keyword:i,schema:o,parentSchema:a,$data:s,it:c}=e;qS(c,t);let u=!s&&t.compile?t.compile.call(c.self,o,a,c):t.validate,l=av(n,i,u),d=n.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)g(),t.modifying&&ov(e),_(()=>e.error());else{let k=t.async?p():h();t.modifying&&ov(e),_(()=>MS(e,k))}}function p(){let k=n.let("ruleErrs",null);return n.try(()=>g((0,Be._)`await `),E=>n.assign(d,!1).if((0,Be._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(k,(0,Be._)`${E}.errors`),()=>n.throw(E))),k}function h(){let k=(0,Be._)`${l}.errors`;return n.assign(k,null),g(Be.nil),k}function g(k=t.async?(0,Be._)`await `:Be.nil){let E=c.opts.passContext?Tr.default.this:Tr.default.self,I=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Be._)`${k}${(0,AS.callValidateCode)(e,l,E,I)}`,t.modifying)}function _(k){var E;n.if((0,Be.not)((E=t.valid)!==null&&E!==void 0?E:d),k)}}Pt.funcKeywordCode=US;function ov(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Be._)`${n.parentData}[${n.parentDataProperty}]`))}function MS(e,t){let{gen:r}=e;r.if((0,Be._)`Array.isArray(${t})`,()=>{r.assign(Tr.default.vErrors,(0,Be._)`${Tr.default.vErrors} === null ? ${t} : ${Tr.default.vErrors}.concat(${t})`).assign(Tr.default.errors,(0,Be._)`${Tr.default.vErrors}.length`),(0,CS.extendErrors)(e)},()=>e.error())}function qS({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function av(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Be.stringify)(r)})}function LS(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Pt.validSchemaType=LS;function FS({schema:e,opts:t,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let a=i.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Pt.validateKeywordUsage=FS});var uv=j(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.extendSubschemaMode=dr.extendSubschemaData=dr.getSubschema=void 0;var Tt=W(),cv=ie();function VS(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,Tt._)`${e.schemaPath}${(0,Tt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,Tt._)`${e.schemaPath}${(0,Tt.getProperty)(t)}${(0,Tt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,cv.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}dr.getSubschema=VS;function JS(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:a}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=s.let("data",(0,Tt._)`${t.data}${(0,Tt.getProperty)(r)}`,!0);c(f),e.errorPath=(0,Tt.str)`${u}${(0,cv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Tt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(i!==void 0){let u=i instanceof Tt.Name?i:s.let("data",i,!0);c(u),a!==void 0&&(e.propertyName=a)}o&&(e.dataTypes=o);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}dr.extendSubschemaData=JS;function BS(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(e.compositeRule=n),i!==void 0&&(e.createErrors=i),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}dr.extendSubschemaMode=BS});var Hd=j((vC,lv)=>{"use strict";lv.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var a=o[i];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var pv=j((yC,dv)=>{"use strict";var pr=dv.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Ka(t,n,i,e,"",e)};pr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};pr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};pr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};pr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Ka(e,t,r,n,i,o,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,i,o,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in pr.arrayKeywords)for(var f=0;f<d.length;f++)Ka(e,t,r,d[f],i+"/"+l+"/"+f,o,i,l,n,f)}else if(l in pr.propsKeywords){if(d&&typeof d=="object")for(var p in d)Ka(e,t,r,d[p],i+"/"+l+"/"+KS(p),o,i,l,n,p)}else(l in pr.keywords||e.allKeys&&!(l in pr.skipKeywords))&&Ka(e,t,r,d,i+"/"+l,o,i,l,n)}r(n,i,o,a,s,c,u)}}function KS(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Wi=j(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getSchemaRefs=Xe.resolveUrl=Xe.normalizeId=Xe._getFullPath=Xe.getFullPath=Xe.inlineRef=void 0;var HS=ie(),WS=Hd(),GS=pv(),XS=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function YS(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Wd(e):t?fv(e)<=t:!1}Xe.inlineRef=YS;var QS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Wd(e){for(let t in e){if(QS.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Wd)||typeof r=="object"&&Wd(r))return!0}return!1}function fv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!XS.has(r)&&(typeof e[r]=="object"&&(0,HS.eachItem)(e[r],n=>t+=fv(n)),t===1/0))return 1/0}return t}function mv(e,t="",r){r!==!1&&(t=vn(t));let n=e.parse(t);return hv(e,n)}Xe.getFullPath=mv;function hv(e,t){return e.serialize(t).split("#")[0]+"#"}Xe._getFullPath=hv;var e0=/#\/?$/;function vn(e){return e?e.replace(e0,""):""}Xe.normalizeId=vn;function t0(e,t,r){return r=vn(r),e.resolve(t,r)}Xe.resolveUrl=t0;var r0=/^[a-z_][-a-z0-9._]*$/i;function n0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=vn(e[r]||t),o={"":i},a=mv(n,i,!1),s={},c=new Set;return GS(e,{allKeys:!0},(d,f,p,h)=>{if(h===void 0)return;let g=a+f,_=o[h];typeof d[r]=="string"&&(_=k.call(this,d[r])),E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),o[f]=_;function k(I){let A=this.opts.uriResolver.resolve;if(I=vn(_?A(_,I):I),c.has(I))throw l(I);c.add(I);let O=this.refs[I];return typeof O=="string"&&(O=this.refs[O]),typeof O=="object"?u(d,O.schema,I):I!==vn(g)&&(I[0]==="#"?(u(d,s[I],I),s[I]=d):this.refs[I]=g),I}function E(I){if(typeof I=="string"){if(!r0.test(I))throw new Error(`invalid anchor "${I}"`);k.call(this,`#${I}`)}}}),s;function u(d,f,p){if(f!==void 0&&!WS(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Xe.getSchemaRefs=n0});var Yi=j(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.getData=fr.KeywordCxt=fr.validateFunctionCode=void 0;var $v=Wg(),gv=Hi(),Xd=qd(),Ha=Hi(),i0=rv(),Xi=sv(),Gd=uv(),D=W(),L=Kt(),o0=Wi(),Ht=ie(),Gi=Ki();function a0(e){if(wv(e)&&(kv(e),xv(e))){u0(e);return}bv(e,()=>(0,$v.topBoolOrEmptySchema)(e))}fr.validateFunctionCode=a0;function bv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},o){i.code.es5?e.func(t,(0,D._)`${L.default.data}, ${L.default.valCxt}`,n.$async,()=>{e.code((0,D._)`"use strict"; ${vv(r,i)}`),c0(e,i),e.code(o)}):e.func(t,(0,D._)`${L.default.data}, ${s0(i)}`,n.$async,()=>e.code(vv(r,i)).code(o))}function s0(e){return(0,D._)`{${L.default.instancePath}="", ${L.default.parentData}, ${L.default.parentDataProperty}, ${L.default.rootData}=${L.default.data}${e.dynamicRef?(0,D._)`, ${L.default.dynamicAnchors}={}`:D.nil}}={}`}function c0(e,t){e.if(L.default.valCxt,()=>{e.var(L.default.instancePath,(0,D._)`${L.default.valCxt}.${L.default.instancePath}`),e.var(L.default.parentData,(0,D._)`${L.default.valCxt}.${L.default.parentData}`),e.var(L.default.parentDataProperty,(0,D._)`${L.default.valCxt}.${L.default.parentDataProperty}`),e.var(L.default.rootData,(0,D._)`${L.default.valCxt}.${L.default.rootData}`),t.dynamicRef&&e.var(L.default.dynamicAnchors,(0,D._)`${L.default.valCxt}.${L.default.dynamicAnchors}`)},()=>{e.var(L.default.instancePath,(0,D._)`""`),e.var(L.default.parentData,(0,D._)`undefined`),e.var(L.default.parentDataProperty,(0,D._)`undefined`),e.var(L.default.rootData,L.default.data),t.dynamicRef&&e.var(L.default.dynamicAnchors,(0,D._)`{}`)})}function u0(e){let{schema:t,opts:r,gen:n}=e;bv(e,()=>{r.$comment&&t.$comment&&zv(e),m0(e),n.let(L.default.vErrors,null),n.let(L.default.errors,0),r.unevaluated&&l0(e),Sv(e),v0(e)})}function l0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,D._)`${r}.evaluated`),t.if((0,D._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,D._)`${e.evaluated}.props`,(0,D._)`undefined`)),t.if((0,D._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,D._)`${e.evaluated}.items`,(0,D._)`undefined`))}function vv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function d0(e,t){if(wv(e)&&(kv(e),xv(e))){p0(e,t);return}(0,$v.boolOrEmptySchema)(e,t)}function xv({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function wv(e){return typeof e.schema!="boolean"}function p0(e,t){let{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&zv(e),h0(e),g0(e);let o=n.const("_errs",L.default.errors);Sv(e,o),n.var(t,(0,D._)`${o} === ${L.default.errors}`)}function kv(e){(0,Ht.checkUnknownRules)(e),f0(e)}function Sv(e,t){if(e.opts.jtd)return yv(e,[],!1,t);let r=(0,gv.getSchemaTypes)(e.schema),n=(0,gv.coerceAndCheckDataType)(e,r);yv(e,r,!n,t)}function f0(e){let{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ht.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function m0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ht.checkStrictMode)(e,"default is ignored in the schema root")}function h0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,o0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function g0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function zv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)e.code((0,D._)`${L.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,D._)`${L.default.self}.opts.$comment(${o}, ${a}, ${s}.schema)`)}}function v0(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=e;r.$async?t.if((0,D._)`${L.default.errors} === 0`,()=>t.return(L.default.data),()=>t.throw((0,D._)`new ${i}(${L.default.vErrors})`)):(t.assign((0,D._)`${n}.errors`,L.default.vErrors),o.unevaluated&&y0(e),t.return((0,D._)`${L.default.errors} === 0`))}function y0({gen:e,evaluated:t,props:r,items:n}){r instanceof D.Name&&e.assign((0,D._)`${t}.props`,r),n instanceof D.Name&&e.assign((0,D._)`${t}.items`,n)}function yv(e,t,r,n){let{gen:i,schema:o,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Ht.schemaHasRulesButRef)(o,l))){i.block(()=>jv(e,"$ref",l.all.$ref.definition));return}c.jtd||_0(e,t),i.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,Xd.shouldUseGroup)(o,f)&&(f.type?(i.if((0,Ha.checkDataType)(f.type,a,c.strictNumbers)),_v(e,f),t.length===1&&t[0]===f.type&&r&&(i.else(),(0,Ha.reportTypeError)(e)),i.endIf()):_v(e,f),s||i.if((0,D._)`${L.default.errors} === ${n||0}`))}}function _v(e,t){let{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,i0.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0,Xd.shouldUseRule)(n,o)&&jv(e,o.keyword,o.definition,t.type)})}function _0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||($0(e,t),e.opts.allowUnionTypes||b0(e,t),x0(e,e.dataTypes))}function $0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Iv(e.dataTypes,r)||Yd(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),k0(e,t)}}function b0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Yd(e,"use allowUnionTypes to allow union type keyword")}function x0(e,t){let r=e.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,Xd.shouldUseRule)(e.schema,i)){let{type:o}=i.definition;o.length&&!o.some(a=>w0(t,a))&&Yd(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function w0(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Iv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function k0(e,t){let r=[];for(let n of e.dataTypes)Iv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Yd(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ht.checkStrictMode)(e,t,e.opts.strictTypes)}var Wa=class{constructor(t,r,n){if((0,Xi.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ht.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Pv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Xi.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",L.default.errors))}result(t,r,n){this.failResult((0,D.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,D.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,D._)`${r} !== undefined && (${(0,D.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Gi.reportExtraError:Gi.reportError)(this,this.def.error,r)}$dataError(){(0,Gi.reportError)(this,this.def.$dataError||Gi.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Gi.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=D.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:a}=this;n.if((0,D.or)((0,D._)`${i} === undefined`,r)),t!==D.nil&&n.assign(t,!0),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==D.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,D.or)(a(),s());function a(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,Ha.checkDataTypes)(c,r,o.opts.strictNumbers,Ha.DataType.Wrong)}`}return D.nil}function s(){if(i.validateSchema){let c=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(t,r){let n=(0,Gd.getSubschema)(this.it,t);(0,Gd.extendSubschemaData)(n,this.it,t),(0,Gd.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return d0(i,r),i}mergeEvaluated(t,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ht.mergeEvaluated.props(i,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ht.mergeEvaluated.items(i,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(t,D.Name)),!0}};fr.KeywordCxt=Wa;function jv(e,t,r,n){let i=new Wa(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Xi.funcKeywordCode)(i,r):"macro"in r?(0,Xi.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Xi.funcKeywordCode)(i,r)}var S0=/^\/(?:[^~]|~0|~1)*$/,z0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Pv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,o;if(e==="")return L.default.rootData;if(e[0]==="/"){if(!S0.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=L.default.rootData}else{let u=z0.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(i=u[2],i==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(o=r[t-l],!i)return o}let a=o,s=i.split("/");for(let u of s)u&&(o=(0,D._)`${o}${(0,D.getProperty)((0,Ht.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${o}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}fr.getData=Pv});var Ga=j(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});var Qd=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};ep.default=Qd});var Qi=j(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var tp=Wi(),rp=class extends Error{constructor(t,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,tp.resolveUrl)(t,r,n),this.missingSchema=(0,tp.normalizeId)((0,tp.getFullPath)(t,this.missingRef))}};np.default=rp});var Ya=j(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.resolveSchema=ht.getCompilingSchema=ht.resolveRef=ht.compileSchema=ht.SchemaEnv=void 0;var xt=W(),I0=Ga(),Er=Kt(),wt=Wi(),Tv=ie(),j0=Yi(),yn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,wt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};ht.SchemaEnv=yn;function op(e){let t=Ev.call(this,e);if(t)return t;let r=(0,wt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,a=new xt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),s;e.$async&&(s=a.scopeValue("Error",{ref:I0.default,code:(0,xt._)`(function(){class ValidationError extends Error{constructor(e){super("validation failed");this.errors=e;this.ajv=this.validation=true}};return{default:ValidationError}}).call(this).default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Er.default.data,parentData:Er.default.parentData,parentDataProperty:Er.default.parentDataProperty,dataNames:[Er.default.data],dataPathArr:[xt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,xt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:xt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,xt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,j0.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Er.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${Er.default.self}`,`${Er.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:h,items:g}=u;p.evaluated={props:h instanceof xt.Name?void 0:h,items:g instanceof xt.Name?void 0:g,dynamicProps:h instanceof xt.Name,dynamicItems:g instanceof xt.Name},p.source&&(p.source.evaluated=(0,xt.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}ht.compileSchema=op;function P0(e,t,r){var n;r=(0,wt.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let o=O0.call(this,e,r);if(o===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(o=new yn({schema:a,schemaId:s,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=T0.call(this,o)}ht.resolveRef=P0;function T0(e){return(0,wt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:op.call(this,e)}function Ev(e){for(let t of this._compilations)if(E0(t,e))return t}ht.getCompilingSchema=Ev;function E0(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function O0(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Xa.call(this,e,t)}function Xa(e,t){let r=this.opts.uriResolver.parse(t),n=(0,wt._getFullPath)(this.opts.uriResolver,r),i=(0,wt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return ip.call(this,r,e);let o=(0,wt.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let s=Xa.call(this,e,a);return typeof s?.schema!="object"?void 0:ip.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||op.call(this,a),o===(0,wt.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(i=(0,wt.resolveUrl)(this.opts.uriResolver,i,u)),new yn({schema:s,schemaId:c,root:e,baseId:i})}return ip.call(this,r,a)}}ht.resolveSchema=Xa;var N0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ip(e,{baseId:t,schema:r,root:n}){var i;if(((i=e.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Tv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!N0.has(s)&&u&&(t=(0,wt.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,Tv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,wt.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=Xa.call(this,n,s)}let{schemaId:a}=this.opts;if(o=o||new yn({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}});var Ov=j((kC,R0)=>{R0.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var sp=j((SC,Av)=>{"use strict";var D0=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Rv=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function ap(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var A0=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Nv(e){return e.length=0,!0}function C0(e,t,r){if(e.length){let n=ap(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function Z0(e){let t=0,r={error:!1,address:"",zone:""},n=[],i=[],o=!1,a=!1,s=C0;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(a=!0),!s(i,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(o=!0),n.push(":");continue}else if(u==="%"){if(!s(i,n,r))break;s=Nv}else{i.push(u);continue}}return i.length&&(s===Nv?r.zone=i.join(""):a?n.push(i.join("")):n.push(ap(i))),r.address=n.join(""),r}function Dv(e){if(U0(e,":")<2)return{host:e,isIPV6:!1};let t=Z0(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function U0(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function M0(e){let t=e,r=[],n=-1,i=0;for(;i=t.length;){if(i===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(i===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(i===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function q0(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function L0(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Rv(r)){let n=Dv(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}Av.exports={nonSimpleDomain:A0,recomposeAuthority:L0,normalizeComponentEncoding:q0,removeDotSegments:M0,isIPv4:Rv,isUUID:D0,normalizeIPv6:Dv,stringArrayToHexStripped:ap}});var qv=j((zC,Mv)=>{"use strict";var{isUUID:F0}=sp(),V0=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,J0=["http","https","ws","wss","urn","urn:uuid"];function B0(e){return J0.indexOf(e)!==-1}function cp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Cv(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Zv(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function K0(e){return e.secure=cp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function H0(e){if((e.port===(cp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function W0(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(V0);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=`${n}:${t.nid||e.nid}`,o=up(i);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function G0(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),i=`${r}:${t.nid||n}`,o=up(i);o&&(e=o.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function X0(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!F0(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Y0(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Uv={scheme:"http",domainHost:!0,parse:Cv,serialize:Zv},Q0={scheme:"https",domainHost:Uv.domainHost,parse:Cv,serialize:Zv},Qa={scheme:"ws",domainHost:!0,parse:K0,serialize:H0},ez={scheme:"wss",domainHost:Qa.domainHost,parse:Qa.parse,serialize:Qa.serialize},tz={scheme:"urn",parse:W0,serialize:G0,skipNormalize:!0},rz={scheme:"urn:uuid",parse:X0,serialize:Y0,skipNormalize:!0},es={http:Uv,https:Q0,ws:Qa,wss:ez,urn:tz,"urn:uuid":rz};Object.setPrototypeOf(es,null);function up(e){return e&&(es[e]||es[e.toLowerCase()])||void 0}Mv.exports={wsIsSecure:cp,SCHEMES:es,isValidSchemeName:B0,getSchemeHandler:up}});var Vv=j((IC,rs)=>{"use strict";var{normalizeIPv6:nz,removeDotSegments:eo,recomposeAuthority:iz,normalizeComponentEncoding:ts,isIPv4:oz,nonSimpleDomain:az}=sp(),{SCHEMES:sz,getSchemeHandler:Lv}=qv();function cz(e,t){return typeof e=="string"?e=Et(Wt(e,t),t):typeof e=="object"&&(e=Wt(Et(e,t),t)),e}function uz(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},i=Fv(Wt(e,n),Wt(t,n),n,!0);return n.skipEscape=!0,Et(i,n)}function Fv(e,t,r,n){let i={};return n||(e=Wt(Et(e,r),r),t=Wt(Et(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=eo(t.path||""),i.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=eo(t.path||""),i.query=t.query):(t.path?(t.path[0]==="/"?i.path=eo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?i.path="/"+t.path:e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path,i.path=eo(i.path)),i.query=t.query):(i.path=e.path,t.query!==void 0?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function lz(e,t,r){return typeof e=="string"?(e=unescape(e),e=Et(ts(Wt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Et(ts(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=Et(ts(Wt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Et(ts(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function Et(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),i=[],o=Lv(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let a=iz(r);if(a!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(a),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(s=eo(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),i.push(s)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var dz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Wt(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let o=e.match(dz);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(oz(n.host)===!1){let c=nz(n.host);n.host=c.host.toLowerCase(),i=c.isIPV6}else i=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Lv(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&i===!1&&az(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var lp={SCHEMES:sz,normalize:cz,resolve:uz,resolveComponent:Fv,equal:lz,serialize:Et,parse:Wt};rs.exports=lp;rs.exports.default=lp;rs.exports.fastUri=lp});var Bv=j(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});var Jv=Vv();Jv.code='(function(){return{default:{parse:function(s){try{return new URL(s),{reference:"uri"}}catch{return null}},serialize:function(c){return c?.reference??""}}}}).call(this).default';dp.default=Jv});var ey=j(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.CodeGen=Ee.Name=Ee.nil=Ee.stringify=Ee.str=Ee._=Ee.KeywordCxt=void 0;var pz=Yi();Object.defineProperty(Ee,"KeywordCxt",{enumerable:!0,get:function(){return pz.KeywordCxt}});var _n=W();Object.defineProperty(Ee,"_",{enumerable:!0,get:function(){return _n._}});Object.defineProperty(Ee,"str",{enumerable:!0,get:function(){return _n.str}});Object.defineProperty(Ee,"stringify",{enumerable:!0,get:function(){return _n.stringify}});Object.defineProperty(Ee,"nil",{enumerable:!0,get:function(){return _n.nil}});Object.defineProperty(Ee,"Name",{enumerable:!0,get:function(){return _n.Name}});Object.defineProperty(Ee,"CodeGen",{enumerable:!0,get:function(){return _n.CodeGen}});var fz=Ga(),Xv=Qi(),mz=Md(),to=Ya(),hz=W(),ro=Wi(),ns=Hi(),fp=ie(),Kv=Ov(),gz=Bv(),Yv=(e,t)=>new RegExp(e,t);Yv.code="new RegExp";var vz=["removeAdditional","useDefaults","coerceTypes"],yz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_z={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},$z={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Hv=200;function bz(e){var t,r,n,i,o,a,s,c,u,l,d,f,p,h,g,_,k,E,I,A,O,xe,Qe,we,Ke;let ze=e.strict,ke=(t=e.code)===null||t===void 0?void 0:t.optimize,Gt=ke===!0||ke===void 0?1:ke||0,Dr=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Yv,ho=(i=e.uriResolver)!==null&&i!==void 0?i:gz.default;return{strictSchema:(a=(o=e.strictSchema)!==null&&o!==void 0?o:ze)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:ze)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:ze)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:ze)!==null&&f!==void 0?f:"log",strictRequired:(h=(p=e.strictRequired)!==null&&p!==void 0?p:ze)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:Gt,regExp:Dr}:{optimize:Gt,regExp:Dr},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Hv,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:Hv,meta:(k=e.meta)!==null&&k!==void 0?k:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(I=e.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(A=e.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(O=e.addUsedSchema)!==null&&O!==void 0?O:!0,validateSchema:(xe=e.validateSchema)!==null&&xe!==void 0?xe:!0,validateFormats:(Qe=e.validateFormats)!==null&&Qe!==void 0?Qe:!0,unicodeRegExp:(we=e.unicodeRegExp)!==null&&we!==void 0?we:!0,int32range:(Ke=e.int32range)!==null&&Ke!==void 0?Ke:!0,uriResolver:ho}}var no=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...bz(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new hz.ValueScope({scope:{},prefixes:yz,es5:r,lines:n}),this.logger=Iz(t.logger);let i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,mz.getRules)(),Wv.call(this,_z,t,"NOT SUPPORTED"),Wv.call(this,$z,t,"DEPRECATED","warn"),this._metaOpts=Sz.call(this),t.formats&&wz.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&kz.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),xz.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,i=Kv;n==="id"&&(i={...Kv},i.id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,t,r);async function i(l,d){await o.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||a.call(this,f)}async function o(l){l&&!this.getSchema(l)&&await i.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Xv.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,i=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,i);return this}let o;if(typeof t=="object"){let{schemaId:a}=this.opts;if(o=t[a],o!==void 0&&typeof o!="string")throw new Error(`schema ${a} must be string`)}return r=(0,ro.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,i,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,t);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(t){let r;for(;typeof(r=Gv.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,i=new to.SchemaEnv({schema:{},schemaId:n});if(r=to.resolveSchema.call(this,i,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Gv.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,ro.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Pz.call(this,n,r),!r)return(0,fp.eachItem)(n,o=>pp.call(this,o)),this;Ez.call(this,r);let i={...r,type:(0,ns.getJSONTypes)(r.type),schemaType:(0,ns.getJSONTypes)(r.schemaType)};return(0,fp.eachItem)(n,i.type.length===0?o=>pp.call(this,o,i):o=>i.type.forEach(a=>pp.call(this,o,i,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===t);i>=0&&n.rules.splice(i,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let i of r){let o=i.split("/").slice(1),a=t;for(let s of o)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Qv(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let i=t[n];(!r||r.test(n))&&(typeof i=="string"?delete t[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[n]))}}_addSchema(t,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,ro.normalizeId)(a||n);let u=ro.getSchemaRefs.call(this,t,n);return c=new to.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):to.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{to.compileSchema.call(this,t)}finally{this.opts=r}}};no.ValidationError=fz.default;no.MissingRefError=Xv.default;Ee.default=no;function Wv(e,t,r,n="error"){for(let i in e){let o=i;o in t&&this.logger[n](`${r}: option ${i}. ${e[o]}`)}}function Gv(e){return e=(0,ro.normalizeId)(e),this.schemas[e]||this.refs[e]}function xz(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function wz(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function kz(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function Sz(){let e={...this.opts};for(let t of vz)delete e[t];return e}var zz={log(){},warn(){},error(){}};function Iz(e){if(e===!1)return zz;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var jz=/^[a-z_$][a-z0-9_$:-]*$/i;function Pz(e,t){let{RULES:r}=this;if((0,fp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!jz.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function pp(e,t,r){var n;let i=t?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,a=i?o.post:o.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,ns.getJSONTypes)(t.type),schemaType:(0,ns.getJSONTypes)(t.schemaType)}};t.before?Tz.call(this,a,s,t.before):a.rules.push(s),o.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Tz(e,t,r){let n=e.rules.findIndex(i=>i.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function Ez(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Qv(t)),e.validateSchema=this.compile(t,!0))}var Oz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Qv(e){return{anyOf:[e,Oz]}}});var ty=j(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var Nz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};mp.default=Nz});var oy=j(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.callRef=Or.getValidate=void 0;var Rz=Qi(),ry=mt(),Ye=W(),$n=Kt(),ny=Ya(),is=ie(),Dz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:i,schemaEnv:o,validateName:a,opts:s,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&i===u.baseId)return d();let l=ny.resolveRef.call(c,u,i,r);if(l===void 0)throw new Rz.default(n.opts.uriResolver,i,r);if(l instanceof ny.SchemaEnv)return f(l);return p(l);function d(){if(o===u)return os(e,a,o,o.$async);let h=t.scopeValue("root",{ref:u});return os(e,(0,Ye._)`${h}.validate`,u,u.$async)}function f(h){let g=iy(e,h);os(e,g,h,h.$async)}function p(h){let g=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Ye.stringify)(h)}:{ref:h}),_=t.name("valid"),k=e.subschema({schema:h,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:g,errSchemaPath:r},_);e.mergeEvaluated(k),e.ok(_)}}};function iy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ye._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Or.getValidate=iy;function os(e,t,r,n){let{gen:i,it:o}=e,{allErrors:a,schemaEnv:s,opts:c}=o,u=c.passContext?$n.default.this:Ye.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=i.let("valid");i.try(()=>{i.code((0,Ye._)`await ${(0,ry.callValidateCode)(e,t,u)}`),p(t),a||i.assign(h,!0)},g=>{i.if((0,Ye._)`!(${g} instanceof ${o.ValidationError})`,()=>i.throw(g)),f(g),a||i.assign(h,!1)}),e.ok(h)}function d(){e.result((0,ry.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(h){let g=(0,Ye._)`${h}.errors`;i.assign($n.default.vErrors,(0,Ye._)`${$n.default.vErrors} === null ? ${g} : ${$n.default.vErrors}.concat(${g})`),i.assign($n.default.errors,(0,Ye._)`${$n.default.vErrors}.length`)}function p(h){var g;if(!o.opts.unevaluated)return;let _=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(o.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(o.props=is.mergeEvaluated.props(i,_.props,o.props));else{let k=i.var("props",(0,Ye._)`${h}.evaluated.props`);o.props=is.mergeEvaluated.props(i,k,o.props,Ye.Name)}if(o.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(o.items=is.mergeEvaluated.items(i,_.items,o.items));else{let k=i.var("items",(0,Ye._)`${h}.evaluated.items`);o.items=is.mergeEvaluated.items(i,k,o.items,Ye.Name)}}}Or.callRef=os;Or.default=Dz});var ay=j(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var Az=ty(),Cz=oy(),Zz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Az.default,Cz.default];hp.default=Zz});var sy=j(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var as=W(),mr=as.operators,ss={maximum:{okStr:"<=",ok:mr.LTE,fail:mr.GT},minimum:{okStr:">=",ok:mr.GTE,fail:mr.LT},exclusiveMaximum:{okStr:"<",ok:mr.LT,fail:mr.GTE},exclusiveMinimum:{okStr:">",ok:mr.GT,fail:mr.LTE}},Uz={message:({keyword:e,schemaCode:t})=>(0,as.str)`must be ${ss[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,as._)`{comparison: ${ss[e].okStr}, limit: ${t}}`},Mz={keyword:Object.keys(ss),type:"number",schemaType:"number",$data:!0,error:Uz,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,as._)`${r} ${ss[t].fail} ${n} || isNaN(${r})`)}};gp.default=Mz});var cy=j(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});var io=W(),qz={message:({schemaCode:e})=>(0,io.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,io._)`{multipleOf: ${e}}`},Lz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:qz,code(e){let{gen:t,data:r,schemaCode:n,it:i}=e,o=i.opts.multipleOfPrecision,a=t.let("res"),s=o?(0,io._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0,io._)`${a} !== parseInt(${a})`;e.fail$data((0,io._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};vp.default=Lz});var ly=j(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});function uy(e){let t=e.length,r=0,n=0,i;for(;n<t;)r++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<t&&(i=e.charCodeAt(n),(i&64512)===56320&&n++);return r}yp.default=uy;uy.code='(function(){return{default:function(s){var l=0,i=0,c;for(;i<s.length;l++){c=s.charCodeAt(i++);if(c>=55296&&c<=56319&&i<s.length)i++}return l}}}).call(this).default'});var dy=j(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var Nr=W(),Fz=ie(),Vz=ly(),Jz={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Nr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Nr._)`{limit: ${e}}`},Bz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Jz,code(e){let{keyword:t,data:r,schemaCode:n,it:i}=e,o=t==="maxLength"?Nr.operators.GT:Nr.operators.LT,a=i.opts.unicode===!1?(0,Nr._)`${r}.length`:(0,Nr._)`${(0,Fz.useFunc)(e.gen,Vz.default)}(${r})`;e.fail$data((0,Nr._)`${a} ${o} ${n}`)}};_p.default=Bz});var py=j($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});var Kz=mt(),Hz=ie(),bn=W(),Wz={message:({schemaCode:e})=>(0,bn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,bn._)`{pattern: ${e}}`},Gz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Wz,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,bn._)`new RegExp`:(0,Hz.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,bn._)`${u}(${o}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,bn._)`!${l}`)}else{let c=(0,Kz.usePattern)(e,i);e.fail$data((0,bn._)`!${c}.test(${r})`)}}};$p.default=Gz});var fy=j(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var oo=W(),Xz={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,oo.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,oo._)`{limit: ${e}}`},Yz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Xz,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxProperties"?oo.operators.GT:oo.operators.LT;e.fail$data((0,oo._)`Object.keys(${r}).length ${i} ${n}`)}};bp.default=Yz});var my=j(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var ao=mt(),so=W(),Qz=ie(),eI={message:({params:{missingProperty:e}})=>(0,so.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,so._)`{missingProperty: ${e}}`},tI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:eI,code(e){let{gen:t,schema:r,schemaCode:n,data:i,$data:o,it:a}=e,{opts:s}=a;if(!o&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if(p?.[g]===void 0&&!h.has(g)){let _=a.schemaEnv.baseId+a.errSchemaPath,k=`required property "${g}" is not defined at "${_}" (strictRequired)`;(0,Qz.checkStrictMode)(a,k,a.opts.strictRequired)}}function u(){if(c||o)e.block$data(so.nil,d);else for(let p of r)(0,ao.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||o){let h=t.let("valid",!0);e.block$data(h,()=>f(p,h)),e.ok(h)}else t.if((0,ao.checkMissingProp)(e,r,p)),(0,ao.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,ao.noPropertyInData)(t,i,p,s.ownProperties),()=>e.error())})}function f(p,h){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(h,(0,ao.propertyInData)(t,i,p,s.ownProperties)),t.if((0,so.not)(h),()=>{e.error(),t.break()})},so.nil)}}};xp.default=tI});var hy=j(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});var co=W(),rI={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,co.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,co._)`{limit: ${e}}`},nI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:rI,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxItems"?co.operators.GT:co.operators.LT;e.fail$data((0,co._)`${r}.length ${i} ${n}`)}};wp.default=nI});var cs=j(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var gy=Hd();gy.code='(function(){function equal(a,b){if(a===b)return true;if(a&&b&&typeof a=="object"&&typeof b=="object"){if(a.constructor!==b.constructor)return false;var length,i,keys;if(Array.isArray(a)){length=a.length;if(length!=b.length)return false;for(i=length;i--!==0;)if(!equal(a[i],b[i]))return false;return true}if(a instanceof Map&&b instanceof Map){if(a.size!==b.size)return false;for(i of a.entries())if(!b.has(i[0]))return false;for(i of a.entries())if(!equal(i[1],b.get(i[0])))return false;return true}if(a instanceof Set&&b instanceof Set){if(a.size!==b.size)return false;for(i of a.entries())if(!b.has(i[0]))return false;return true}if(a.constructor===RegExp)return a.source===b.source&&a.flags===b.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===b.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===b.toString();keys=Object.keys(a);length=keys.length;if(length!==Object.keys(b).length)return false;for(i=length;i--!==0;)if(!Object.prototype.hasOwnProperty.call(b,keys[i]))return false;for(i=length;i--!==0;){var key=keys[i];if(!equal(a[key],b[key]))return false}return true}return a!==a&&b!==b};return{default:equal}}).call(this).default';kp.default=gy});var vy=j(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var Sp=Hi(),Oe=W(),iI=ie(),oI=cs(),aI={message:({params:{i:e,j:t}})=>(0,Oe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Oe._)`{i: ${e}, j: ${t}}`},sI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:aI,code(e){let{gen:t,data:r,$data:n,schema:i,parentSchema:o,schemaCode:a,it:s}=e;if(!n&&!i)return;let c=t.let("valid"),u=o.items?(0,Sp.getSchemaTypes)(o.items):[];e.block$data(c,l,(0,Oe._)`${a} === false`),e.ok(c);function l(){let h=t.let("i",(0,Oe._)`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(c,!0),t.if((0,Oe._)`${h} > 1`,()=>(d()?f:p)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function f(h,g){let _=t.name("item"),k=(0,Sp.checkDataTypes)(u,_,s.opts.strictNumbers,Sp.DataType.Wrong),E=t.const("indices",(0,Oe._)`{}`);t.for((0,Oe._)`;${h}--;`,()=>{t.let(_,(0,Oe._)`${r}[${h}]`),t.if(k,(0,Oe._)`continue`),u.length>1&&t.if((0,Oe._)`typeof ${_} == "string"`,(0,Oe._)`${_} += "_"`),t.if((0,Oe._)`typeof ${E}[${_}] == "number"`,()=>{t.assign(g,(0,Oe._)`${E}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,Oe._)`${E}[${_}] = ${h}`)})}function p(h,g){let _=(0,iI.useFunc)(t,oI.default),k=t.name("outer");t.label(k).for((0,Oe._)`;${h}--;`,()=>t.for((0,Oe._)`${g} = ${h}; ${g}--;`,()=>t.if((0,Oe._)`${_}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(k)})))}}};zp.default=sI});var yy=j(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var Ip=W(),cI=ie(),uI=cs(),lI={message:"must be equal to constant",params:({schemaCode:e})=>(0,Ip._)`{allowedValue: ${e}}`},dI={keyword:"const",$data:!0,error:lI,code(e){let{gen:t,data:r,$data:n,schemaCode:i,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Ip._)`!${(0,cI.useFunc)(t,uI.default)}(${r}, ${i})`):e.fail((0,Ip._)`${o} !== ${r}`)}};jp.default=dI});var _y=j(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var uo=W(),pI=ie(),fI=cs(),mI={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,uo._)`{allowedValues: ${e}}`},hI={keyword:"enum",schemaType:"array",$data:!0,error:mI,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:a}=e;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,pI.useFunc)(t,fI.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=t.const("vSchema",o);l=(0,uo.or)(...i.map((h,g)=>f(p,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",o,p=>t.if((0,uo._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,h){let g=i[h];return typeof g=="object"&&g!==null?(0,uo._)`${u()}(${r}, ${p}[${h}])`:(0,uo._)`${r} === ${g}`}}};Pp.default=hI});var $y=j(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var gI=sy(),vI=cy(),yI=dy(),_I=py(),$I=fy(),bI=my(),xI=hy(),wI=vy(),kI=yy(),SI=_y(),zI=[gI.default,vI.default,yI.default,_I.default,$I.default,bI.default,xI.default,wI.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},kI.default,SI.default];Tp.default=zI});var Op=j(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.validateAdditionalItems=void 0;var Rr=W(),Ep=ie(),II={message:({params:{len:e}})=>(0,Rr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Rr._)`{limit: ${e}}`},jI={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:II,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Ep.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}by(e,n)}};function by(e,t){let{gen:r,schema:n,data:i,keyword:o,it:a}=e;a.items=!0;let s=r.const("len",(0,Rr._)`${i}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Rr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Ep.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Rr._)`${s} <= ${t.length}`);r.if((0,Rr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:Ep.Type.Num},u),a.allErrors||r.if((0,Rr.not)(u),()=>r.break())})}}lo.validateAdditionalItems=by;lo.default=jI});var Np=j(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.validateTuple=void 0;var xy=W(),us=ie(),PI=mt(),TI={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return wy(e,"additionalItems",t);r.items=!0,!(0,us.alwaysValidSchema)(r,t)&&e.ok((0,PI.validateArray)(e))}};function wy(e,t,r=e.schema){let{gen:n,parentSchema:i,data:o,keyword:a,it:s}=e;l(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=us.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,xy._)`${o}.length`);r.forEach((d,f)=>{(0,us.alwaysValidSchema)(s,d)||(n.if((0,xy._)`${u} > ${f}`,()=>e.subschema({keyword:a,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=s,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!g){let _=`"${a}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,us.checkStrictMode)(s,_,f.strictTuples)}}}po.validateTuple=wy;po.default=TI});var ky=j(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var EI=Np(),OI={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,EI.validateTuple)(e,"items")};Rp.default=OI});var zy=j(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var Sy=W(),NI=ie(),RI=mt(),DI=Op(),AI={message:({params:{len:e}})=>(0,Sy.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Sy._)`{limit: ${e}}`},CI={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:AI,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:i}=r;n.items=!0,!(0,NI.alwaysValidSchema)(n,t)&&(i?(0,DI.validateAdditionalItems)(e,i):e.ok((0,RI.validateArray)(e)))}};Dp.default=CI});var Iy=j(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var gt=W(),ls=ie(),ZI={message:({params:{min:e,max:t}})=>t===void 0?(0,gt.str)`must contain at least ${e} valid item(s)`:(0,gt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,gt._)`{minContains: ${e}}`:(0,gt._)`{minContains: ${e}, maxContains: ${t}}`},UI={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ZI,code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e,a,s,{minContains:c,maxContains:u}=n;o.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,gt._)`${i}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,ls.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,ls.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ls.alwaysValidSchema)(o,r)){let g=(0,gt._)`${l} >= ${a}`;s!==void 0&&(g=(0,gt._)`${g} && ${l} <= ${s}`),e.pass(g);return}o.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,gt._)`${i}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let g=t.name("_valid"),_=t.let("count",0);p(g,()=>t.if(g,()=>h(_)))}function p(g,_){t.forRange("i",0,l,k=>{e.subschema({keyword:"contains",dataProp:k,dataPropType:ls.Type.Num,compositeRule:!0},g),_()})}function h(g){t.code((0,gt._)`${g}++`),s===void 0?t.if((0,gt._)`${g} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,gt._)`${g} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,gt._)`${g} >= ${a}`,()=>t.assign(d,!0)))}}};Ap.default=UI});var Ty=j(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.validateSchemaDeps=Ot.validatePropertyDeps=Ot.error=void 0;var Cp=W(),MI=ie(),fo=mt();Ot.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Cp.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Cp._)`{property: ${e},
8
+ missingProperty: ${n},
9
+ depsCount: ${t},
10
+ deps: ${r}}`};var qI={keyword:"dependencies",type:"object",schemaType:"object",error:Ot.error,code(e){let[t,r]=LI(e);jy(e,t),Py(e,r)}};function LI({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function jy(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,fo.propertyInData)(r,n,a,i.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(c,()=>{for(let u of s)(0,fo.checkReportMissingProp)(e,u)}):(r.if((0,Cp._)`${c} && (${(0,fo.checkMissingProp)(e,s,o)})`),(0,fo.reportMissingProp)(e,o),r.else())}}Ot.validatePropertyDeps=jy;function Py(e,t=e.schema){let{gen:r,data:n,keyword:i,it:o}=e,a=r.name("valid");for(let s in t)(0,MI.alwaysValidSchema)(o,t[s])||(r.if((0,fo.propertyInData)(r,n,s,o.opts.ownProperties),()=>{let c=e.subschema({keyword:i,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}Ot.validateSchemaDeps=Py;Ot.default=qI});var Oy=j(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var Ey=W(),FI=ie(),VI={message:"property name must be valid",params:({params:e})=>(0,Ey._)`{propertyName: ${e.propertyName}}`},JI={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:VI,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,FI.alwaysValidSchema)(i,r))return;let o=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},o),t.if((0,Ey.not)(o),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(o)}};Zp.default=JI});var Mp=j(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var ds=mt(),kt=W(),BI=Kt(),ps=ie(),KI={message:"must NOT have additional properties",params:({params:e})=>(0,kt._)`{additionalProperty: ${e.additionalProperty}}`},HI={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:KI,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,ps.alwaysValidSchema)(a,r))return;let u=(0,ds.allSchemaProperties)(n.properties),l=(0,ds.allSchemaProperties)(n.patternProperties);d(),e.ok((0,kt._)`${o} === ${BI.default.errors}`);function d(){t.forIn("key",i,_=>{!u.length&&!l.length?h(_):t.if(f(_),()=>h(_))})}function f(_){let k;if(u.length>8){let E=(0,ps.schemaRefOrVal)(a,n.properties,"properties");k=(0,ds.isOwnProperty)(t,E,_)}else u.length?k=(0,kt.or)(...u.map(E=>(0,kt._)`${_} === ${E}`)):k=kt.nil;return l.length&&(k=(0,kt.or)(k,...l.map(E=>(0,kt._)`${(0,ds.usePattern)(e,E)}.test(${_})`))),(0,kt.not)(k)}function p(_){t.code((0,kt._)`delete ${i}[${_}]`)}function h(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,ps.alwaysValidSchema)(a,r)){let k=t.name("valid");c.removeAdditional==="failing"?(g(_,k,!1),t.if((0,kt.not)(k),()=>{e.reset(),p(_)})):(g(_,k),s||t.if((0,kt.not)(k),()=>t.break()))}}function g(_,k,E){let I={keyword:"additionalProperties",dataProp:_,dataPropType:ps.Type.Str};E===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(I,k)}}};Up.default=HI});var Dy=j(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var WI=Yi(),Ny=mt(),qp=ie(),Ry=Mp(),GI={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Ry.default.code(new WI.KeywordCxt(o,Ry.default,"additionalProperties"));let a=(0,Ny.allSchemaProperties)(r);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==!0&&(o.props=qp.mergeEvaluated.props(t,(0,qp.toHash)(a),o.props));let s=a.filter(d=>!(0,qp.alwaysValidSchema)(o,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,Ny.propertyInData)(t,i,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Lp.default=GI});var Uy=j(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var Ay=mt(),fs=W(),Cy=ie(),Zy=ie(),XI={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:o}=e,{opts:a}=o,s=(0,Ay.allSchemaProperties)(r),c=s.filter(g=>(0,Cy.alwaysValidSchema)(o,r[g]));if(s.length===0||c.length===s.length&&(!o.opts.unevaluated||o.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&i.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof fs.Name)&&(o.props=(0,Zy.evaluatedPropsToName)(t,o.props));let{props:d}=o;f();function f(){for(let g of s)u&&p(g),o.allErrors?h(g):(t.var(l,!0),h(g),t.if(l))}function p(g){for(let _ in u)new RegExp(g).test(_)&&(0,Cy.checkStrictMode)(o,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",n,_=>{t.if((0,fs._)`${(0,Ay.usePattern)(e,g)}.test(${_})`,()=>{let k=c.includes(g);k||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:Zy.Type.Str},l),o.opts.unevaluated&&d!==!0?t.assign((0,fs._)`${d}[${_}]`,!0):!k&&!o.allErrors&&t.if((0,fs.not)(l),()=>t.break())})})}}};Fp.default=XI});var My=j(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var YI=ie(),QI={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,YI.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Vp.default=QI});var qy=j(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var ej=mt(),tj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ej.validateUnion,error:{message:"must match a schema in anyOf"}};Jp.default=tj});var Ly=j(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var ms=W(),rj=ie(),nj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,ms._)`{passingSchemas: ${e.passing}}`},ij={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:nj,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((l,d)=>{let f;(0,rj.alwaysValidSchema)(i,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,ms._)`${c} && ${a}`).assign(a,!1).assign(s,(0,ms._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,ms.Name)})})}}};Bp.default=ij});var Fy=j(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var oj=ie(),aj={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=t.name("valid");r.forEach((o,a)=>{if((0,oj.alwaysValidSchema)(n,o))return;let s=e.subschema({keyword:"allOf",schemaProp:a},i);e.ok(i),e.mergeEvaluated(s)})}};Kp.default=aj});var By=j(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var hs=W(),Jy=ie(),sj={message:({params:e})=>(0,hs.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,hs._)`{failingKeyword: ${e.ifClause}}`},cj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:sj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Jy.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=Vy(n,"then"),o=Vy(n,"else");if(!i&&!o)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),i&&o){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else i?t.if(s,u("then")):t.if((0,hs.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(f,a),d?t.assign(d,(0,hs._)`${l}`):e.setParams({ifClause:l})}}}};function Vy(e,t){let r=e.schema[t];return r!==void 0&&!(0,Jy.alwaysValidSchema)(e,r)}Hp.default=cj});var Ky=j(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var uj=ie(),lj={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,uj.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Wp.default=lj});var Hy=j(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var dj=Op(),pj=ky(),fj=Np(),mj=zy(),hj=Iy(),gj=Ty(),vj=Oy(),yj=Mp(),_j=Dy(),$j=Uy(),bj=My(),xj=qy(),wj=Ly(),kj=Fy(),Sj=By(),zj=Ky();function Ij(e=!1){let t=[bj.default,xj.default,wj.default,kj.default,Sj.default,zj.default,vj.default,yj.default,gj.default,_j.default,$j.default];return e?t.push(pj.default,mj.default):t.push(dj.default,fj.default),t.push(hj.default),t}Gp.default=Ij});var Wy=j(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var $e=W(),jj={message:({schemaCode:e})=>(0,$e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,$e._)`{format: ${e}}`},Pj={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:jj,code(e,t){let{gen:r,data:n,$data:i,schema:o,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;i?f():p();function f(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,$e._)`${h}[${a}]`),_=r.let("fType"),k=r.let("format");r.if((0,$e._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(_,(0,$e._)`${g}.type || "string"`).assign(k,(0,$e._)`${g}.validate`),()=>r.assign(_,(0,$e._)`"string"`).assign(k,g)),e.fail$data((0,$e.or)(E(),I()));function E(){return c.strictSchema===!1?$e.nil:(0,$e._)`${a} && !${k}`}function I(){let A=l.$async?(0,$e._)`(${g}.async ? await ${k}(${n}) : ${k}(${n}))`:(0,$e._)`${k}(${n})`,O=(0,$e._)`(typeof ${k} == "function" ? ${A} : ${k}.test(${n}))`;return(0,$e._)`${k} && ${k} !== true && ${_} === ${t} && !${O}`}}function p(){let h=d.formats[o];if(!h){E();return}if(h===!0)return;let[g,_,k]=I(h);g===t&&e.pass(A());function E(){if(c.strictSchema===!1){d.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function I(O){let xe=O instanceof RegExp?(0,$e.regexpCode)(O):c.code.formats?(0,$e._)`${c.code.formats}${(0,$e.getProperty)(o)}`:void 0,Qe=r.scopeValue("formats",{key:o,ref:O,code:xe});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,$e._)`${Qe}.validate`]:["string",O,Qe]}function A(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,$e._)`await ${k}(${n})`}return typeof _=="function"?(0,$e._)`${k}(${n})`:(0,$e._)`${k}.test(${n})`}}}};Xp.default=Pj});var Gy=j(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var Tj=Wy(),Ej=[Tj.default];Yp.default=Ej});var Xy=j(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.contentVocabulary=xn.metadataVocabulary=void 0;xn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];xn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Qy=j(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Oj=ay(),Nj=$y(),Rj=Hy(),Dj=Gy(),Yy=Xy(),Aj=[Oj.default,Nj.default,(0,Rj.default)(),Dj.default,Yy.metadataVocabulary,Yy.contentVocabulary];Qp.default=Aj});var t_=j(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.DiscrError=void 0;var e_;(function(e){e.Tag="tag",e.Mapping="mapping"})(e_||(gs.DiscrError=e_={}))});var n_=j(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var wn=W(),ef=t_(),r_=Ya(),Cj=Qi(),Zj=ie(),Uj={message:({params:{discrError:e,tagName:t}})=>e===ef.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,wn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Mj={keyword:"discriminator",type:"object",schemaType:"object",error:Uj,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:o}=e,{oneOf:a}=i;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,wn._)`${r}${(0,wn.getProperty)(s)}`);t.if((0,wn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:ef.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=f();t.if(!1);for(let h in p)t.elseIf((0,wn._)`${u} === ${h}`),t.assign(c,d(p[h]));t.else(),e.error(!1,{discrError:ef.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:p},h);return e.mergeEvaluated(g,wn.Name),h}function f(){var p;let h={},g=k(i),_=!0;for(let A=0;A<a.length;A++){let O=a[A];if(O?.$ref&&!(0,Zj.schemaHasRulesButRef)(O,o.self.RULES)){let Qe=O.$ref;if(O=r_.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,Qe),O instanceof r_.SchemaEnv&&(O=O.schema),O===void 0)throw new Cj.default(o.opts.uriResolver,o.baseId,Qe)}let xe=(p=O?.properties)===null||p===void 0?void 0:p[s];if(typeof xe!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);_=_&&(g||k(O)),E(xe,A)}if(!_)throw new Error(`discriminator: "${s}" must be required`);return h;function k({required:A}){return Array.isArray(A)&&A.includes(s)}function E(A,O){if(A.const)I(A.const,O);else if(A.enum)for(let xe of A.enum)I(xe,O);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function I(A,O){if(typeof A!="string"||A in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[A]=O}}}};tf.default=Mj});var i_=j((hZ,qj)=>{qj.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var nf=j((_e,rf)=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.MissingRefError=_e.ValidationError=_e.CodeGen=_e.Name=_e.nil=_e.stringify=_e.str=_e._=_e.KeywordCxt=_e.Ajv=void 0;var Lj=ey(),Fj=Qy(),Vj=n_(),o_=i_(),Jj=["/properties"],vs="http://json-schema.org/draft-07/schema",kn=class extends Lj.default{_addVocabularies(){super._addVocabularies(),Fj.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Vj.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(o_,Jj):o_;this.addMetaSchema(t,vs,!1),this.refs["http://json-schema.org/schema"]=vs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(vs)?vs:void 0)}};_e.Ajv=kn;rf.exports=_e=kn;rf.exports.Ajv=kn;Object.defineProperty(_e,"__esModule",{value:!0});_e.default=kn;var Bj=Yi();Object.defineProperty(_e,"KeywordCxt",{enumerable:!0,get:function(){return Bj.KeywordCxt}});var Sn=W();Object.defineProperty(_e,"_",{enumerable:!0,get:function(){return Sn._}});Object.defineProperty(_e,"str",{enumerable:!0,get:function(){return Sn.str}});Object.defineProperty(_e,"stringify",{enumerable:!0,get:function(){return Sn.stringify}});Object.defineProperty(_e,"nil",{enumerable:!0,get:function(){return Sn.nil}});Object.defineProperty(_e,"Name",{enumerable:!0,get:function(){return Sn.Name}});Object.defineProperty(_e,"CodeGen",{enumerable:!0,get:function(){return Sn.CodeGen}});var Kj=Ga();Object.defineProperty(_e,"ValidationError",{enumerable:!0,get:function(){return Kj.default}});var Hj=Qi();Object.defineProperty(_e,"MissingRefError",{enumerable:!0,get:function(){return Hj.default}})});var f_=j(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.formatNames=Rt.fastFormats=Rt.fullFormats=void 0;function Nt(e,t){return{validate:e,compare:t}}Rt.fullFormats={date:Nt(u_,cf),time:Nt(af(!0),uf),"date-time":Nt(a_(!0),d_),"iso-time":Nt(af(),l_),"iso-date-time":Nt(a_(),p_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:eP,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:sP,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:tP,int32:{type:"number",validate:iP},int64:{type:"number",validate:oP},float:{type:"number",validate:c_},double:{type:"number",validate:c_},password:!0,binary:!0};Rt.fastFormats={...Rt.fullFormats,date:Nt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,cf),time:Nt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uf),"date-time":Nt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,d_),"iso-time":Nt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l_),"iso-date-time":Nt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,p_),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Rt.formatNames=Object.keys(Rt.fullFormats);function Wj(e){return e%4===0&&(e%100!==0||e%400===0)}var Gj=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Xj=[0,31,28,31,30,31,30,31,31,30,31,30,31];function u_(e){let t=Gj.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&Wj(r)?29:Xj[n])}function cf(e,t){if(e&&t)return e>t?1:e<t?-1:0}var of=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function af(e){return function(r){let n=of.exec(r);if(!n)return!1;let i=+n[1],o=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(i<=23&&o<=59&&a<60)return!0;let d=o-l*c,f=i-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function uf(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function l_(e,t){if(!(e&&t))return;let r=of.exec(e),n=of.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var sf=/t|\s/i;function a_(e){let t=af(e);return function(n){let i=n.split(sf);return i.length===2&&u_(i[0])&&t(i[1])}}function d_(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function p_(e,t){if(!(e&&t))return;let[r,n]=e.split(sf),[i,o]=t.split(sf),a=cf(r,i);if(a!==void 0)return a||uf(n,o)}var Yj=/\/|:/,Qj=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function eP(e){return Yj.test(e)&&Qj.test(e)}var s_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function tP(e){return s_.lastIndex=0,s_.test(e)}var rP=-(2**31),nP=2**31-1;function iP(e){return Number.isInteger(e)&&e<=nP&&e>=rP}function oP(e){return Number.isInteger(e)}function c_(){return!0}var aP=/[^\\]\\Z/;function sP(e){if(aP.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var m_=j(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.formatLimitDefinition=void 0;var cP=nf(),St=W(),hr=St.operators,ys={formatMaximum:{okStr:"<=",ok:hr.LTE,fail:hr.GT},formatMinimum:{okStr:">=",ok:hr.GTE,fail:hr.LT},formatExclusiveMaximum:{okStr:"<",ok:hr.LT,fail:hr.GTE},formatExclusiveMinimum:{okStr:">",ok:hr.GT,fail:hr.LTE}},uP={message:({keyword:e,schemaCode:t})=>(0,St.str)`should be ${ys[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,St._)`{comparison: ${ys[e].okStr}, limit: ${t}}`};zn.formatLimitDefinition={keyword:Object.keys(ys),type:"string",schemaType:"string",$data:!0,error:uP,code(e){let{gen:t,data:r,schemaCode:n,keyword:i,it:o}=e,{opts:a,self:s}=o;if(!a.validateFormats)return;let c=new cP.KeywordCxt(o,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,St._)`${f}[${c.schemaCode}]`);e.fail$data((0,St.or)((0,St._)`typeof ${p} != "object"`,(0,St._)`${p} instanceof RegExp`,(0,St._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=s.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,St._)`${a.code.formats}${(0,St.getProperty)(f)}`:void 0});e.fail$data(d(h))}function d(f){return(0,St._)`${f}.compare(${r}, ${n}) ${ys[i].fail} 0`}},dependencies:["format"]};var lP=e=>(e.addKeyword(zn.formatLimitDefinition),e);zn.default=lP});var y_=j((mo,v_)=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});var In=f_(),dP=m_(),lf=W(),h_=new lf.Name("fullFormats"),pP=new lf.Name("fastFormats"),df=(e,t={keywords:!0})=>{if(Array.isArray(t))return g_(e,t,In.fullFormats,h_),e;let[r,n]=t.mode==="fast"?[In.fastFormats,pP]:[In.fullFormats,h_],i=t.formats||In.formatNames;return g_(e,i,r,n),t.keywords&&(0,dP.default)(e),e};df.get=(e,t="full")=>{let n=(t==="fast"?In.fastFormats:In.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function g_(e,t,r,n){var i,o;(i=(o=e.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,lf._)`(function(){return{default:{}}}).call(this).${n}`);for(let a of t)e.addFormat(a,r[a])}v_.exports=mo=df;Object.defineProperty(mo,"__esModule",{value:!0});mo.default=df});var te;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let a of i)o[a]=a;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(let s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(let a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(te||(te={}));var hf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(hf||(hf={}));var P=te.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Dt=e=>{switch(typeof e){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(e)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(e)?P.array:e===null?P.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?P.promise:typeof Map<"u"&&e instanceof Map?P.map:typeof Set<"u"&&e instanceof Set?P.set:typeof Date<"u"&&e instanceof Date?P.date:P.object;default:return P.unknown}};var b=te.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"]);var et=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,te.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};et.create=e=>new et(e);var C_=(e,t)=>{let r;switch(e.code){case b.invalid_type:e.received===P.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,te.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:r=`Unrecognized key(s) in object: ${te.joinValues(e.keys,", ")}`;break;case b.invalid_union:r="Invalid input";break;case b.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${te.joinValues(e.options)}`;break;case b.invalid_enum_value:r=`Invalid enum value. Expected ${te.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:r="Invalid function arguments";break;case b.invalid_return_type:r="Invalid function return type";break;case b.invalid_date:r="Invalid date";break;case b.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:te.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case b.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case b.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case b.custom:r="Invalid input";break;case b.invalid_intersection_types:r="Intersection results could not be merged";break;case b.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:r="Number must be finite";break;default:r=t.defaultError,te.assertNever(e)}return{message:r}},Xt=C_;var Z_=Xt;function Tn(){return Z_}var go=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],a={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:s}};function S(e,t){let r=Tn(),n=go({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Xt?void 0:Xt].filter(i=>!!i)});e.common.issues.push(n)}var Re=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return M;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,a=await i.value;n.push({key:o,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return M;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[o.value]=a.value)}return{status:t.value,value:n}}},M=Object.freeze({status:"aborted"}),Ar=e=>({status:"dirty",value:e}),Me=e=>({status:"valid",value:e}),Is=e=>e.status==="aborted",js=e=>e.status==="dirty",gr=e=>e.status==="valid",En=e=>typeof Promise<"u"&&e instanceof Promise;var N;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(N||(N={}));var ct=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}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}},gf=(e,t)=>{if(gr(t))return{success:!0,data:t.value};if(!e.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 et(e.common.issues);return this._error=r,this._error}}};function V(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var G=class{get description(){return this._def.description}_getType(t){return Dt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Dt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Re,ctx:{common:t.parent.common,data:t.data,parsedType:Dt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(En(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Dt(t)},i=this._parseSync({data:t,path:n.path,parent:n});return gf(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Dt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return gr(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:t,path:[],parent:r}).then(n=>gr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Dt(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(En(i)?i:Promise.resolve(i));return gf(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let a=t(i),s=()=>o.addIssue({code:b.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new _t({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 yt.create(this,this._def)}nullable(){return Zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qt.create(this)}promise(){return vr.create(this,this._def)}or(t){return qr.create([this,t],this._def)}and(t){return Lr.create(this,t,this._def)}transform(t){return new _t({...V(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Kr({...V(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new vo({typeName:C.ZodBranded,type:this,...V(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Hr({...V(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return yo.create(this,t)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},U_=/^c[^\s-]{8,}$/i,M_=/^[0-9a-z]+$/,q_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,L_=/^[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,F_=/^[a-z0-9_-]{21}$/i,V_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,J_=/^[-+]?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)?)??$/,B_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,K_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ps,H_=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,W_=/^(?:(?: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])$/,G_=/^(([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]))$/,X_=/^(([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])$/,Y_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Q_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vf="((\\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])))",e$=new RegExp(`^${vf}$`);function yf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function t$(e){return new RegExp(`^${yf(e)}$`)}function r$(e){let t=`${vf}T${yf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function n$(e,t){return!!((t==="v4"||!t)&&H_.test(e)||(t==="v6"||!t)&&G_.test(e))}function i$(e,t){if(!V_.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function o$(e,t){return!!((t==="v4"||!t)&&W_.test(e)||(t==="v6"||!t)&&X_.test(e))}var Zr=class e extends G{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==P.string){let o=this._getOrReturnCtx(t);return S(o,{code:b.invalid_type,expected:P.string,received:o.parsedType}),M}let n=new Re,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),S(i,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),S(i,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let a=t.data.length>o.value,s=t.data.length<o.value;(a||s)&&(i=this._getOrReturnCtx(t,i),a?S(i,{code:b.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&S(i,{code:b.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")B_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"email",code:b.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Ps||(Ps=new RegExp(K_,"u")),Ps.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"emoji",code:b.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")L_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"uuid",code:b.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")F_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"nanoid",code:b.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")U_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"cuid",code:b.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")M_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"cuid2",code:b.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")q_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"ulid",code:b.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),S(i,{validation:"url",code:b.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"regex",code:b.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),S(i,{code:b.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),S(i,{code:b.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),S(i,{code:b.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?r$(o).test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{code:b.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?e$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{code:b.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?t$(o).test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{code:b.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?J_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"duration",code:b.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?n$(t.data,o.version)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"ip",code:b.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?i$(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"jwt",code:b.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?o$(t.data,o.version)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"cidr",code:b.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Y_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"base64",code:b.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Q_.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"base64url",code:b.invalid_string,message:o.message}),n.dirty()):te.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:b.invalid_string,...N.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...N.errToObj(t)})}url(t){return this._addCheck({kind:"url",...N.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...N.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...N.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...N.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...N.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...N.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...N.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...N.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...N.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...N.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...N.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...N.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...N.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...N.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...N.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...N.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...N.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...N.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...N.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...N.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...N.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...N.errToObj(r)})}nonempty(t){return this.min(1,N.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Zr.create=e=>new Zr({checks:[],typeName:C.ZodString,coerce:e?.coerce??!1,...V(e)});function a$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return o%a/10**i}var On=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==P.number){let o=this._getOrReturnCtx(t);return S(o,{code:b.invalid_type,expected:P.number,received:o.parsedType}),M}let n,i=new Re;for(let o of this._def.checks)o.kind==="int"?te.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),S(n,{code:b.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:b.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:b.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?a$(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),S(n,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),S(n,{code:b.not_finite,message:o.message}),i.dirty()):te.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,N.toString(r))}gt(t,r){return this.setLimit("min",t,!1,N.toString(r))}lte(t,r){return this.setLimit("max",t,!0,N.toString(r))}lt(t,r){return this.setLimit("max",t,!1,N.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:N.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:N.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:N.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:N.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&te.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};On.create=e=>new On({checks:[],typeName:C.ZodNumber,coerce:e?.coerce||!1,...V(e)});var Nn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==P.bigint)return this._getInvalidInput(t);let n,i=new Re;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:b.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:b.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),S(n,{code:b.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):te.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return S(r,{code:b.invalid_type,expected:P.bigint,received:r.parsedType}),M}gte(t,r){return this.setLimit("min",t,!0,N.toString(r))}gt(t,r){return this.setLimit("min",t,!1,N.toString(r))}lte(t,r){return this.setLimit("max",t,!0,N.toString(r))}lt(t,r){return this.setLimit("max",t,!1,N.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:N.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:N.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Nn.create=e=>new Nn({checks:[],typeName:C.ZodBigInt,coerce:e?.coerce??!1,...V(e)});var Rn=class extends G{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==P.boolean){let n=this._getOrReturnCtx(t);return S(n,{code:b.invalid_type,expected:P.boolean,received:n.parsedType}),M}return Me(t.data)}};Rn.create=e=>new Rn({typeName:C.ZodBoolean,coerce:e?.coerce||!1,...V(e)});var Dn=class e extends G{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==P.date){let o=this._getOrReturnCtx(t);return S(o,{code:b.invalid_type,expected:P.date,received:o.parsedType}),M}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return S(o,{code:b.invalid_date}),M}let n=new Re,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),S(i,{code:b.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),S(i,{code:b.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):te.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:N.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:N.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Dn.create=e=>new Dn({checks:[],coerce:e?.coerce||!1,typeName:C.ZodDate,...V(e)});var An=class extends G{_parse(t){if(this._getType(t)!==P.symbol){let n=this._getOrReturnCtx(t);return S(n,{code:b.invalid_type,expected:P.symbol,received:n.parsedType}),M}return Me(t.data)}};An.create=e=>new An({typeName:C.ZodSymbol,...V(e)});var Ur=class extends G{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return S(n,{code:b.invalid_type,expected:P.undefined,received:n.parsedType}),M}return Me(t.data)}};Ur.create=e=>new Ur({typeName:C.ZodUndefined,...V(e)});var Mr=class extends G{_parse(t){if(this._getType(t)!==P.null){let n=this._getOrReturnCtx(t);return S(n,{code:b.invalid_type,expected:P.null,received:n.parsedType}),M}return Me(t.data)}};Mr.create=e=>new Mr({typeName:C.ZodNull,...V(e)});var Cn=class extends G{constructor(){super(...arguments),this._any=!0}_parse(t){return Me(t.data)}};Cn.create=e=>new Cn({typeName:C.ZodAny,...V(e)});var Yt=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Me(t.data)}};Yt.create=e=>new Yt({typeName:C.ZodUnknown,...V(e)});var zt=class extends G{_parse(t){let r=this._getOrReturnCtx(t);return S(r,{code:b.invalid_type,expected:P.never,received:r.parsedType}),M}};zt.create=e=>new zt({typeName:C.ZodNever,...V(e)});var Zn=class extends G{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return S(n,{code:b.invalid_type,expected:P.void,received:n.parsedType}),M}return Me(t.data)}};Zn.create=e=>new Zn({typeName:C.ZodVoid,...V(e)});var Qt=class e extends G{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==P.array)return S(r,{code:b.invalid_type,expected:P.array,received:r.parsedType}),M;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(a||s)&&(S(r,{code:a?b.too_big:b.too_small,minimum:s?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(S(r,{code:b.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(S(r,{code:b.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>i.type._parseAsync(new ct(r,a,r.path,s)))).then(a=>Re.mergeArray(n,a));let o=[...r.data].map((a,s)=>i.type._parseSync(new ct(r,a,r.path,s)));return Re.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:N.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:N.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:N.toString(r)}})}nonempty(t){return this.min(1,t)}};Qt.create=(e,t)=>new Qt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...V(t)});function Cr(e){if(e instanceof tt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=yt.create(Cr(n))}return new tt({...e._def,shape:()=>t})}else return e instanceof Qt?new Qt({...e._def,type:Cr(e.element)}):e instanceof yt?yt.create(Cr(e.unwrap())):e instanceof Zt?Zt.create(Cr(e.unwrap())):e instanceof Ct?Ct.create(e.items.map(t=>Cr(t))):e}var tt=class e extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=te.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==P.object){let u=this._getOrReturnCtx(t);return S(u,{code:b.invalid_type,expected:P.object,received:u.parsedType}),M}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof zt&&this._def.unknownKeys==="strip"))for(let u in i.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ct(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof zt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")s.length>0&&(S(i,{code:b.unrecognized_keys,keys:s}),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 s){let d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ct(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(n,u)):Re.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return N.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:N.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:C.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of te.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of te.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Cr(this)}partial(t){let r={};for(let n of te.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of te.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof yt;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return _f(te.objectKeys(this.shape))}};tt.create=(e,t)=>new tt({shape:()=>e,unknownKeys:"strip",catchall:zt.create(),typeName:C.ZodObject,...V(t)});tt.strictCreate=(e,t)=>new tt({shape:()=>e,unknownKeys:"strict",catchall:zt.create(),typeName:C.ZodObject,...V(t)});tt.lazycreate=(e,t)=>new tt({shape:e,unknownKeys:"strip",catchall:zt.create(),typeName:C.ZodObject,...V(t)});var qr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new et(s.ctx.common.issues));return S(r,{code:b.invalid_union,unionErrors:a}),M}if(r.common.async)return Promise.all(n.map(async o=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let o,a=[];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"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(c=>new et(c));return S(r,{code:b.invalid_union,unionErrors:s}),M}}get options(){return this._def.options}};qr.create=(e,t)=>new qr({options:e,typeName:C.ZodUnion,...V(t)});var At=e=>e instanceof Fr?At(e.schema):e instanceof _t?At(e.innerType()):e instanceof Vr?[e.value]:e instanceof Jr?e.options:e instanceof Br?te.objectValues(e.enum):e instanceof Kr?At(e._def.innerType):e instanceof Ur?[void 0]:e instanceof Mr?[null]:e instanceof yt?[void 0,...At(e.unwrap())]:e instanceof Zt?[null,...At(e.unwrap())]:e instanceof vo||e instanceof Wr?At(e.unwrap()):e instanceof Hr?At(e._def.innerType):[],Ts=class e extends G{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.object)return S(r,{code:b.invalid_type,expected:P.object,received:r.parsedType}),M;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(S(r,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let i=new Map;for(let o of r){let a=At(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new e({typeName:C.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...V(n)})}};function Es(e,t){let r=Dt(e),n=Dt(t);if(e===t)return{valid:!0,data:e};if(r===P.object&&n===P.object){let i=te.objectKeys(t),o=te.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(let s of o){let c=Es(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===P.array&&n===P.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let a=e[o],s=t[o],c=Es(a,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===P.date&&n===P.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Lr=class extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,a)=>{if(Is(o)||Is(a))return M;let s=Es(o.value,a.value);return s.valid?((js(o)||js(a))&&r.dirty(),{status:r.value,value:s.data}):(S(n,{code:b.invalid_intersection_types}),M)};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(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Lr.create=(e,t,r)=>new Lr({left:e,right:t,typeName:C.ZodIntersection,...V(r)});var Ct=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.array)return S(n,{code:b.invalid_type,expected:P.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return S(n,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new ct(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(o).then(a=>Re.mergeArray(r,a)):Re.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ct.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ct({items:e,typeName:C.ZodTuple,rest:null,...V(t)})};var Os=class e extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.object)return S(n,{code:b.invalid_type,expected:P.object,received:n.parsedType}),M;let i=[],o=this._def.keyType,a=this._def.valueType;for(let s in n.data)i.push({key:o._parse(new ct(n,s,n.path,s)),value:a._parse(new ct(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Re.mergeObjectAsync(r,i):Re.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof G?new e({keyType:t,valueType:r,typeName:C.ZodRecord,...V(n)}):new e({keyType:Zr.create(),valueType:t,typeName:C.ZodRecord,...V(r)})}},Un=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.map)return S(n,{code:b.invalid_type,expected:P.map,received:n.parsedType}),M;let i=this._def.keyType,o=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:i._parse(new ct(n,s,n.path,[u,"key"])),value:o._parse(new ct(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Un.create=(e,t,r)=>new Un({valueType:t,keyType:e,typeName:C.ZodMap,...V(r)});var Mn=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.set)return S(n,{code:b.invalid_type,expected:P.set,received:n.parsedType}),M;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(S(n,{code:b.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(S(n,{code:b.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return M;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>o._parse(new ct(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:N.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:N.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Mn.create=(e,t)=>new Mn({valueType:e,minSize:null,maxSize:null,typeName:C.ZodSet,...V(t)});var Ns=class e extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.function)return S(r,{code:b.invalid_type,expected:P.function,received:r.parsedType}),M;function n(s,c){return go({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Tn(),Xt].filter(u=>!!u),issueData:{code:b.invalid_arguments,argumentsError:c}})}function i(s,c){return go({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Tn(),Xt].filter(u=>!!u),issueData:{code:b.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof vr){let s=this;return Me(async function(...c){let u=new et([]),l=await s._def.args.parseAsync(c,o).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,o).catch(p=>{throw u.addIssue(i(d,p)),u})})}else{let s=this;return Me(function(...c){let u=s._def.args.safeParse(c,o);if(!u.success)throw new et([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,o);if(!d.success)throw new et([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ct.create(t).rest(Yt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Ct.create([]).rest(Yt.create()),returns:r||Yt.create(),typeName:C.ZodFunction,...V(n)})}},Fr=class extends G{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Fr.create=(e,t)=>new Fr({getter:e,typeName:C.ZodLazy,...V(t)});var Vr=class extends G{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return S(r,{received:r.data,code:b.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:t.data}}get value(){return this._def.value}};Vr.create=(e,t)=>new Vr({value:e,typeName:C.ZodLiteral,...V(t)});function _f(e,t){return new Jr({values:e,typeName:C.ZodEnum,...V(t)})}var Jr=class e extends G{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return S(r,{expected:te.joinValues(n),received:r.parsedType,code:b.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return S(r,{received:r.data,code:b.invalid_enum_value,options:n}),M}return Me(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Jr.create=_f;var Br=class extends G{_parse(t){let r=te.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==P.string&&n.parsedType!==P.number){let i=te.objectValues(r);return S(n,{expected:te.joinValues(i),received:n.parsedType,code:b.invalid_type}),M}if(this._cache||(this._cache=new Set(te.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=te.objectValues(r);return S(n,{received:n.data,code:b.invalid_enum_value,options:i}),M}return Me(t.data)}get enum(){return this._def.values}};Br.create=(e,t)=>new Br({values:e,typeName:C.ZodNativeEnum,...V(t)});var vr=class extends G{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.promise&&r.common.async===!1)return S(r,{code:b.invalid_type,expected:P.promise,received:r.parsedType}),M;let n=r.parsedType===P.promise?r.data:Promise.resolve(r.data);return Me(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};vr.create=(e,t)=>new vr({type:e,typeName:C.ZodPromise,...V(t)});var _t=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{S(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let a=i.transform(n.data,o);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?Ar(c.value):r.value==="dirty"?Ar(c.value):c});{if(r.value==="aborted")return M;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?Ar(s.value):r.value==="dirty"?Ar(s.value):s}}if(i.type==="refinement"){let a=s=>{let c=i.refinement(s,o);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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!gr(a))return M;let s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>gr(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:r.value,value:s})):M);te.assertNever(i)}};_t.create=(e,t,r)=>new _t({schema:e,typeName:C.ZodEffects,effect:t,...V(r)});_t.createWithPreprocess=(e,t,r)=>new _t({schema:t,effect:{type:"preprocess",transform:e},typeName:C.ZodEffects,...V(r)});var yt=class extends G{_parse(t){return this._getType(t)===P.undefined?Me(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};yt.create=(e,t)=>new yt({innerType:e,typeName:C.ZodOptional,...V(t)});var Zt=class extends G{_parse(t){return this._getType(t)===P.null?Me(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Zt.create=(e,t)=>new Zt({innerType:e,typeName:C.ZodNullable,...V(t)});var Kr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Kr.create=(e,t)=>new Kr({innerType:e,typeName:C.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...V(t)});var Hr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return En(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new et(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new et(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Hr.create=(e,t)=>new Hr({innerType:e,typeName:C.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...V(t)});var qn=class extends G{_parse(t){if(this._getType(t)!==P.nan){let n=this._getOrReturnCtx(t);return S(n,{code:b.invalid_type,expected:P.nan,received:n.parsedType}),M}return{status:"valid",value:t.data}}};qn.create=e=>new qn({typeName:C.ZodNaN,...V(e)});var vo=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},yo=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:o.status==="dirty"?(r.dirty(),Ar(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?M:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:C.ZodPipeline})}},Wr=class extends G{_parse(t){let r=this._def.innerType._parse(t),n=i=>(gr(i)&&(i.value=Object.freeze(i.value)),i);return En(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:C.ZodReadonly,...V(t)});var iT={object:tt.lazycreate},C;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(C||(C={}));var oT=Zr.create,aT=On.create,sT=qn.create,cT=Nn.create,uT=Rn.create,lT=Dn.create,dT=An.create,pT=Ur.create,fT=Mr.create,mT=Cn.create,hT=Yt.create,gT=zt.create,vT=Zn.create,yT=Qt.create,s$=tt.create,_T=tt.strictCreate,$T=qr.create,bT=Ts.create,xT=Lr.create,wT=Ct.create,kT=Os.create,ST=Un.create,zT=Mn.create,IT=Ns.create,jT=Fr.create,PT=Vr.create,TT=Jr.create,ET=Br.create,OT=vr.create,NT=_t.create,RT=yt.create,DT=Zt.create,AT=_t.createWithPreprocess,CT=yo.create;var $f=Object.freeze({status:"aborted"});function m(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let f=l[d];f in s||(s[f]=u[f].bind(s))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(s){var c;let u=r?.Parent?new o:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var It=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},yr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},_o={};function Se(e){return e&&Object.assign(_o,e),_o}var x={};Pn(x,{BIGINT_FORMAT_RANGES:()=>Fs,Class:()=>Ds,NUMBER_FORMAT_RANGES:()=>Ls,aborted:()=>nr,allowsEval:()=>Zs,assert:()=>m$,assertEqual:()=>l$,assertIs:()=>p$,assertNever:()=>f$,assertNotEqual:()=>d$,assignProp:()=>tr,base64ToUint8Array:()=>jf,base64urlToUint8Array:()=>S$,cached:()=>Xr,captureStackTrace:()=>bo,cleanEnum:()=>k$,cleanRegex:()=>Vn,clone:()=>qe,cloneDef:()=>g$,createTransparentProxy:()=>x$,defineLazy:()=>J,esc:()=>$o,escapeRegex:()=>ut,extend:()=>kf,finalizeIssue:()=>He,floatSafeRemainder:()=>As,getElementAtPath:()=>v$,getEnumValues:()=>Fn,getLengthableOrigin:()=>Kn,getParsedType:()=>b$,getSizableOrigin:()=>Bn,hexToUint8Array:()=>I$,isObject:()=>_r,isPlainObject:()=>rr,issue:()=>Yr,joinValues:()=>Z,jsonStringifyReplacer:()=>Gr,merge:()=>w$,mergeDefs:()=>Ut,normalizeParams:()=>z,nullish:()=>er,numKeys:()=>$$,objectClone:()=>h$,omit:()=>wf,optionalKeys:()=>qs,parsedType:()=>q,partial:()=>zf,pick:()=>xf,prefixIssues:()=>rt,primitiveTypes:()=>Ms,promiseAllObject:()=>y$,propertyKeyTypes:()=>Jn,randomString:()=>_$,required:()=>If,safeExtend:()=>Sf,shallowClone:()=>Us,slugify:()=>Cs,stringifyPrimitive:()=>U,uint8ArrayToBase64:()=>Pf,uint8ArrayToBase64url:()=>z$,uint8ArrayToHex:()=>j$,unwrapMessage:()=>Ln});function l$(e){return e}function d$(e){return e}function p$(e){}function f$(e){throw new Error("Unexpected value in exhaustive check")}function m$(e){}function Fn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function Z(e,t="|"){return e.map(r=>U(r)).join(t)}function Gr(e,t){return typeof t=="bigint"?t.toString():t}function Xr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function er(e){return e==null}function Vn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function As(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(i=Number.parseInt(c[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return a%s/10**o}var bf=Symbol("evaluating");function J(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==bf)return n===void 0&&(n=bf,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function h$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function tr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ut(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function g$(e){return Ut(e._zod.def)}function v$(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function y$(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function _$(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function $o(e){return JSON.stringify(e)}function Cs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var bo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Zs=Xr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function rr(e){if(_r(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(_r(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Us(e){return rr(e)?{...e}:Array.isArray(e)?[...e]:e}function $$(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var b$=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Jn=new Set(["string","number","symbol"]),Ms=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ut(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qe(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function x$(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function U(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function qs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ls={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Fs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Ut(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return tr(this,"shape",a),a},checks:[]});return qe(e,o)}function wf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Ut(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return tr(this,"shape",a),a},checks:[]});return qe(e,o)}function kf(e,t){if(!rr(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Ut(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return tr(this,"shape",o),o}});return qe(e,i)}function Sf(e,t){if(!rr(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ut(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return tr(this,"shape",n),n}});return qe(e,r)}function w$(e,t){let r=Ut(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return tr(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return qe(e,r)}function zf(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Ut(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return tr(this,"shape",c),c},checks:[]});return qe(t,a)}function If(e,t,r){let n=Ut(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return tr(this,"shape",o),o}});return qe(t,n)}function nr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function rt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ln(e){return typeof e=="string"?e:e?.message}function He(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=Ln(e.inst?._zod.def?.error?.(e))??Ln(t?.error?.(e))??Ln(r.customError?.(e))??Ln(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Bn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Kn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function q(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Yr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function k$(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function jf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Pf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function S$(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return jf(t+r)}function z$(e){return Pf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function I$(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function j$(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ds=class{constructor(...t){}};var Tf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Gr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xo=m("$ZodError",Tf),Hn=m("$ZodError",Tf,{Parent:Error});function wo(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function ko(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,s=0;for(;s<o.path.length;){let c=o.path[s];s===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Wn=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new It;if(a.issues.length){let s=new(i?.Err??e)(a.issues.map(c=>He(c,o,Se())));throw bo(s,i?.callee),s}return a.value},Gn=Wn(Hn),Xn=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(i?.Err??e)(a.issues.map(c=>He(c,o,Se())));throw bo(s,i?.callee),s}return a.value},Yn=Xn(Hn),Qn=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new It;return o.issues.length?{success:!1,error:new(e??xo)(o.issues.map(a=>He(a,i,Se())))}:{success:!0,data:o.value}},Qr=Qn(Hn),ei=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>He(a,i,Se())))}:{success:!0,data:o.value}},ti=ei(Hn),Ef=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Wn(e)(t,r,i)};var Of=e=>(t,r,n)=>Wn(e)(t,r,n);var Nf=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,i)};var Rf=e=>async(t,r,n)=>Xn(e)(t,r,n);var Df=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qn(e)(t,r,i)};var Af=e=>(t,r,n)=>Qn(e)(t,r,n);var Cf=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ei(e)(t,r,i)};var Zf=e=>async(t,r,n)=>ei(e)(t,r,n);var lt={};Pn(lt,{base64:()=>oc,base64url:()=>So,bigint:()=>dc,boolean:()=>fc,browserEmail:()=>C$,cidrv4:()=>nc,cidrv6:()=>ic,cuid:()=>Vs,cuid2:()=>Js,date:()=>sc,datetime:()=>uc,domain:()=>M$,duration:()=>Gs,e164:()=>ac,email:()=>Ys,emoji:()=>Qs,extendedDuration:()=>T$,guid:()=>Xs,hex:()=>q$,hostname:()=>U$,html5Email:()=>R$,idnEmail:()=>A$,integer:()=>pc,ipv4:()=>ec,ipv6:()=>tc,ksuid:()=>Hs,lowercase:()=>gc,mac:()=>rc,md5_base64:()=>F$,md5_base64url:()=>V$,md5_hex:()=>L$,nanoid:()=>Ws,null:()=>mc,number:()=>zo,rfc5322Email:()=>D$,sha1_base64:()=>B$,sha1_base64url:()=>K$,sha1_hex:()=>J$,sha256_base64:()=>W$,sha256_base64url:()=>G$,sha256_hex:()=>H$,sha384_base64:()=>Y$,sha384_base64url:()=>Q$,sha384_hex:()=>X$,sha512_base64:()=>tb,sha512_base64url:()=>rb,sha512_hex:()=>eb,string:()=>lc,time:()=>cc,ulid:()=>Bs,undefined:()=>hc,unicodeEmail:()=>Uf,uppercase:()=>vc,uuid:()=>$r,uuid4:()=>E$,uuid6:()=>O$,uuid7:()=>N$,xid:()=>Ks});var Vs=/^[cC][^\s-]{8,}$/,Js=/^[0-9a-z]+$/,Bs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ks=/^[0-9a-vA-V]{20}$/,Hs=/^[A-Za-z0-9]{27}$/,Ws=/^[a-zA-Z0-9_-]{21}$/,Gs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,T$=/^[-+]?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)?)??$/,Xs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$r=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,E$=$r(4),O$=$r(6),N$=$r(7),Ys=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,R$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,D$=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Uf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,A$=Uf,C$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Z$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Qs(){return new RegExp(Z$,"u")}var ec=/^(?:(?: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])$/,tc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,rc=e=>{let t=ut(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},nc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ic=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,oc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,So=/^[A-Za-z0-9_-]*$/,U$=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,M$=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,ac=/^\+[1-9]\d{6,14}$/,Mf="(?:(?:\\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])))",sc=new RegExp(`^${Mf}$`);function qf(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cc(e){return new RegExp(`^${qf(e)}$`)}function uc(e){let t=qf({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Mf}T(?:${n})$`)}var lc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},dc=/^-?\d+n?$/,pc=/^-?\d+$/,zo=/^-?\d+(?:\.\d+)?$/,fc=/^(?:true|false)$/i,mc=/^null$/i;var hc=/^undefined$/i;var gc=/^[^A-Z]*$/,vc=/^[^a-z]*$/,q$=/^[0-9a-fA-F]*$/;function ri(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function ni(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var L$=/^[0-9a-fA-F]{32}$/,F$=ri(22,"=="),V$=ni(22),J$=/^[0-9a-fA-F]{40}$/,B$=ri(27,"="),K$=ni(27),H$=/^[0-9a-fA-F]{64}$/,W$=ri(43,"="),G$=ni(43),X$=/^[0-9a-fA-F]{96}$/,Y$=ri(64,""),Q$=ni(64),eb=/^[0-9a-fA-F]{128}$/,tb=ri(86,"=="),rb=ni(86);var de=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ff={number:"number",bigint:"bigint",object:"date"},yc=m("$ZodCheckLessThan",(e,t)=>{de.init(e,t);let r=Ff[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_c=m("$ZodCheckGreaterThan",(e,t)=>{de.init(e,t);let r=Ff[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vf=m("$ZodCheckMultipleOf",(e,t)=>{de.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):As(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Jf=m("$ZodCheckNumberFormat",(e,t)=>{de.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Ls[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=i,s.maximum=o,r&&(s.pattern=pc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Bf=m("$ZodCheckBigIntFormat",(e,t)=>{de.init(e,t);let[r,n]=Fs[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Kf=m("$ZodCheckMaxSize",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!er(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:Bn(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Hf=m("$ZodCheckMinSize",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!er(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:Bn(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Wf=m("$ZodCheckSizeEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!er(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:Bn(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Gf=m("$ZodCheckMaxLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!er(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let a=Kn(i);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Xf=m("$ZodCheckMinLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!er(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let a=Kn(i);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Yf=m("$ZodCheckLengthEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!er(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let a=Kn(i),s=o>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ii=m("$ZodCheckStringFormat",(e,t)=>{var r,n;de.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Qf=m("$ZodCheckRegex",(e,t)=>{ii.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),em=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=gc),ii.init(e,t)}),tm=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vc),ii.init(e,t)}),rm=m("$ZodCheckIncludes",(e,t)=>{de.init(e,t);let r=ut(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),nm=m("$ZodCheckStartsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`^${ut(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),im=m("$ZodCheckEndsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`.*${ut(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Lf(e,t,r){e.issues.length&&t.issues.push(...rt(r,e.issues))}var om=m("$ZodCheckProperty",(e,t)=>{de.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>Lf(i,r,t.property));Lf(n,r,t.property)}}),am=m("$ZodCheckMimeType",(e,t)=>{de.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),sm=m("$ZodCheckOverwrite",(e,t)=>{de.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Io=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
11
+ `).filter(a=>a),i=Math.min(...n.map(a=>a.length-a.trimStart().length)),o=n.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...r,i.join(`
12
+ `))}};var um={major:4,minor:3,patch:6};var F=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=um;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,s,c)=>{let u=nr(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new It;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=nr(a,f)))});else{if(a.issues.length===f)continue;u||(u=nr(a,f))}}return l?l.then(()=>a):a},o=(a,s,c)=>{if(nr(a))return a.aborted=!0,a;let u=i(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new It;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>o(l,a,s)):o(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new It;return c.then(u=>i(u,n,s))}return i(c,n,s)}}J(e,"~standard",()=>({validate:i=>{try{let o=Qr(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return ti(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),br=m("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ce=m("$ZodStringFormat",(e,t)=>{ii.init(e,t),br.init(e,t)}),bc=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Xs),ce.init(e,t)}),xc=m("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$r(n))}else t.pattern??(t.pattern=$r());ce.init(e,t)}),wc=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ys),ce.init(e,t)}),kc=m("$ZodURL",(e,t)=>{ce.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Sc=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Qs()),ce.init(e,t)}),zc=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ws),ce.init(e,t)}),Ic=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Vs),ce.init(e,t)}),jc=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Js),ce.init(e,t)}),Pc=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Bs),ce.init(e,t)}),Tc=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ks),ce.init(e,t)}),Ec=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Hs),ce.init(e,t)}),Oc=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=uc(t)),ce.init(e,t)}),Nc=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sc),ce.init(e,t)}),Rc=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=cc(t)),ce.init(e,t)}),Dc=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Gs),ce.init(e,t)}),Ac=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ec),ce.init(e,t),e._zod.bag.format="ipv4"}),Cc=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=tc),ce.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Zc=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=rc(t.delimiter)),ce.init(e,t),e._zod.bag.format="mac"}),Uc=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nc),ce.init(e,t)}),Mc=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ic),ce.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function bm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var qc=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=oc),ce.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{bm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function nb(e){if(!So.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return bm(r)}var Lc=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=So),ce.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{nb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Fc=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ac),ce.init(e,t)});function ib(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var Vc=m("$ZodJWT",(e,t)=>{ce.init(e,t),e._zod.check=r=>{ib(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Jc=m("$ZodCustomStringFormat",(e,t)=>{ce.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),No=m("$ZodNumber",(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??zo,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),Bc=m("$ZodNumberFormat",(e,t)=>{Jf.init(e,t),No.init(e,t)}),oi=m("$ZodBoolean",(e,t)=>{F.init(e,t),e._zod.pattern=fc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Ro=m("$ZodBigInt",(e,t)=>{F.init(e,t),e._zod.pattern=dc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Kc=m("$ZodBigIntFormat",(e,t)=>{Bf.init(e,t),Ro.init(e,t)}),Hc=m("$ZodSymbol",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),Wc=m("$ZodUndefined",(e,t)=>{F.init(e,t),e._zod.pattern=hc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),Gc=m("$ZodNull",(e,t)=>{F.init(e,t),e._zod.pattern=mc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),Xc=m("$ZodAny",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Yc=m("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=r=>r}),Qc=m("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),eu=m("$ZodVoid",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),tu=m("$ZodDate",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function lm(e,t,r){e.issues.length&&t.issues.push(...rt(r,e.issues)),t.value[r]=e.value}var ru=m("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let s=i[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?o.push(c.then(u=>lm(u,r,a))):lm(c,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function Oo(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...rt(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function xm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=qs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function wm(e,t,r,n,i,o){let a=[],s=i.keySet,c=i.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let f=c.run({value:t[d],issues:[]},n);f instanceof Promise?e.push(f.then(p=>Oo(p,r,d,t,l))):Oo(f,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var km=m("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Xr(()=>xm(t));J(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let i=_r,o=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!i(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let f of a.keys){let p=d[f],h=p._zod.optout==="optional",g=p._zod.run({value:u[f],issues:[]},c);g instanceof Promise?l.push(g.then(_=>Oo(_,s,f,u,h))):Oo(g,s,f,u,h)}return o?wm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Sm=m("$ZodObjectJIT",(e,t)=>{km.init(e,t);let r=e._zod.parse,n=Xr(()=>xm(t)),i=f=>{let p=new Io(["shape","payload","ctx"]),h=n.value,g=I=>{let A=$o(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),k=0;for(let I of h.keys)_[I]=`key_${k++}`;p.write("const newResult = {};");for(let I of h.keys){let A=_[I],O=$o(I),Qe=f[I]?._zod?.optout==="optional";p.write(`const ${A} = ${g(I)};`),Qe?p.write(`
13
+ if (${A}.issues.length) {
14
+ if (${O} in input) {
15
+ payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
16
+ ...iss,
17
+ path: iss.path ? [${O}, ...iss.path] : [${O}]
18
+ })));
19
+ }
20
+ }
21
+
22
+ if (${A}.value === undefined) {
23
+ if (${O} in input) {
24
+ newResult[${O}] = undefined;
25
+ }
26
+ } else {
27
+ newResult[${O}] = ${A}.value;
28
+ }
29
+
30
+ `):p.write(`
31
+ if (${A}.issues.length) {
32
+ payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
33
+ ...iss,
34
+ path: iss.path ? [${O}, ...iss.path] : [${O}]
35
+ })));
36
+ }
37
+
38
+ if (${A}.value === undefined) {
39
+ if (${O} in input) {
40
+ newResult[${O}] = undefined;
41
+ }
42
+ } else {
43
+ newResult[${O}] = ${A}.value;
44
+ }
45
+
46
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");let E=p.compile();return(I,A)=>E(f,I,A)},o,a=_r,s=!_o.jitless,u=s&&Zs.value,l=t.catchall,d;e._zod.parse=(f,p)=>{d??(d=n.value);let h=f.value;return a(h)?s&&u&&p?.async===!1&&p.jitless!==!0?(o||(o=i(t.shape)),f=o(f,p),l?wm([],h,f,p,d,e):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function dm(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!nr(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>He(a,n,Se())))}),t)}var ai=m("$ZodUnion",(e,t)=>{F.init(e,t),J(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),J(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),J(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),J(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Vn(o.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:i.value,issues:[]},o);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>dm(c,i,e,o)):dm(s,i,e,o)}});function pm(e,t,r,n){let i=e.filter(o=>o.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>He(a,n,Se())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var nu=m("$ZodXor",(e,t)=>{ai.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:i.value,issues:[]},o);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>pm(c,i,e,o)):pm(s,i,e,o)}}),iu=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ai.init(e,t);let r=e._zod.parse;J(e._zod,"propValues",()=>{let i={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[s,c]of Object.entries(a)){i[s]||(i[s]=new Set);for(let u of c)i[s].add(u)}}return i});let n=Xr(()=>{let i=t.options,o=new Map;for(let a of i){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,a)}}return o});e._zod.parse=(i,o)=>{let a=i.value;if(!_r(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),ou=m("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,o=t.left._zod.run({value:i,issues:[]},n),a=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([c,u])=>fm(r,c,u)):fm(r,o,a)}});function $c(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(rr(e)&&rr(t)){let r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),i={...e,...t};for(let o of n){let a=$c(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=t[n],a=$c(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function fm(e,t,r){let n=new Map,i;for(let s of t.issues)if(s.code==="unrecognized_keys"){i??(i=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let o=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(o.length&&i&&e.issues.push({...i,keys:o}),nr(e))return e;let a=$c(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Do=m("$ZodTuple",(e,t)=>{F.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=o.length>r.length,d=o.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:o,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=o.length&&u>=c)continue;let d=l._zod.run({value:o[u],issues:[]},i);d instanceof Promise?a.push(d.then(f=>jo(f,n,u))):jo(d,n,u)}if(t.rest){let l=o.slice(r.length);for(let d of l){u++;let f=t.rest._zod.run({value:d,issues:[]},i);f instanceof Promise?a.push(f.then(p=>jo(p,n,u))):jo(f,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function jo(e,t,r){e.issues.length&&t.issues.push(...rt(r,e.issues)),t.value[r]=e.value}var au=m("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!rr(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let o=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:i[u],issues:[]},n);l instanceof Promise?o.push(l.then(d=>{d.issues.length&&r.issues.push(...rt(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...rt(u,l.issues)),r.value[u]=l.value)}let c;for(let u in i)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&zo.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=i[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>He(d,n,Se())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},n);l instanceof Promise?o.push(l.then(d=>{d.issues.length&&r.issues.push(...rt(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...rt(s,l.issues)),r.value[c.value]=l.value)}}return o.length?Promise.all(o).then(()=>r):r}}),su=m("$ZodMap",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let o=[];r.value=new Map;for(let[a,s]of i){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?o.push(Promise.all([c,u]).then(([l,d])=>{mm(l,d,r,a,i,e,n)})):mm(c,u,r,a,i,e,n)}return o.length?Promise.all(o).then(()=>r):r}});function mm(e,t,r,n,i,o,a){e.issues.length&&(Jn.has(typeof n)?r.issues.push(...rt(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(s=>He(s,a,Se()))})),t.issues.length&&(Jn.has(typeof n)?r.issues.push(...rt(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:t.issues.map(s=>He(s,a,Se()))})),r.value.set(e.value,t.value)}var cu=m("$ZodSet",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let a of i){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?o.push(s.then(c=>hm(c,r))):hm(s,r)}return o.length?Promise.all(o).then(()=>r):r}});function hm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var uu=m("$ZodEnum",(e,t)=>{F.init(e,t);let r=Fn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>Jn.has(typeof i)).map(i=>typeof i=="string"?ut(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:r,input:a,inst:e}),i}}),lu=m("$ZodLiteral",(e,t)=>{if(F.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ut(n):n?ut(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),du=m("$ZodFile",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),r}}),pu=m("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new yr(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(r.value=a,r));if(i instanceof Promise)throw new It;return r.value=i,r}});function gm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ao=m("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),J(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Vn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>gm(o,r.value)):gm(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),fu=m("$ZodExactOptional",(e,t)=>{Ao.init(e,t),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),mu=m("$ZodNullable",(e,t)=>{F.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Vn(r.source)}|null)$`):void 0}),J(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),hu=m("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>vm(o,t)):vm(i,t)}});function vm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var gu=m("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),vu=m("$ZodNonOptional",(e,t)=>{F.init(e,t),J(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>ym(o,e)):ym(i,e)}});function ym(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var yu=m("$ZodSuccess",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new yr("ZodSuccess");let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),_u=m("$ZodCatch",(e,t)=>{F.init(e,t),J(e._zod,"optin",()=>t.innerType._zod.optin),J(e._zod,"optout",()=>t.innerType._zod.optout),J(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(a=>He(a,n,Se()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>He(o,n,Se()))},input:r.value}),r.issues=[]),r)}}),$u=m("$ZodNaN",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),bu=m("$ZodPipe",(e,t)=>{F.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>Po(a,t.in,n)):Po(o,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(o=>Po(o,t.out,n)):Po(i,t.out,n)}});function Po(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var si=m("$ZodCodec",(e,t)=>{F.init(e,t),J(e._zod,"values",()=>t.in._zod.values),J(e._zod,"optin",()=>t.in._zod.optin),J(e._zod,"optout",()=>t.out._zod.optout),J(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>To(a,t,n)):To(o,t,n)}else{let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>To(a,t,n)):To(o,t,n)}}});function To(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let i=t.transform(e.value,e);return i instanceof Promise?i.then(o=>Eo(e,o,t.out,r)):Eo(e,i,t.out,r)}else{let i=t.reverseTransform(e.value,e);return i instanceof Promise?i.then(o=>Eo(e,o,t.in,r)):Eo(e,i,t.in,r)}}function Eo(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var xu=m("$ZodReadonly",(e,t)=>{F.init(e,t),J(e._zod,"propValues",()=>t.innerType._zod.propValues),J(e._zod,"values",()=>t.innerType._zod.values),J(e._zod,"optin",()=>t.innerType?._zod?.optin),J(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(_m):_m(i)}});function _m(e){return e.value=Object.freeze(e.value),e}var wu=m("$ZodTemplateLiteral",(e,t)=>{F.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let o=i.startsWith("^")?1:0,a=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(o,a))}else if(n===null||Ms.has(typeof n))r.push(ut(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),ku=m("$ZodFunction",(e,t)=>(F.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let i=e._def.input?Gn(e._def.input,n):n,o=Reflect.apply(r,this,i);return e._def.output?Gn(e._def.output,o):o}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=e._def.input?await Yn(e._def.input,n):n,o=await Reflect.apply(r,this,i);return e._def.output?await Yn(e._def.output,o):o}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Do({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Su=m("$ZodPromise",(e,t)=>{F.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>t.innerType._zod.run({value:i,issues:[]},n))}),zu=m("$ZodLazy",(e,t)=>{F.init(e,t),J(e._zod,"innerType",()=>t.getter()),J(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),J(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),J(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),J(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Iu=m("$ZodCustom",(e,t)=>{de.init(e,t),F.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>$m(o,r,n,e));$m(i,r,n,e)}});function $m(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(Yr(i))}}var ab=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=q(i.input),s=n[a]??a;return`Invalid input: expected ${o}, received ${s}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${U(i.values[0])}`:`Invalid option: expected one of ${Z(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${o}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${o}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Z(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function ju(){return{localeError:ab()}}var zm;var Tu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Eu(){return new Tu}(zm=globalThis).__zod_globalRegistry??(zm.__zod_globalRegistry=Eu());var Le=globalThis.__zod_globalRegistry;function Ou(e,t){return new e({type:"string",...z(t)})}function Co(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function ci(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function Zo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function Uo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function Mo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function qo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function ui(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Lo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function Fo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function Vo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function Jo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function Bo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function Ko(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function Ho(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function Wo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function Go(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function Nu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...z(t)})}function Xo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function Yo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function Qo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function ea(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function ta(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function ra(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}function Ru(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function Du(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}function Au(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function Cu(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}function Zu(e,t){return new e({type:"number",checks:[],...z(t)})}function Uu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function Mu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...z(t)})}function qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...z(t)})}function Lu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...z(t)})}function Fu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...z(t)})}function Vu(e,t){return new e({type:"boolean",...z(t)})}function Ju(e,t){return new e({type:"bigint",...z(t)})}function Bu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...z(t)})}function Ku(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...z(t)})}function Hu(e,t){return new e({type:"symbol",...z(t)})}function Wu(e,t){return new e({type:"undefined",...z(t)})}function Gu(e,t){return new e({type:"null",...z(t)})}function Xu(e){return new e({type:"any"})}function Yu(e){return new e({type:"unknown"})}function Qu(e,t){return new e({type:"never",...z(t)})}function el(e,t){return new e({type:"void",...z(t)})}function tl(e,t){return new e({type:"date",...z(t)})}function rl(e,t){return new e({type:"nan",...z(t)})}function Mt(e,t){return new yc({check:"less_than",...z(t),value:e,inclusive:!1})}function nt(e,t){return new yc({check:"less_than",...z(t),value:e,inclusive:!0})}function qt(e,t){return new _c({check:"greater_than",...z(t),value:e,inclusive:!1})}function Fe(e,t){return new _c({check:"greater_than",...z(t),value:e,inclusive:!0})}function nl(e){return qt(0,e)}function il(e){return Mt(0,e)}function ol(e){return nt(0,e)}function al(e){return Fe(0,e)}function xr(e,t){return new Vf({check:"multiple_of",...z(t),value:e})}function wr(e,t){return new Kf({check:"max_size",...z(t),maximum:e})}function Lt(e,t){return new Hf({check:"min_size",...z(t),minimum:e})}function en(e,t){return new Wf({check:"size_equals",...z(t),size:e})}function tn(e,t){return new Gf({check:"max_length",...z(t),maximum:e})}function ir(e,t){return new Xf({check:"min_length",...z(t),minimum:e})}function rn(e,t){return new Yf({check:"length_equals",...z(t),length:e})}function li(e,t){return new Qf({check:"string_format",format:"regex",...z(t),pattern:e})}function di(e){return new em({check:"string_format",format:"lowercase",...z(e)})}function pi(e){return new tm({check:"string_format",format:"uppercase",...z(e)})}function fi(e,t){return new rm({check:"string_format",format:"includes",...z(t),includes:e})}function mi(e,t){return new nm({check:"string_format",format:"starts_with",...z(t),prefix:e})}function hi(e,t){return new im({check:"string_format",format:"ends_with",...z(t),suffix:e})}function sl(e,t,r){return new om({check:"property",property:e,schema:t,...z(r)})}function gi(e,t){return new am({check:"mime_type",mime:e,...z(t)})}function jt(e){return new sm({check:"overwrite",tx:e})}function vi(e){return jt(t=>t.normalize(e))}function yi(){return jt(e=>e.trim())}function _i(){return jt(e=>e.toLowerCase())}function $i(){return jt(e=>e.toUpperCase())}function na(){return jt(e=>Cs(e))}function Im(e,t,r){return new e({type:"array",element:t,...z(r)})}function cl(e,t){return new e({type:"file",...z(t)})}function ul(e,t,r){let n=z(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function ll(e,t,r){return new e({type:"custom",check:"custom",fn:t,...z(r)})}function dl(e){let t=lb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Yr(n,r.value,t._zod.def));else{let i=n;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=!t._zod.def.abort),r.issues.push(Yr(i))}},e(r.value,r)));return t}function lb(e,t){let r=new de({check:"custom",...z(t)});return r._zod.check=e,r}function pl(e){let t=new de({check:"describe"});return t._zod.onattach=[r=>{let n=Le.get(r)??{};Le.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function fl(e){let t=new de({check:"meta"});return t._zod.onattach=[r=>{let n=Le.get(r)??{};Le.add(r,{...n,...e})}],t._zod.check=()=>{},t}function ml(e,t){let r=z(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),i=i.map(p=>typeof p=="string"?p.toLowerCase():p));let o=new Set(n),a=new Set(i),s=e.Codec??si,c=e.Boolean??oi,u=e.String??br,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:l,out:d,transform:((p,h)=>{let g=p;return r.case!=="sensitive"&&(g=g.toLowerCase()),o.has(g)?!0:a.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:h.value,inst:f,continue:!1}),{})}),reverseTransform:((p,h)=>p===!0?n[0]||"true":i[0]||"false"),error:r.error});return f}function nn(e,t,r,n={}){let i=z(n),o={...z(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...i};return r instanceof RegExp&&(o.pattern=r),new e(o)}function ia(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Le,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function he(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let f=a.schema,p=t.processors[i.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);p(e,t,f,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),he(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Ve(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function oa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let i=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,f=e.external.uri??(h=>h);if(d)return{ref:f(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${f("__shared")}#/${s}/${p}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},o=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=i(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
47
+
48
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){o(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&e.reused==="ref"){o(a);continue}}}function aa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let f=e.seen.get(l),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(p.$ref&&f.def)for(let g in c)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(c[g])===JSON.stringify(f.def[g])&&delete c[g]}let d=a._zod.parent;if(d&&d!==l){n(d);let f=e.seen.get(d);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(let p in c)p==="$ref"||p==="allOf"||p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(o[s.defId]=s.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:bi(t,"input",e.processors),output:bi(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ve(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ve(n.element,r);if(n.type==="set")return Ve(n.valueType,r);if(n.type==="lazy")return Ve(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ve(n.innerType,r);if(n.type==="intersection")return Ve(n.left,r)||Ve(n.right,r);if(n.type==="record"||n.type==="map")return Ve(n.keyType,r)||Ve(n.valueType,r);if(n.type==="pipe")return Ve(n.in,r)||Ve(n.out,r);if(n.type==="object"){for(let i in n.shape)if(Ve(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(Ve(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(Ve(i,r))return!0;return!!(n.rest&&Ve(n.rest,r))}return!1}var jm=(e,t={})=>r=>{let n=ia({...r,processors:t});return he(e,n),oa(n,e),aa(n,e)},bi=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},a=ia({...i??{},target:o,io:t,processors:r});return he(e,a),oa(a,e),aa(a,e)};var db={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Pm=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),s&&(i.format=db[s]??s,i.format===""&&delete i.format,s==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?i.pattern=l[0].source:l.length>1&&(i.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Tm=(e,t,r,n)=>{let i=r,{minimum:o,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l),typeof o=="number"&&(i.minimum=o,typeof l=="number"&&t.target!=="draft-04"&&(l>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof a=="number"&&(i.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},Em=(e,t,r,n)=>{r.type="boolean"},Om=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Nm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Rm=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Dm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Am=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Cm=(e,t,r,n)=>{r.not={}},Zm=(e,t,r,n)=>{},Um=(e,t,r,n)=>{},Mm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},qm=(e,t,r,n)=>{let i=e._zod.def,o=Fn(i.entries);o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),r.enum=o},Lm=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let a of i.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),o.every(a=>typeof a=="boolean")&&(r.type="boolean"),o.every(a=>a===null)&&(r.type="null"),r.enum=o},Fm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Vm=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},Jm=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(o.minLength=a),s!==void 0&&(o.maxLength=s),c?c.length===1?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(i,o)},Bm=(e,t,r,n)=>{r.type="boolean"},Km=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Hm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Wm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Gm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Xm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Ym=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(i.minItems=a),typeof s=="number"&&(i.maxItems=s),i.type="array",i.items=he(o.element,t,{...n,path:[...n.path,"items"]})},Qm=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let a=o.shape;for(let u in a)i.properties[u]=he(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=o.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=he(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},hl=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,a=i.options.map((s,c)=>he(s,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=a:r.anyOf=a},eh=(e,t,r,n)=>{let i=e._zod.def,o=he(i.left,t,{...n,path:[...n.path,"allOf",0]}),a=he(i.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];r.allOf=c},th=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((f,p)=>he(f,t,{...n,path:[...n.path,a,p]})),u=o.rest?he(o.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=c,u&&(i.items=u)):t.target==="openapi-3.0"?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(i.minItems=l),typeof d=="number"&&(i.maxItems=d)},rh=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let a=o.keyType,c=a._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let l=he(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=he(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=he(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(i.required=l)}},nh=(e,t,r,n)=>{let i=e._zod.def,o=he(i.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},ih=(e,t,r,n)=>{let i=e._zod.def;he(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},oh=(e,t,r,n)=>{let i=e._zod.def;he(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},ah=(e,t,r,n)=>{let i=e._zod.def;he(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},sh=(e,t,r,n)=>{let i=e._zod.def;he(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},ch=(e,t,r,n)=>{let i=e._zod.def,o=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;he(o,t,n);let a=t.seen.get(e);a.ref=o},uh=(e,t,r,n)=>{let i=e._zod.def;he(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},lh=(e,t,r,n)=>{let i=e._zod.def;he(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},gl=(e,t,r,n)=>{let i=e._zod.def;he(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},dh=(e,t,r,n)=>{let i=e._zod.innerType;he(i,t,n);let o=t.seen.get(e);o.ref=i};function on(e){return!!e._zod}function or(e,t){return on(e)?Qr(e,t):e.safeParse(t)}function sa(e){if(!e)return;let t;if(on(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function hh(e){if(on(e)){let o=e._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=e._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=e.value;if(n!==void 0)return n}var xi={};Pn(xi,{ZodAny:()=>Nh,ZodArray:()=>Ch,ZodBase64:()=>Ml,ZodBase64URL:()=>ql,ZodBigInt:()=>ga,ZodBigIntFormat:()=>Vl,ZodBoolean:()=>ha,ZodCIDRv4:()=>Zl,ZodCIDRv6:()=>Ul,ZodCUID:()=>El,ZodCUID2:()=>Ol,ZodCatch:()=>ng,ZodCodec:()=>Xl,ZodCustom:()=>ba,ZodCustomStringFormat:()=>ki,ZodDate:()=>Bl,ZodDefault:()=>Xh,ZodDiscriminatedUnion:()=>Uh,ZodE164:()=>Ll,ZodEmail:()=>jl,ZodEmoji:()=>Pl,ZodEnum:()=>wi,ZodExactOptional:()=>Hh,ZodFile:()=>Bh,ZodFunction:()=>pg,ZodGUID:()=>ua,ZodIPv4:()=>Al,ZodIPv6:()=>Cl,ZodIntersection:()=>Mh,ZodJWT:()=>Fl,ZodKSUID:()=>Dl,ZodLazy:()=>ug,ZodLiteral:()=>Jh,ZodMAC:()=>Ph,ZodMap:()=>Fh,ZodNaN:()=>og,ZodNanoID:()=>Tl,ZodNever:()=>Dh,ZodNonOptional:()=>Wl,ZodNull:()=>Oh,ZodNullable:()=>Gh,ZodNumber:()=>ma,ZodNumberFormat:()=>an,ZodObject:()=>va,ZodOptional:()=>Hl,ZodPipe:()=>Gl,ZodPrefault:()=>Qh,ZodPromise:()=>dg,ZodReadonly:()=>ag,ZodRecord:()=>$a,ZodSet:()=>Vh,ZodString:()=>pa,ZodStringFormat:()=>pe,ZodSuccess:()=>rg,ZodSymbol:()=>Th,ZodTemplateLiteral:()=>cg,ZodTransform:()=>Kh,ZodTuple:()=>qh,ZodType:()=>B,ZodULID:()=>Nl,ZodURL:()=>fa,ZodUUID:()=>Ft,ZodUndefined:()=>Eh,ZodUnion:()=>ya,ZodUnknown:()=>Rh,ZodVoid:()=>Ah,ZodXID:()=>Rl,ZodXor:()=>Zh,_ZodString:()=>Il,_default:()=>Yh,_function:()=>Px,any:()=>dx,array:()=>Q,base64:()=>Hb,base64url:()=>Wb,bigint:()=>ax,boolean:()=>be,catch:()=>ig,check:()=>Tx,cidrv4:()=>Bb,cidrv6:()=>Kb,codec:()=>zx,cuid:()=>Zb,cuid2:()=>Ub,custom:()=>Yl,date:()=>fx,describe:()=>Ex,discriminatedUnion:()=>_a,e164:()=>Gb,email:()=>jb,emoji:()=>Ab,enum:()=>Ae,exactOptional:()=>Wh,file:()=>xx,float32:()=>rx,float64:()=>nx,function:()=>Px,guid:()=>Pb,hash:()=>tx,hex:()=>ex,hostname:()=>Qb,httpUrl:()=>Db,instanceof:()=>Nx,int:()=>zl,int32:()=>ix,int64:()=>sx,intersection:()=>zi,ipv4:()=>Fb,ipv6:()=>Jb,json:()=>Dx,jwt:()=>Xb,keyof:()=>mx,ksuid:()=>Lb,lazy:()=>lg,literal:()=>R,looseObject:()=>De,looseRecord:()=>yx,mac:()=>Vb,map:()=>_x,meta:()=>Ox,nan:()=>Sx,nanoid:()=>Cb,nativeEnum:()=>bx,never:()=>Jl,nonoptional:()=>tg,null:()=>Si,nullable:()=>la,nullish:()=>wx,number:()=>se,object:()=>T,optional:()=>ve,partialRecord:()=>vx,pipe:()=>da,prefault:()=>eg,preprocess:()=>xa,promise:()=>jx,readonly:()=>sg,record:()=>ge,refine:()=>fg,set:()=>$x,strictObject:()=>hx,string:()=>y,stringFormat:()=>Yb,stringbool:()=>Rx,success:()=>kx,superRefine:()=>mg,symbol:()=>ux,templateLiteral:()=>Ix,transform:()=>Kl,tuple:()=>Lh,uint32:()=>ox,uint64:()=>cx,ulid:()=>Mb,undefined:()=>lx,union:()=>ue,unknown:()=>fe,url:()=>Rb,uuid:()=>Tb,uuidv4:()=>Eb,uuidv6:()=>Ob,uuidv7:()=>Nb,void:()=>px,xid:()=>qb,xor:()=>gx});var ca={};Pn(ca,{endsWith:()=>hi,gt:()=>qt,gte:()=>Fe,includes:()=>fi,length:()=>rn,lowercase:()=>di,lt:()=>Mt,lte:()=>nt,maxLength:()=>tn,maxSize:()=>wr,mime:()=>gi,minLength:()=>ir,minSize:()=>Lt,multipleOf:()=>xr,negative:()=>il,nonnegative:()=>al,nonpositive:()=>ol,normalize:()=>vi,overwrite:()=>jt,positive:()=>nl,property:()=>sl,regex:()=>li,size:()=>en,slugify:()=>na,startsWith:()=>mi,toLowerCase:()=>_i,toUpperCase:()=>$i,trim:()=>yi,uppercase:()=>pi});var kr={};Pn(kr,{ZodISODate:()=>$l,ZodISODateTime:()=>yl,ZodISODuration:()=>kl,ZodISOTime:()=>xl,date:()=>bl,datetime:()=>_l,duration:()=>Sl,time:()=>wl});var yl=m("ZodISODateTime",(e,t)=>{Oc.init(e,t),pe.init(e,t)});function _l(e){return Ru(yl,e)}var $l=m("ZodISODate",(e,t)=>{Nc.init(e,t),pe.init(e,t)});function bl(e){return Du($l,e)}var xl=m("ZodISOTime",(e,t)=>{Rc.init(e,t),pe.init(e,t)});function wl(e){return Au(xl,e)}var kl=m("ZodISODuration",(e,t)=>{Dc.init(e,t),pe.init(e,t)});function Sl(e){return Cu(kl,e)}var gh=(e,t)=>{xo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ko(e,r)},flatten:{value:r=>wo(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Gr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Gr,2)}},isEmpty:{get(){return e.issues.length===0}}})},UR=m("ZodError",gh),it=m("ZodError",gh,{Parent:Error});var vh=Wn(it),yh=Xn(it),_h=Qn(it),$h=ei(it),bh=Ef(it),xh=Of(it),wh=Nf(it),kh=Rf(it),Sh=Df(it),zh=Af(it),Ih=Cf(it),jh=Zf(it);var B=m("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:bi(e,"input"),output:bi(e,"output")}}),e.toJSONSchema=jm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(x.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>qe(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>vh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>_h(e,r,n),e.parseAsync=async(r,n)=>yh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>$h(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>bh(e,r,n),e.decode=(r,n)=>xh(e,r,n),e.encodeAsync=async(r,n)=>wh(e,r,n),e.decodeAsync=async(r,n)=>kh(e,r,n),e.safeEncode=(r,n)=>Sh(e,r,n),e.safeDecode=(r,n)=>zh(e,r,n),e.safeEncodeAsync=async(r,n)=>Ih(e,r,n),e.safeDecodeAsync=async(r,n)=>jh(e,r,n),e.refine=(r,n)=>e.check(fg(r,n)),e.superRefine=r=>e.check(mg(r)),e.overwrite=r=>e.check(jt(r)),e.optional=()=>ve(e),e.exactOptional=()=>Wh(e),e.nullable=()=>la(e),e.nullish=()=>ve(la(e)),e.nonoptional=r=>tg(e,r),e.array=()=>Q(e),e.or=r=>ue([e,r]),e.and=r=>zi(e,r),e.transform=r=>da(e,Kl(r)),e.default=r=>Yh(e,r),e.prefault=r=>eg(e,r),e.catch=r=>ig(e,r),e.pipe=r=>da(e,r),e.readonly=()=>sg(e),e.describe=r=>{let n=e.clone();return Le.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Le.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Le.get(e);let n=e.clone();return Le.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Il=m("_ZodString",(e,t)=>{br.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Pm(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(li(...n)),e.includes=(...n)=>e.check(fi(...n)),e.startsWith=(...n)=>e.check(mi(...n)),e.endsWith=(...n)=>e.check(hi(...n)),e.min=(...n)=>e.check(ir(...n)),e.max=(...n)=>e.check(tn(...n)),e.length=(...n)=>e.check(rn(...n)),e.nonempty=(...n)=>e.check(ir(1,...n)),e.lowercase=n=>e.check(di(n)),e.uppercase=n=>e.check(pi(n)),e.trim=()=>e.check(yi()),e.normalize=(...n)=>e.check(vi(...n)),e.toLowerCase=()=>e.check(_i()),e.toUpperCase=()=>e.check($i()),e.slugify=()=>e.check(na())}),pa=m("ZodString",(e,t)=>{br.init(e,t),Il.init(e,t),e.email=r=>e.check(Co(jl,r)),e.url=r=>e.check(ui(fa,r)),e.jwt=r=>e.check(ra(Fl,r)),e.emoji=r=>e.check(Lo(Pl,r)),e.guid=r=>e.check(ci(ua,r)),e.uuid=r=>e.check(Zo(Ft,r)),e.uuidv4=r=>e.check(Uo(Ft,r)),e.uuidv6=r=>e.check(Mo(Ft,r)),e.uuidv7=r=>e.check(qo(Ft,r)),e.nanoid=r=>e.check(Fo(Tl,r)),e.guid=r=>e.check(ci(ua,r)),e.cuid=r=>e.check(Vo(El,r)),e.cuid2=r=>e.check(Jo(Ol,r)),e.ulid=r=>e.check(Bo(Nl,r)),e.base64=r=>e.check(Qo(Ml,r)),e.base64url=r=>e.check(ea(ql,r)),e.xid=r=>e.check(Ko(Rl,r)),e.ksuid=r=>e.check(Ho(Dl,r)),e.ipv4=r=>e.check(Wo(Al,r)),e.ipv6=r=>e.check(Go(Cl,r)),e.cidrv4=r=>e.check(Xo(Zl,r)),e.cidrv6=r=>e.check(Yo(Ul,r)),e.e164=r=>e.check(ta(Ll,r)),e.datetime=r=>e.check(_l(r)),e.date=r=>e.check(bl(r)),e.time=r=>e.check(wl(r)),e.duration=r=>e.check(Sl(r))});function y(e){return Ou(pa,e)}var pe=m("ZodStringFormat",(e,t)=>{ce.init(e,t),Il.init(e,t)}),jl=m("ZodEmail",(e,t)=>{wc.init(e,t),pe.init(e,t)});function jb(e){return Co(jl,e)}var ua=m("ZodGUID",(e,t)=>{bc.init(e,t),pe.init(e,t)});function Pb(e){return ci(ua,e)}var Ft=m("ZodUUID",(e,t)=>{xc.init(e,t),pe.init(e,t)});function Tb(e){return Zo(Ft,e)}function Eb(e){return Uo(Ft,e)}function Ob(e){return Mo(Ft,e)}function Nb(e){return qo(Ft,e)}var fa=m("ZodURL",(e,t)=>{kc.init(e,t),pe.init(e,t)});function Rb(e){return ui(fa,e)}function Db(e){return ui(fa,{protocol:/^https?$/,hostname:lt.domain,...x.normalizeParams(e)})}var Pl=m("ZodEmoji",(e,t)=>{Sc.init(e,t),pe.init(e,t)});function Ab(e){return Lo(Pl,e)}var Tl=m("ZodNanoID",(e,t)=>{zc.init(e,t),pe.init(e,t)});function Cb(e){return Fo(Tl,e)}var El=m("ZodCUID",(e,t)=>{Ic.init(e,t),pe.init(e,t)});function Zb(e){return Vo(El,e)}var Ol=m("ZodCUID2",(e,t)=>{jc.init(e,t),pe.init(e,t)});function Ub(e){return Jo(Ol,e)}var Nl=m("ZodULID",(e,t)=>{Pc.init(e,t),pe.init(e,t)});function Mb(e){return Bo(Nl,e)}var Rl=m("ZodXID",(e,t)=>{Tc.init(e,t),pe.init(e,t)});function qb(e){return Ko(Rl,e)}var Dl=m("ZodKSUID",(e,t)=>{Ec.init(e,t),pe.init(e,t)});function Lb(e){return Ho(Dl,e)}var Al=m("ZodIPv4",(e,t)=>{Ac.init(e,t),pe.init(e,t)});function Fb(e){return Wo(Al,e)}var Ph=m("ZodMAC",(e,t)=>{Zc.init(e,t),pe.init(e,t)});function Vb(e){return Nu(Ph,e)}var Cl=m("ZodIPv6",(e,t)=>{Cc.init(e,t),pe.init(e,t)});function Jb(e){return Go(Cl,e)}var Zl=m("ZodCIDRv4",(e,t)=>{Uc.init(e,t),pe.init(e,t)});function Bb(e){return Xo(Zl,e)}var Ul=m("ZodCIDRv6",(e,t)=>{Mc.init(e,t),pe.init(e,t)});function Kb(e){return Yo(Ul,e)}var Ml=m("ZodBase64",(e,t)=>{qc.init(e,t),pe.init(e,t)});function Hb(e){return Qo(Ml,e)}var ql=m("ZodBase64URL",(e,t)=>{Lc.init(e,t),pe.init(e,t)});function Wb(e){return ea(ql,e)}var Ll=m("ZodE164",(e,t)=>{Fc.init(e,t),pe.init(e,t)});function Gb(e){return ta(Ll,e)}var Fl=m("ZodJWT",(e,t)=>{Vc.init(e,t),pe.init(e,t)});function Xb(e){return ra(Fl,e)}var ki=m("ZodCustomStringFormat",(e,t)=>{Jc.init(e,t),pe.init(e,t)});function Yb(e,t,r={}){return nn(ki,e,t,r)}function Qb(e){return nn(ki,"hostname",lt.hostname,e)}function ex(e){return nn(ki,"hex",lt.hex,e)}function tx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=lt[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return nn(ki,n,i,t)}var ma=m("ZodNumber",(e,t)=>{No.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Tm(e,n,i,o),e.gt=(n,i)=>e.check(qt(n,i)),e.gte=(n,i)=>e.check(Fe(n,i)),e.min=(n,i)=>e.check(Fe(n,i)),e.lt=(n,i)=>e.check(Mt(n,i)),e.lte=(n,i)=>e.check(nt(n,i)),e.max=(n,i)=>e.check(nt(n,i)),e.int=n=>e.check(zl(n)),e.safe=n=>e.check(zl(n)),e.positive=n=>e.check(qt(0,n)),e.nonnegative=n=>e.check(Fe(0,n)),e.negative=n=>e.check(Mt(0,n)),e.nonpositive=n=>e.check(nt(0,n)),e.multipleOf=(n,i)=>e.check(xr(n,i)),e.step=(n,i)=>e.check(xr(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function se(e){return Zu(ma,e)}var an=m("ZodNumberFormat",(e,t)=>{Bc.init(e,t),ma.init(e,t)});function zl(e){return Uu(an,e)}function rx(e){return Mu(an,e)}function nx(e){return qu(an,e)}function ix(e){return Lu(an,e)}function ox(e){return Fu(an,e)}var ha=m("ZodBoolean",(e,t)=>{oi.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Em(e,r,n,i)});function be(e){return Vu(ha,e)}var ga=m("ZodBigInt",(e,t)=>{Ro.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Om(e,n,i,o),e.gte=(n,i)=>e.check(Fe(n,i)),e.min=(n,i)=>e.check(Fe(n,i)),e.gt=(n,i)=>e.check(qt(n,i)),e.gte=(n,i)=>e.check(Fe(n,i)),e.min=(n,i)=>e.check(Fe(n,i)),e.lt=(n,i)=>e.check(Mt(n,i)),e.lte=(n,i)=>e.check(nt(n,i)),e.max=(n,i)=>e.check(nt(n,i)),e.positive=n=>e.check(qt(BigInt(0),n)),e.negative=n=>e.check(Mt(BigInt(0),n)),e.nonpositive=n=>e.check(nt(BigInt(0),n)),e.nonnegative=n=>e.check(Fe(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(xr(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function ax(e){return Ju(ga,e)}var Vl=m("ZodBigIntFormat",(e,t)=>{Kc.init(e,t),ga.init(e,t)});function sx(e){return Bu(Vl,e)}function cx(e){return Ku(Vl,e)}var Th=m("ZodSymbol",(e,t)=>{Hc.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Nm(e,r,n,i)});function ux(e){return Hu(Th,e)}var Eh=m("ZodUndefined",(e,t)=>{Wc.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Dm(e,r,n,i)});function lx(e){return Wu(Eh,e)}var Oh=m("ZodNull",(e,t)=>{Gc.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Rm(e,r,n,i)});function Si(e){return Gu(Oh,e)}var Nh=m("ZodAny",(e,t)=>{Xc.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Zm(e,r,n,i)});function dx(){return Xu(Nh)}var Rh=m("ZodUnknown",(e,t)=>{Yc.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Um(e,r,n,i)});function fe(){return Yu(Rh)}var Dh=m("ZodNever",(e,t)=>{Qc.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Cm(e,r,n,i)});function Jl(e){return Qu(Dh,e)}var Ah=m("ZodVoid",(e,t)=>{eu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Am(e,r,n,i)});function px(e){return el(Ah,e)}var Bl=m("ZodDate",(e,t)=>{tu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>Mm(e,n,i,o),e.min=(n,i)=>e.check(Fe(n,i)),e.max=(n,i)=>e.check(nt(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function fx(e){return tl(Bl,e)}var Ch=m("ZodArray",(e,t)=>{ru.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ym(e,r,n,i),e.element=t.element,e.min=(r,n)=>e.check(ir(r,n)),e.nonempty=r=>e.check(ir(1,r)),e.max=(r,n)=>e.check(tn(r,n)),e.length=(r,n)=>e.check(rn(r,n)),e.unwrap=()=>e.element});function Q(e,t){return Im(Ch,e,t)}function mx(e){let t=e._zod.def.shape;return Ae(Object.keys(t))}var va=m("ZodObject",(e,t)=>{Sm.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Qm(e,r,n,i),x.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Ae(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:fe()}),e.loose=()=>e.clone({...e._zod.def,catchall:fe()}),e.strict=()=>e.clone({...e._zod.def,catchall:Jl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>x.extend(e,r),e.safeExtend=r=>x.safeExtend(e,r),e.merge=r=>x.merge(e,r),e.pick=r=>x.pick(e,r),e.omit=r=>x.omit(e,r),e.partial=(...r)=>x.partial(Hl,e,r[0]),e.required=(...r)=>x.required(Wl,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...x.normalizeParams(t)};return new va(r)}function hx(e,t){return new va({type:"object",shape:e,catchall:Jl(),...x.normalizeParams(t)})}function De(e,t){return new va({type:"object",shape:e,catchall:fe(),...x.normalizeParams(t)})}var ya=m("ZodUnion",(e,t)=>{ai.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>hl(e,r,n,i),e.options=t.options});function ue(e,t){return new ya({type:"union",options:e,...x.normalizeParams(t)})}var Zh=m("ZodXor",(e,t)=>{ya.init(e,t),nu.init(e,t),e._zod.processJSONSchema=(r,n,i)=>hl(e,r,n,i),e.options=t.options});function gx(e,t){return new Zh({type:"union",options:e,inclusive:!1,...x.normalizeParams(t)})}var Uh=m("ZodDiscriminatedUnion",(e,t)=>{ya.init(e,t),iu.init(e,t)});function _a(e,t,r){return new Uh({type:"union",options:t,discriminator:e,...x.normalizeParams(r)})}var Mh=m("ZodIntersection",(e,t)=>{ou.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>eh(e,r,n,i)});function zi(e,t){return new Mh({type:"intersection",left:e,right:t})}var qh=m("ZodTuple",(e,t)=>{Do.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>th(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Lh(e,t,r){let n=t instanceof F,i=n?r:t,o=n?t:null;return new qh({type:"tuple",items:e,rest:o,...x.normalizeParams(i)})}var $a=m("ZodRecord",(e,t)=>{au.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>rh(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function ge(e,t,r){return new $a({type:"record",keyType:e,valueType:t,...x.normalizeParams(r)})}function vx(e,t,r){let n=qe(e);return n._zod.values=void 0,new $a({type:"record",keyType:n,valueType:t,...x.normalizeParams(r)})}function yx(e,t,r){return new $a({type:"record",keyType:e,valueType:t,mode:"loose",...x.normalizeParams(r)})}var Fh=m("ZodMap",(e,t)=>{su.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Gm(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Lt(...r)),e.nonempty=r=>e.check(Lt(1,r)),e.max=(...r)=>e.check(wr(...r)),e.size=(...r)=>e.check(en(...r))});function _x(e,t,r){return new Fh({type:"map",keyType:e,valueType:t,...x.normalizeParams(r)})}var Vh=m("ZodSet",(e,t)=>{cu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Xm(e,r,n,i),e.min=(...r)=>e.check(Lt(...r)),e.nonempty=r=>e.check(Lt(1,r)),e.max=(...r)=>e.check(wr(...r)),e.size=(...r)=>e.check(en(...r))});function $x(e,t){return new Vh({type:"set",valueType:e,...x.normalizeParams(t)})}var wi=m("ZodEnum",(e,t)=>{uu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,i,o)=>qm(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let a of n)if(r.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new wi({...t,checks:[],...x.normalizeParams(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let a of n)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new wi({...t,checks:[],...x.normalizeParams(i),entries:o})}});function Ae(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new wi({type:"enum",entries:r,...x.normalizeParams(t)})}function bx(e,t){return new wi({type:"enum",entries:e,...x.normalizeParams(t)})}var Jh=m("ZodLiteral",(e,t)=>{lu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Lm(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function R(e,t){return new Jh({type:"literal",values:Array.isArray(e)?e:[e],...x.normalizeParams(t)})}var Bh=m("ZodFile",(e,t)=>{du.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Jm(e,r,n,i),e.min=(r,n)=>e.check(Lt(r,n)),e.max=(r,n)=>e.check(wr(r,n)),e.mime=(r,n)=>e.check(gi(Array.isArray(r)?r:[r],n))});function xx(e){return cl(Bh,e)}var Kh=m("ZodTransform",(e,t)=>{pu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Wm(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new yr(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(x.issue(o,r.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(x.issue(a))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function Kl(e){return new Kh({type:"transform",transform:e})}var Hl=m("ZodOptional",(e,t)=>{Ao.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gl(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function ve(e){return new Hl({type:"optional",innerType:e})}var Hh=m("ZodExactOptional",(e,t)=>{fu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gl(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Wh(e){return new Hh({type:"optional",innerType:e})}var Gh=m("ZodNullable",(e,t)=>{mu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>nh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function la(e){return new Gh({type:"nullable",innerType:e})}function wx(e){return ve(la(e))}var Xh=m("ZodDefault",(e,t)=>{hu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>oh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Yh(e,t){return new Xh({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():x.shallowClone(t)}})}var Qh=m("ZodPrefault",(e,t)=>{gu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ah(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function eg(e,t){return new Qh({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():x.shallowClone(t)}})}var Wl=m("ZodNonOptional",(e,t)=>{vu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ih(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function tg(e,t){return new Wl({type:"nonoptional",innerType:e,...x.normalizeParams(t)})}var rg=m("ZodSuccess",(e,t)=>{yu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Bm(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function kx(e){return new rg({type:"success",innerType:e})}var ng=m("ZodCatch",(e,t)=>{_u.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ig(e,t){return new ng({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var og=m("ZodNaN",(e,t)=>{$u.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Fm(e,r,n,i)});function Sx(e){return rl(og,e)}var Gl=m("ZodPipe",(e,t)=>{bu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ch(e,r,n,i),e.in=t.in,e.out=t.out});function da(e,t){return new Gl({type:"pipe",in:e,out:t})}var Xl=m("ZodCodec",(e,t)=>{Gl.init(e,t),si.init(e,t)});function zx(e,t,r){return new Xl({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var ag=m("ZodReadonly",(e,t)=>{xu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>uh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function sg(e){return new ag({type:"readonly",innerType:e})}var cg=m("ZodTemplateLiteral",(e,t)=>{wu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Vm(e,r,n,i)});function Ix(e,t){return new cg({type:"template_literal",parts:e,...x.normalizeParams(t)})}var ug=m("ZodLazy",(e,t)=>{zu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dh(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function lg(e){return new ug({type:"lazy",getter:e})}var dg=m("ZodPromise",(e,t)=>{Su.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>lh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function jx(e){return new dg({type:"promise",innerType:e})}var pg=m("ZodFunction",(e,t)=>{ku.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Hm(e,r,n,i)});function Px(e){return new pg({type:"function",input:Array.isArray(e?.input)?Lh(e?.input):e?.input??Q(fe()),output:e?.output??fe()})}var ba=m("ZodCustom",(e,t)=>{Iu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Km(e,r,n,i)});function Tx(e){let t=new de({check:"custom"});return t._zod.check=e,t}function Yl(e,t){return ul(ba,e??(()=>!0),t)}function fg(e,t={}){return ll(ba,e,t)}function mg(e){return dl(e)}var Ex=pl,Ox=fl;function Nx(e,t={}){let r=new ba({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...x.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Rx=(...e)=>ml({Codec:Xl,Boolean:ha,String:pa},...e);function Dx(e){let t=lg(()=>ue([y(e),se(),be(),Si(),Q(t),ge(y(),t)]));return t}function xa(e,t){return da(Kl(e),t)}var hg;hg||(hg={});var KR={...xi,...ca,iso:kr};Se(ju());var ed="2025-11-25";var gg=[ed,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ar="io.modelcontextprotocol/related-task",ka="2.0",Ie=Yl(e=>e!==null&&(typeof e=="object"||typeof e=="function")),vg=ue([y(),se().int()]),yg=y(),pD=De({ttl:ue([se(),Si()]).optional(),pollInterval:se().optional()}),Ux=T({ttl:se().optional()}),Mx=T({taskId:y()}),td=De({progressToken:vg.optional(),[ar]:Mx.optional()}),ot=T({_meta:td.optional()}),Ii=ot.extend({task:Ux.optional()}),_g=e=>Ii.safeParse(e).success,je=T({method:y(),params:ot.loose().optional()}),dt=T({_meta:td.optional()}),pt=T({method:y(),params:dt.loose().optional()}),Pe=De({_meta:td.optional()}),Sa=ue([y(),se().int()]),$g=T({jsonrpc:R(ka),id:Sa,...je.shape}).strict(),rd=e=>$g.safeParse(e).success,bg=T({jsonrpc:R(ka),...pt.shape}).strict(),xg=e=>bg.safeParse(e).success,nd=T({jsonrpc:R(ka),id:Sa,result:Pe}).strict(),ji=e=>nd.safeParse(e).success;var re;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(re||(re={}));var id=T({jsonrpc:R(ka),id:Sa.optional(),error:T({code:se().int(),message:y(),data:fe().optional()})}).strict();var wg=e=>id.safeParse(e).success;var kg=ue([$g,bg,nd,id]),fD=ue([nd,id]),za=Pe.strict(),qx=dt.extend({requestId:Sa.optional(),reason:y().optional()}),Ia=pt.extend({method:R("notifications/cancelled"),params:qx}),Lx=T({src:y(),mimeType:y().optional(),sizes:Q(y()).optional(),theme:Ae(["light","dark"]).optional()}),Pi=T({icons:Q(Lx).optional()}),sn=T({name:y(),title:y().optional()}),Sg=sn.extend({...sn.shape,...Pi.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),Fx=zi(T({applyDefaults:be().optional()}),ge(y(),fe())),Vx=xa(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,zi(T({form:Fx.optional(),url:Ie.optional()}),ge(y(),fe()).optional())),Jx=De({list:Ie.optional(),cancel:Ie.optional(),requests:De({sampling:De({createMessage:Ie.optional()}).optional(),elicitation:De({create:Ie.optional()}).optional()}).optional()}),Bx=De({list:Ie.optional(),cancel:Ie.optional(),requests:De({tools:De({call:Ie.optional()}).optional()}).optional()}),Kx=T({experimental:ge(y(),Ie).optional(),sampling:T({context:Ie.optional(),tools:Ie.optional()}).optional(),elicitation:Vx.optional(),roots:T({listChanged:be().optional()}).optional(),tasks:Jx.optional()}),Hx=ot.extend({protocolVersion:y(),capabilities:Kx,clientInfo:Sg}),od=je.extend({method:R("initialize"),params:Hx});var Wx=T({experimental:ge(y(),Ie).optional(),logging:Ie.optional(),completions:Ie.optional(),prompts:T({listChanged:be().optional()}).optional(),resources:T({subscribe:be().optional(),listChanged:be().optional()}).optional(),tools:T({listChanged:be().optional()}).optional(),tasks:Bx.optional()}),Gx=Pe.extend({protocolVersion:y(),capabilities:Wx,serverInfo:Sg,instructions:y().optional()}),ad=pt.extend({method:R("notifications/initialized"),params:dt.optional()});var ja=je.extend({method:R("ping"),params:ot.optional()}),Xx=T({progress:se(),total:ve(se()),message:ve(y())}),Yx=T({...dt.shape,...Xx.shape,progressToken:vg}),Pa=pt.extend({method:R("notifications/progress"),params:Yx}),Qx=ot.extend({cursor:yg.optional()}),Ti=je.extend({params:Qx.optional()}),Ei=Pe.extend({nextCursor:yg.optional()}),ew=Ae(["working","input_required","completed","failed","cancelled"]),Oi=T({taskId:y(),status:ew,ttl:ue([se(),Si()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:ve(se()),statusMessage:ve(y())}),cn=Pe.extend({task:Oi}),tw=dt.merge(Oi),Ni=pt.extend({method:R("notifications/tasks/status"),params:tw}),Ta=je.extend({method:R("tasks/get"),params:ot.extend({taskId:y()})}),Ea=Pe.merge(Oi),Oa=je.extend({method:R("tasks/result"),params:ot.extend({taskId:y()})}),mD=Pe.loose(),Na=Ti.extend({method:R("tasks/list")}),Ra=Ei.extend({tasks:Q(Oi)}),Da=je.extend({method:R("tasks/cancel"),params:ot.extend({taskId:y()})}),zg=Pe.merge(Oi),Ig=T({uri:y(),mimeType:ve(y()),_meta:ge(y(),fe()).optional()}),jg=Ig.extend({text:y()}),sd=y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Pg=Ig.extend({blob:sd}),Ri=Ae(["user","assistant"]),un=T({audience:Q(Ri).optional(),priority:se().min(0).max(1).optional(),lastModified:kr.datetime({offset:!0}).optional()}),Tg=T({...sn.shape,...Pi.shape,uri:y(),description:ve(y()),mimeType:ve(y()),annotations:un.optional(),_meta:ve(De({}))}),rw=T({...sn.shape,...Pi.shape,uriTemplate:y(),description:ve(y()),mimeType:ve(y()),annotations:un.optional(),_meta:ve(De({}))}),nw=Ti.extend({method:R("resources/list")}),iw=Ei.extend({resources:Q(Tg)}),ow=Ti.extend({method:R("resources/templates/list")}),aw=Ei.extend({resourceTemplates:Q(rw)}),cd=ot.extend({uri:y()}),sw=cd,cw=je.extend({method:R("resources/read"),params:sw}),uw=Pe.extend({contents:Q(ue([jg,Pg]))}),lw=pt.extend({method:R("notifications/resources/list_changed"),params:dt.optional()}),dw=cd,pw=je.extend({method:R("resources/subscribe"),params:dw}),fw=cd,mw=je.extend({method:R("resources/unsubscribe"),params:fw}),hw=dt.extend({uri:y()}),gw=pt.extend({method:R("notifications/resources/updated"),params:hw}),vw=T({name:y(),description:ve(y()),required:ve(be())}),yw=T({...sn.shape,...Pi.shape,description:ve(y()),arguments:ve(Q(vw)),_meta:ve(De({}))}),_w=Ti.extend({method:R("prompts/list")}),$w=Ei.extend({prompts:Q(yw)}),bw=ot.extend({name:y(),arguments:ge(y(),y()).optional()}),xw=je.extend({method:R("prompts/get"),params:bw}),ud=T({type:R("text"),text:y(),annotations:un.optional(),_meta:ge(y(),fe()).optional()}),ld=T({type:R("image"),data:sd,mimeType:y(),annotations:un.optional(),_meta:ge(y(),fe()).optional()}),dd=T({type:R("audio"),data:sd,mimeType:y(),annotations:un.optional(),_meta:ge(y(),fe()).optional()}),ww=T({type:R("tool_use"),name:y(),id:y(),input:ge(y(),fe()),_meta:ge(y(),fe()).optional()}),kw=T({type:R("resource"),resource:ue([jg,Pg]),annotations:un.optional(),_meta:ge(y(),fe()).optional()}),Sw=Tg.extend({type:R("resource_link")}),pd=ue([ud,ld,dd,Sw,kw]),zw=T({role:Ri,content:pd}),Iw=Pe.extend({description:y().optional(),messages:Q(zw)}),jw=pt.extend({method:R("notifications/prompts/list_changed"),params:dt.optional()}),Pw=T({title:y().optional(),readOnlyHint:be().optional(),destructiveHint:be().optional(),idempotentHint:be().optional(),openWorldHint:be().optional()}),Tw=T({taskSupport:Ae(["required","optional","forbidden"]).optional()}),Eg=T({...sn.shape,...Pi.shape,description:y().optional(),inputSchema:T({type:R("object"),properties:ge(y(),Ie).optional(),required:Q(y()).optional()}).catchall(fe()),outputSchema:T({type:R("object"),properties:ge(y(),Ie).optional(),required:Q(y()).optional()}).catchall(fe()).optional(),annotations:Pw.optional(),execution:Tw.optional(),_meta:ge(y(),fe()).optional()}),fd=Ti.extend({method:R("tools/list")}),Ew=Ei.extend({tools:Q(Eg)}),Aa=Pe.extend({content:Q(pd).default([]),structuredContent:ge(y(),fe()).optional(),isError:be().optional()}),hD=Aa.or(Pe.extend({toolResult:fe()})),Ow=Ii.extend({name:y(),arguments:ge(y(),fe()).optional()}),Di=je.extend({method:R("tools/call"),params:Ow}),Nw=pt.extend({method:R("notifications/tools/list_changed"),params:dt.optional()}),gD=T({autoRefresh:be().default(!0),debounceMs:se().int().nonnegative().default(300)}),Ai=Ae(["debug","info","notice","warning","error","critical","alert","emergency"]),Rw=ot.extend({level:Ai}),md=je.extend({method:R("logging/setLevel"),params:Rw}),Dw=dt.extend({level:Ai,logger:y().optional(),data:fe()}),Aw=pt.extend({method:R("notifications/message"),params:Dw}),Cw=T({name:y().optional()}),Zw=T({hints:Q(Cw).optional(),costPriority:se().min(0).max(1).optional(),speedPriority:se().min(0).max(1).optional(),intelligencePriority:se().min(0).max(1).optional()}),Uw=T({mode:Ae(["auto","required","none"]).optional()}),Mw=T({type:R("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:Q(pd).default([]),structuredContent:T({}).loose().optional(),isError:be().optional(),_meta:ge(y(),fe()).optional()}),qw=_a("type",[ud,ld,dd]),wa=_a("type",[ud,ld,dd,ww,Mw]),Lw=T({role:Ri,content:ue([wa,Q(wa)]),_meta:ge(y(),fe()).optional()}),Fw=Ii.extend({messages:Q(Lw),modelPreferences:Zw.optional(),systemPrompt:y().optional(),includeContext:Ae(["none","thisServer","allServers"]).optional(),temperature:se().optional(),maxTokens:se().int(),stopSequences:Q(y()).optional(),metadata:Ie.optional(),tools:Q(Eg).optional(),toolChoice:Uw.optional()}),Vw=je.extend({method:R("sampling/createMessage"),params:Fw}),Ci=Pe.extend({model:y(),stopReason:ve(Ae(["endTurn","stopSequence","maxTokens"]).or(y())),role:Ri,content:qw}),hd=Pe.extend({model:y(),stopReason:ve(Ae(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:Ri,content:ue([wa,Q(wa)])}),Jw=T({type:R("boolean"),title:y().optional(),description:y().optional(),default:be().optional()}),Bw=T({type:R("string"),title:y().optional(),description:y().optional(),minLength:se().optional(),maxLength:se().optional(),format:Ae(["email","uri","date","date-time"]).optional(),default:y().optional()}),Kw=T({type:Ae(["number","integer"]),title:y().optional(),description:y().optional(),minimum:se().optional(),maximum:se().optional(),default:se().optional()}),Hw=T({type:R("string"),title:y().optional(),description:y().optional(),enum:Q(y()),default:y().optional()}),Ww=T({type:R("string"),title:y().optional(),description:y().optional(),oneOf:Q(T({const:y(),title:y()})),default:y().optional()}),Gw=T({type:R("string"),title:y().optional(),description:y().optional(),enum:Q(y()),enumNames:Q(y()).optional(),default:y().optional()}),Xw=ue([Hw,Ww]),Yw=T({type:R("array"),title:y().optional(),description:y().optional(),minItems:se().optional(),maxItems:se().optional(),items:T({type:R("string"),enum:Q(y())}),default:Q(y()).optional()}),Qw=T({type:R("array"),title:y().optional(),description:y().optional(),minItems:se().optional(),maxItems:se().optional(),items:T({anyOf:Q(T({const:y(),title:y()}))}),default:Q(y()).optional()}),ek=ue([Yw,Qw]),tk=ue([Gw,Xw,ek]),rk=ue([tk,Jw,Bw,Kw]),nk=Ii.extend({mode:R("form").optional(),message:y(),requestedSchema:T({type:R("object"),properties:ge(y(),rk),required:Q(y()).optional()})}),ik=Ii.extend({mode:R("url"),message:y(),elicitationId:y(),url:y().url()}),ok=ue([nk,ik]),ak=je.extend({method:R("elicitation/create"),params:ok}),sk=dt.extend({elicitationId:y()}),ck=pt.extend({method:R("notifications/elicitation/complete"),params:sk}),ln=Pe.extend({action:Ae(["accept","decline","cancel"]),content:xa(e=>e===null?void 0:e,ge(y(),ue([y(),se(),be(),Q(y())])).optional())}),uk=T({type:R("ref/resource"),uri:y()});var lk=T({type:R("ref/prompt"),name:y()}),dk=ot.extend({ref:ue([lk,uk]),argument:T({name:y(),value:y()}),context:T({arguments:ge(y(),y()).optional()}).optional()}),pk=je.extend({method:R("completion/complete"),params:dk});var fk=Pe.extend({completion:De({values:Q(y()).max(100),total:ve(se().int()),hasMore:ve(be())})}),mk=T({uri:y().startsWith("file://"),name:y().optional(),_meta:ge(y(),fe()).optional()}),hk=je.extend({method:R("roots/list"),params:ot.optional()}),gd=Pe.extend({roots:Q(mk)}),gk=pt.extend({method:R("notifications/roots/list_changed"),params:dt.optional()}),vD=ue([ja,od,pk,md,xw,_w,nw,ow,cw,pw,mw,Di,fd,Ta,Oa,Na,Da]),yD=ue([Ia,Pa,ad,gk,Ni]),_D=ue([za,Ci,hd,ln,gd,Ea,Ra,cn]),$D=ue([ja,Vw,ak,hk,Ta,Oa,Na,Da]),bD=ue([Ia,Pa,Aw,gw,lw,Nw,jw,Ni,ck]),xD=ue([za,Gx,fk,Iw,$w,iw,aw,uw,Aa,Ew,Ea,Ra,cn]),K=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===re.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new Ql(i.elicitations,r)}return new e(t,r,n)}},Ql=class extends K{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(re.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function sr(e){return e==="completed"||e==="failed"||e==="cancelled"}var r1=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function vd(e){let r=sa(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=hh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function yd(e,t){let r=or(e,t);if(!r.success)throw r.error;return r.data}var xk=6e4,Ca=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ia,r=>{this._oncancel(r)}),this.setNotificationHandler(Pa,r=>{this._onprogress(r)}),this.setRequestHandler(ja,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ta,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new K(re.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Oa,async(r,n)=>{let i=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,f=new K(d.error.code,d.error.message,d.error.data);l(f)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(o,n.sessionId);if(!a)throw new K(re.InvalidParams,`Task not found: ${o}`);if(!sr(a.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(sr(a.status)){let s=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...s,_meta:{...s._meta,[ar]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Na,async(r,n)=>{try{let{tasks:i,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:o,_meta:{}}}catch(i){throw new K(re.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Da,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new K(re.InvalidParams,`Task not found: ${r.params.taskId}`);if(sr(i.status))throw new K(re.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new K(re.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(i){throw i instanceof K?i:new K(re.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,i,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),K.fromError(re.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let i=this._transport?.onmessage;this._transport.onmessage=(o,a)=>{i?.(o,a),ji(o)||wg(o)?this._onresponse(o):rd(o)?this._onrequest(o,a):xg(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=K.fromError(re.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,i=this._transport,o=t.params?._meta?.[ar]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:re.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=_g(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,i?.sessionId):void 0,u={signal:a.signal,sessionId:i?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(a.signal.aborted)throw new K(re.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:t.id};o&&!p.relatedTask&&(p.relatedTask={taskId:o});let h=p.relatedTask?.taskId??o;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,p)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:re.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),a(c);return}o(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),ji(t))n(t);else{let a=new K(t.error.code,t.error.message,t.error.data);n(a)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(ji(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(o=!0,this._taskProgressTokens.set(s.taskId,r))}}if(o||this._progressHandlers.delete(r),ji(t))i(t);else{let a=K.fromError(t.error.code,t.error.message,t.error.data);i(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof K?a:new K(re.InternalError,String(a))}}return}let o;try{let a=await this.request(t,cn,n);if(a.task)o=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new K(re.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:s},sr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:s.status==="failed"?yield{type:"error",error:new K(re.InternalError,`Task ${o} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new K(re.InternalError,`Task ${o} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof K?a:new K(re.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=E=>{l(E)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(E){d(E);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[ar]:c}});let h=E=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(E)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let I=E instanceof K?E:new K(re.RequestTimeout,String(E));l(I)};this._responseHandlers.set(f,E=>{if(!n?.signal?.aborted){if(E instanceof Error)return l(E);try{let I=or(r,E.result);I.success?u(I.data):l(I.error)}catch(I){l(I)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let g=n?.timeout??xk,_=()=>h(K.fromError(re.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(f,g,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let k=c?.taskId;if(k){let E=I=>{let A=this._responseHandlers.get(f);A?A(I):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,E),this._enqueueTaskMessage(k,{type:"request",message:p,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(f),l(I)})}else this._transport.send(p,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a}).catch(E=>{this._cleanupTimeout(f),l(E)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ea,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Ra,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},zg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ar]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[ar]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ar]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=vd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>{let a=yd(t,i);return Promise.resolve(r(a,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=vd(t);this._notificationHandlers.set(n,i=>{let o=yd(t,i);return Promise.resolve(r(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,i)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let i of n)if(i.type==="request"&&rd(i.message)){let o=i.message.id,a=this._requestResolvers.get(o);a?(a(new K(re.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(t);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,o)=>{if(r.aborted){o(new K(re.InvalidRequest,"Request cancelled"));return}let a=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(a),o(new K(re.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!t)throw new Error("No request provided");return await n.createTask(i,t.id,{method:t.method,params:t.params},r)},getTask:async i=>{let o=await n.getTask(i,r);if(!o)throw new K(re.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(i,o,a)=>{await n.storeTaskResult(i,o,a,r);let s=await n.getTask(i,r);if(s){let c=Ni.parse({method:"notifications/tasks/status",params:s});await this.notification(c),sr(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,o,a)=>{let s=await n.getTask(i,r);if(!s)throw new K(re.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(sr(s.status))throw new K(re.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,o,a,r);let c=await n.getTask(i,r);if(c){let u=Ni.parse({method:"notifications/tasks/status",params:c});await this.notification(u),sr(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function Og(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ng(e,t){let r={...e};for(let n in t){let i=n,o=t[i];if(o===void 0)continue;let a=r[i];Og(a)&&Og(o)?r[i]={...a,...o}:r[i]=o}return r}var __=mf(nf(),1),$_=mf(y_(),1);function fP(){let e=new __.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,$_.default)(e),e}var _s=class{constructor(t){this._ajv=t??fP()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var $s=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let i=t.messages[t.messages.length-1],o=Array.isArray(i.content)?i.content:[i.content],a=o.some(l=>l.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(o.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(f=>f.type==="tool_use").map(f=>f.id)),d=new Set(o.filter(f=>f.type==="tool_result").map(f=>f.toolUseId));if(l.size!==d.size||![...l].every(f=>d.has(f)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Ci,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),i=t.mode??"form";switch(i){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let o=i==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:o},ln,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function b_(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function x_(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var bs=class extends Ca{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ai.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let o=this._loggingLevels.get(i);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new _s,this.setRequestHandler(od,n=>this._oninitialize(n)),this.setNotificationHandler(ad,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(md,async(n,i)=>{let o=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Ai.safeParse(a);return s.success&&this._loggingLevels.set(o,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new $s(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ng(this._capabilities,t)}setRequestHandler(t,r){let i=sa(t)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(on(i)){let s=i;o=s._zod?.def?.value??s.value}else{let s=i;o=s._def?.value??s.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let s=async(c,u)=>{let l=or(Di,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new K(re.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let h=or(cn,f);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new K(re.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let p=or(Aa,f);if(!p.success){let h=p.error instanceof Error?p.error.message:String(p.error);throw new K(re.InvalidParams,`Invalid tools/call result: ${h}`)}return p.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){x_(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&b_(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:gg.includes(r)?r:ed,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},za)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],o=i.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(o){if(i.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},hd,r):this.request({method:"sampling/createMessage",params:t},Ci,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},ln,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},o=await this.request({method:"elicitation/create",params:i},ln,r);if(o.action==="accept"&&o.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(o.content);if(!s.valid)throw new K(re.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof K?a:new K(re.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return o}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},gd,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import k_ from"node:process";var xs=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
49
+ `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),mP(r)}clear(){this._buffer=void 0}};function mP(e){return kg.parse(JSON.parse(e))}function w_(e){return JSON.stringify(e)+`
50
+ `}var ws=class{constructor(t=k_.stdin,r=k_.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new xs,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 t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}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(t){return new Promise(r=>{let n=w_(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};import*as $ from"node:fs/promises";import*as vt from"node:fs";import*as v from"node:path";var z_=process.env.JET_API_URL??"https://api.jetro.ai",I_=process.env.JET_WORKSPACE??process.cwd(),hP=process.env.JET_JWT||"",gP=v.join(process.env.HOME||process.env.USERPROFILE||"~",".jetro","auth.json");function vP(){try{return JSON.parse(vt.readFileSync(gP,"utf-8"))}catch{return{}}}function j_(){let e=vP();if(e.jwt)return e.jwt;try{let t=yP(),n=JSON.parse(vt.readFileSync(v.join(t,".mcp.json"),"utf-8"))?.mcpServers?.jetro?.env?.JET_JWT;if(n&&typeof n=="string")return n}catch{}return hP}function yP(){return I_}var w=I_,_P=15e3;console.error(`[jetro-mcp] started at ${new Date().toISOString()} | WORKSPACE=${w}`);async function pf(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(),_P);try{let i=await fetch(`${z_}${e}`,{method:"POST",headers:{Authorization:`Bearer ${j_()}`,"Content-Type":"application/json"},body:JSON.stringify(t),signal:r.signal});if(!i.ok){let o=await i.text().catch(()=>"");throw new Error(`API ${i.status}: ${o||i.statusText}`)}return await i.json()}finally{clearTimeout(n)}}function Ss(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,"")}function at(e){return e.replace(/[^a-zA-Z0-9._-]/g,"")}function st(e,t){let r=v.resolve(e),n=v.resolve(t);if(!r.startsWith(n+v.sep)&&r!==n)throw new Error(`Path traversal blocked: ${e} escapes ${t}`)}async function Y(e){await $.mkdir(e,{recursive:!0})}var $P=[{name:"jet_data",description:"Fetch financial data from the Jetro Data API. Use this to get company profiles, ratios, income statements, balance sheets, cash flows, key metrics, quotes, and historical prices.",inputSchema:{type:"object",properties:{provider:{type:"string",enum:["fmp","polygon"],description:"Data provider to query"},endpoint:{type:"string",description:"API endpoint path, e.g. /profile/ALKEM.NS, /ratios/CIPLA.NS, /income-statement/SUNPHARMA.NS"},params:{type:"object",description:"Optional query parameters (e.g. { period: 'annual', limit: '5' })"}},required:["provider","endpoint"]}},{name:"jet_skill",description:"Fetch a skill prompt from the Jetro backend. Call this to get the full analysis instructions before executing any skill. Returns the complete prompt text. Includes web_source (source data from any website, generates scraping script + live frame) and web_source_recon (investigate a website's data architecture).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Exact skill name from the Available Skills list in CLAUDE.md"}},required:["name"]}},{name:"jet_template",description:"Fetch a report/output template (bundled starter or user-created). Call this to get the full template content before formatting your output.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Exact template name from the Available Templates list in CLAUDE.md"}},required:["name"]}},{name:"jet_save",description:`Save structured data to the Jetro workspace.
51
+
52
+ \u2550\u2550\u2550 LIST (type='list') \u2550\u2550\u2550
53
+ payload MUST include: tickers (string array of ticker symbols, e.g. ["LUPIN.NS", "ALKEM.NS"])
54
+ payload MAY include:
55
+ - criteria: string \u2014 natural language filter used to generate the list (makes it refreshable)
56
+ - recipeSlug: string \u2014 slug of a saved recipe that describes how to compute custom metrics
57
+ - scriptPath: string \u2014 path to a .py script for fast refresh (relative to workspace)
58
+ - refreshInterval: "on_open" | "hourly" | "daily" | "manual" \u2014 when to auto-refresh
59
+
60
+ WORKFLOW for custom-metric lists:
61
+ 1. Build an HTML frame that renders the list data (table, card grid, or any layout)
62
+ - Frame HTML MUST include: window.addEventListener("jet:refresh", (e) => { /* update DOM with e.detail */ })
63
+ - This enables live refresh without page reload
64
+ 2. Render to canvas with list link: jet_render(type='frame', data: { title, html: "...", listSlug: "{slug}" }, null, { scriptPath: ".jetro/scripts/{slug}_refresh.py", intervalMs: 120000 })
65
+ 3. Save the list: jet_save({ type: "list", name: "...", payload: { tickers: [...], criteria: "...", scriptPath: ".jetro/scripts/{slug}_refresh.py" } })
66
+ 4. Create a refresh script that outputs JSON matching what the frame's jet:refresh handler expects
67
+
68
+ REFRESH SCRIPT TEMPLATE:
69
+ from jet.api import jet_api
70
+ import json
71
+ tickers = ["LUPIN.NS", "ALKEM.NS"]
72
+ rows = []
73
+ for t in tickers:
74
+ q = jet_api(f"/quote/{t}")
75
+ rows.append({"ticker": t, "price": q[0]["price"], "change": q[0]["changesPercentage"]})
76
+ print(json.dumps({"rows": rows, "updated": "2026-03-13T10:00:00Z"}))
77
+
78
+ The frame's jet:refresh handler receives this JSON and updates the DOM dynamically.
79
+ WITHOUT a script or columns, refresh pushes raw quote data to the frame.
80
+
81
+ CONTEXT PERSISTENCE (new):
82
+ payload SHOULD include for lists with specific metrics:
83
+ - thesis: string \u2014 investment thesis behind this list (persists across restarts)
84
+ - columns: ListColumn[] \u2014 locked column definitions for deterministic refresh
85
+ Each column: { key: string, label: string, source: "fmp"|"computed"|"manual", endpoint?: string, field?: string, format?: "number"|"percent"|"currency", formula?: string }
86
+ Example: { key: "pe", label: "P/E (TTM)", source: "fmp", endpoint: "/ratios/{ticker}", field: "peRatioTTM", format: "number" }
87
+ ALWAYS provide thesis and columns when creating a list with specific metrics.
88
+ With columns defined, refresh is DETERMINISTIC \u2014 same data every restart, no LLM needed.
89
+
90
+ Example: jet_save({ type: "list", name: "Pharma Picks", payload: { tickers: ["LUPIN.NS", "ALKEM.NS"], thesis: "High-quality CNS pharma with pricing power", columns: [{ key: "ticker", label: "Ticker", source: "manual" }, { key: "pe", label: "P/E", source: "fmp", endpoint: "/ratios/{ticker}", field: "peRatioTTM", format: "number" }], criteria: "pharma stocks", refreshInterval: "daily" } })
91
+
92
+ \u2550\u2550\u2550 project \u2550\u2550\u2550
93
+ payload: { name, status: "active"|"draft"|"done", securities: [...], sources: [...], linkedConnections?: [...], linkedTemplates?: [...], linkedRecipes?: [...] }
94
+ linkedConnections/linkedTemplates/linkedRecipes link global resources to this project by slug. Existing linked arrays are preserved on partial updates.
95
+
96
+ \u2550\u2550\u2550 Other types: stock, preference, element, recipe, datasource, portfolio, template \u2550\u2550\u2550`,inputSchema:{type:"object",properties:{type:{type:"string",enum:["stock","list","project","preference","element","recipe","datasource","portfolio","template"],description:"Type of data to save"},name:{type:"string",description:"Name/identifier for the saved item"},payload:{type:"object",description:"The data to save. For type='list': { tickers: string[], criteria?: string, recipeSlug?: string, scriptPath?: string, refreshInterval?: string }"}},required:["type","name","payload"]}},{name:"jet_render",description:`Render a visual element to the Jetro Research Board canvas.
97
+
98
+ \u2550\u2550\u2550 CHART (type='chart') \u2014 MANDATORY for ALL charts/graphs/plots \u2550\u2550\u2550
99
+ Plotly.js is BUNDLED in the canvas. No CDN, no script tags, no iframes needed.
100
+ NEVER use type='frame' for charts \u2014 use type='chart' with Plotly traces.
101
+
102
+ Data format: { title: string, traces: PlotlyTrace[], plotlyLayout?: object }
103
+
104
+ SINGLE AXIS example:
105
+ { title: "Revenue", traces: [{ x: ["FY21","FY22","FY23"], y: [100,120,150], type: "bar", name: "Revenue", marker: { color: "#DEBFCA" } }] }
106
+
107
+ DUAL AXIS example (bars + line on separate Y scales):
108
+ { title: "Revenue & Margin", traces: [
109
+ { x: ["FY21","FY22","FY23"], y: [100,120,150], type: "bar", name: "Revenue \u20B9Cr", marker: { color: "#DEBFCA" } },
110
+ { x: ["FY21","FY22","FY23"], y: [12,15,18], type: "scatter", mode: "lines+markers", name: "OPM %", yaxis: "y2", line: { color: "#58A6FF" } }
111
+ ], plotlyLayout: { yaxis: { title: "\u20B9 Cr" }, yaxis2: { title: "%", overlaying: "y", side: "right" }, barmode: "group" } }
112
+
113
+ LEGEND: Auto-shown from trace "name" fields. Horizontal at bottom by default.
114
+ AXES: plotlyLayout.xaxis.title, yaxis.title, yaxis.tickprefix, yaxis.ticksuffix, xaxis.tickangle, etc.
115
+ COLORS: Default colorway = [#DEBFCA, #58A6FF, #3FB950, #F85149, #BC8CFF, #FF7B72]. Override per-trace via marker.color or line.color.
116
+ ALL Plotly types: bar, scatter, pie, heatmap, waterfall, funnel, treemap, sankey, candlestick, etc.
117
+
118
+ \u2550\u2550\u2550 FRAME (type='frame') \u2014 Rich HTML / interactive dashboards \u2550\u2550\u2550
119
+ Renders inside a sandboxed iframe with locally-bundled chart libraries.
120
+
121
+ TWO APPROACHES:
122
+
123
+ 1. FILE-BASED (recommended for complex HTML):
124
+ - Write HTML file to .jetro/frames/{name}.html
125
+ - Render: jet_render({ type: "frame", data: { title: "Dashboard", file: ".jetro/frames/{name}.html" } })
126
+ - HTML MUST be a complete document: <!DOCTYPE html><html><head>...</head><body>...</body></html>
127
+
128
+ 2. INLINE (quick snippets):
129
+ jet_render({ type: "frame", data: { title: "Summary", html: "<div>...</div>" } })
130
+
131
+ CHART LIBRARIES \u2014 Plotly, D3, Observable Plot are PRE-BUNDLED locally:
132
+ - Use standard CDN <script src="..."> tags (they are automatically shimmed to local copies):
133
+ <script src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script>
134
+ <script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
135
+ <script src="https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6"></script>
136
+ - NEVER inline the full library source code \u2014 always use a <script src="CDN_URL"> tag
137
+ - The extension transparently rewrites CDN URLs to local bundled copies (zero network, instant load)
138
+ - This works both on the canvas and when opening in the browser
139
+
140
+ \u2550\u2550\u2550 REFRESH BINDINGS \u2014 Two types \u2550\u2550\u2550
141
+
142
+ CRITICAL: When creating ANY element with a refresh binding, ALWAYS populate it with REAL initial data first.
143
+ - For script bindings: run the API call / fetch yourself and embed the real values in the HTML. Never use placeholders like "---" or "Loading...".
144
+ - For prompt bindings: do the web search / analysis NOW and render the full content. The refresh binding handles SUBSEQUENT updates only.
145
+ - The refresh cycle kicks in AFTER creation. If you leave placeholders, the user sees an empty dashboard until the first refresh fires.
146
+
147
+ SCRIPT REFRESH (bindingType='script', default):
148
+ - Attach a refresh script: refreshBinding: { scriptPath: ".jetro/scripts/foo.py", intervalMs: 5000 }
149
+ - The script runs on a timer, outputs JSON to stdout, shallow-merged into element.data
150
+ - Frame receives data via Jetro SDK: window.addEventListener("jet:refresh", (e) => { const data = e.detail; ... })
151
+ - Use for: live dashboards, real-time charts, API data, anything computable by a script
152
+
153
+ PROMPT REFRESH (bindingType='prompt'):
154
+ - Attach a prompt binding: refreshBinding: { bindingType: "prompt", refreshPrompt: "...", intervalMs: 300000 }
155
+ - The refreshPrompt is YOUR "note to future self" \u2014 it replays as an agent turn on each cycle
156
+ - Minimum interval: 300000ms (5 minutes). The agent runs the prompt, uses jet_render to update the element.
157
+ - Previous output preserved if the refresh fails (agent doesn't call jet_render).
158
+ - Use for: web search, news tracking, analysis, summarization \u2014 tasks needing AI reasoning.
159
+ - CRITICAL: The refreshPrompt MUST tell the agent to use jet_render with id='{elementId}' to UPDATE the existing element.
160
+ If you omit the id param, jet_render creates a NEW element instead of updating the existing one.
161
+ - ALWAYS write the refreshPrompt as clear, self-contained instructions:
162
+ GOOD: "Search for latest CDSCO drug approvals this week. Format as an HTML table with columns: Drug, Company, Date, Category. Update element mcp-1234 using jet_render with id='mcp-1234'."
163
+ BAD: "Update the headlines" (too vague, no format spec, no element ID)
164
+
165
+ HYBRID \u2014 Both types can coexist on the SAME element:
166
+ - A dashboard frame can have BOTH a script binding (live prices every 5s) AND a prompt binding (AI headlines every 5 min).
167
+ - Attach one via jet_render refreshBinding, add the other via jet_canvas(action='bind').
168
+ - The canvas shows "LIVE + AI" indicator when both are active.
169
+
170
+ CHOOSING between script vs prompt:
171
+ - Data from a fixed API/URL with predictable format \u2192 SCRIPT (faster, no AI cost, higher frequency)
172
+ - Tasks needing web search, reasoning, summarization \u2192 PROMPT (5-min minimum, uses AI)
173
+ - Dashboard with both types of data \u2192 USE BOTH on the same element
174
+
175
+ Frame HTML example for receiving refresh data (script bindings):
176
+ <script>
177
+ window.addEventListener("jet:refresh", function(e) {
178
+ var d = e.detail; // { price: 71.52, volume: "827K", ... }
179
+ document.getElementById("price").textContent = d.price;
180
+ });
181
+ </script>
182
+
183
+ Jetro SDK available inside frames:
184
+ - __JET.query(sql) \u2014 query local DuckDB cache (returns Promise<rows[]>)
185
+ - __JET.refresh() \u2014 request manual refresh from parent
186
+
187
+ RULES:
188
+ - ALWAYS write HTML files to .jetro/frames/ \u2014 NOT data/, NOT stocks/, NOT any other folder
189
+ - ALWAYS use data.file as the key \u2014 NOT data.src, NOT data.filePath, NOT data.path
190
+ - HTML must be a complete document: <!DOCTYPE html><html><head>...</head><body>...</body></html>
191
+ - ALWAYS use CDN <script src> for chart libraries, NEVER paste/inline library source code
192
+ - Include inline <style> and <script> tags freely for your own code
193
+
194
+ \u2550\u2550\u2550 OTHER TYPES \u2550\u2550\u2550
195
+ note: { title, markdown: "supports **bold** *italic* [links]()" }
196
+ embed: { title?, url: string (external URL to embed in sandboxed iframe) }`,inputSchema:{type:"object",properties:{type:{type:"string",enum:["note","pdf","frame","embed"],description:"Use 'frame' for ALL visual content: charts, tables, dashboards, KPIs, reports, images (full HTML freedom, Plotly traces, or file reference). Use 'note' for markdown text. Use 'embed' for external URLs. Use 'pdf' only for parsed PDF previews."},data:{type:"object",description:"Frames: { title, html: '...', traces?, plotlyLayout?, file?: '.jetro/frames/name.html' }. Notes: { title, markdown }. Embed: { url, title? }."},position:{type:"object",description:"Optional { x, y } position on canvas. Auto-positioned if omitted."},width:{type:"number",description:"Optional width in pixels (default: 340)"},projectSlug:{type:"string",description:"Project slug. Auto-filled from active project canvas if omitted \u2014 pass explicitly to override."},id:{type:"string",description:"Optional element ID. When provided, updates an existing element in-place instead of creating a new one. Use this for re-rendering the same element with fresh data."},refreshBinding:{type:"object",properties:{scriptPath:{type:"string",description:"Workspace-relative path to .py refresh script"},intervalMs:{type:"number",description:"Refresh interval in ms (default 120000 = 2 min)"},bindingType:{type:"string",enum:["script","prompt"],description:"Binding type: 'script' (Python script) or 'prompt' (AI agent prompt). Default: 'script'"},refreshPrompt:{type:"string",description:"For prompt bindings: the natural language prompt the AI agent will execute on each refresh cycle"},elementTitle:{type:"string",description:"For prompt bindings: human-readable element title for agent context wrapping"}},description:"Optional: auto-bind a refresh source to this element for live updates. Script bindings run .py on a timer. Prompt bindings use a headless AI agent."}},required:["type","data"]}},{name:"jet_search",description:"Search for stock/security symbols on NSE/BSE. Returns matching symbols with company names and exchange info. Use this to find the correct ticker symbol before fetching data.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query \u2014 company name or partial ticker (e.g. 'alkem', 'cipla', 'reliance')"},exchange:{type:"string",description:"Exchange filter (default: NSE). Use 'BSE' for Bombay Stock Exchange."},limit:{type:"number",description:"Max results to return (default: 10)"}},required:["query"]}},{name:"jet_canvas",description:`Manage visual canvas panels. Supports element layout, refresh bindings for live auto-updating elements, and multi-canvas management.
197
+
198
+ Actions: list, read, move, resize, delete, arrange, bind, unbind, bindings, trigger, history, restore.
199
+
200
+ \u2550\u2550\u2550 LIST (action='list') \u2550\u2550\u2550
201
+ List all canvases (universal + project-specific) with their IDs and names.
202
+
203
+ \u2550\u2550\u2550 READ (action='read') \u2550\u2550\u2550
204
+ Returns all elements with IDs, types, positions, sizes, titles, and refresh binding info.
205
+ Use this to understand the current layout before moving/resizing.
206
+
207
+ \u2550\u2550\u2550 MOVE (action='move') \u2550\u2550\u2550
208
+ Move an element to a new { x, y } position. Required: elementId, position: { x, y }
209
+
210
+ \u2550\u2550\u2550 RESIZE (action='resize') \u2550\u2550\u2550
211
+ Resize an element. Required: elementId, size: { width, height? }
212
+
213
+ \u2550\u2550\u2550 DELETE (action='delete') \u2550\u2550\u2550
214
+ Remove an element from the canvas. Required: elementId
215
+
216
+ \u2550\u2550\u2550 ARRANGE (action='arrange') \u2550\u2550\u2550
217
+ Batch move + resize multiple elements in one call.
218
+ Required: operations array \u2014 each item: { elementId, position?, size? }
219
+
220
+ \u2550\u2550\u2550 BIND (action='bind') \u2550\u2550\u2550
221
+ Attach a refresh binding to an element for live auto-refresh. Two types:
222
+ SCRIPT: refreshBinding: { bindingType: "script", scriptPath: string, intervalMs?: number }
223
+ Script runs on a timer, outputs JSON \u2192 merged into element.data.
224
+ PROMPT: refreshBinding: { bindingType: "prompt", refreshPrompt: string, intervalMs?: number }
225
+ AI agent re-runs the prompt on a timer (min 5 min). Write the refreshPrompt as a self-contained
226
+ "note to future self" \u2014 what to search/analyze, how to format, which element to update via jet_render.
227
+ Required: elementId, refreshBinding (with scriptPath OR refreshPrompt).
228
+
229
+ \u2550\u2550\u2550 UNBIND (action='unbind') \u2550\u2550\u2550
230
+ Remove refresh binding from an element. Required: elementId
231
+
232
+ \u2550\u2550\u2550 BINDINGS (action='bindings') \u2550\u2550\u2550
233
+ List all refresh bindings on the current canvas.
234
+
235
+ \u2550\u2550\u2550 TRIGGER (action='trigger') \u2550\u2550\u2550
236
+ Manually execute a single element's refresh binding. Required: elementId
237
+
238
+ \u2550\u2550\u2550 HISTORY (action='history') \u2550\u2550\u2550
239
+ List version history for a canvas. Returns timestamps and element counts for up to 20 recent versions.
240
+ Versioning is automatic \u2014 every canvas save creates a snapshot (throttled to 1/min, forced on deletion).
241
+
242
+ \u2550\u2550\u2550 RESTORE (action='restore') \u2550\u2550\u2550
243
+ Restore a canvas to a previous version. Optional: timestamp (epoch ms).
244
+ If timestamp omitted, restores the most recent version with elements.
245
+ Current state is snapshotted before restore (reversible).
246
+
247
+ \u2550\u2550\u2550 DASHBOARD LAYOUT GUIDE \u2550\u2550\u2550
248
+ Canvas origin is top-left (0,0). Y increases downward. Use 20px gaps between elements.
249
+ Standard widths: note=320, frame=500, embed=500
250
+ Row height: ~240px (200px element + 20px gap). Frames: ~420px (400px + 20px gap).
251
+ Grid patterns:
252
+ 2-col (420px wide): x=40, x=480
253
+ 3-col (272px cards): x=40, x=332, x=624
254
+
255
+ TIP: After rendering elements with jet_render, call jet_canvas(action='read') to get their IDs, then use 'arrange' to lay them out.`,inputSchema:{type:"object",properties:{action:{type:"string",enum:["list","read","move","resize","delete","arrange","bind","unbind","bindings","trigger","history","restore"],description:"Canvas operation to perform"},canvasId:{type:"string",description:"Target canvas ID. Omit to use the active/default canvas."},elementId:{type:"string",description:"Target element ID (required for move, resize, delete, bind, unbind, trigger)"},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},description:"New position { x, y } for move action"},size:{type:"object",properties:{width:{type:"number"},height:{type:"number"}},description:"New size { width, height? } for resize action"},operations:{type:"array",items:{type:"object",properties:{elementId:{type:"string"},position:{type:"object",properties:{x:{type:"number"},y:{type:"number"}}},size:{type:"object",properties:{width:{type:"number"},height:{type:"number"}}}},required:["elementId"]},description:"Batch move/resize operations for arrange action"},refreshBinding:{type:"object",properties:{scriptPath:{type:"string",description:"Workspace-relative path to .py refresh script (required for script bindings)"},intervalMs:{type:"number",description:"Refresh interval in ms (default 120000 for scripts, 300000 for prompts)"},sourceDomain:{type:"string",description:"Domain this binding scrapes (e.g. 'trackinsight.com'). Enables pattern graduation for community reuse."},bindingType:{type:"string",enum:["script","prompt"],description:"Binding type: 'script' (Python) or 'prompt' (AI agent). Default: 'script'"},refreshPrompt:{type:"string",description:"For prompt bindings: the natural language prompt the AI agent will execute on each refresh"},elementTitle:{type:"string",description:"For prompt bindings: human-readable element title for agent context"}},description:"For 'bind' action: script path or prompt, refresh interval, and optional metadata. Script bindings run .py on timer. Prompt bindings use headless AI agent (min 5-min interval)."},projectSlug:{type:"string",description:"Project slug \u2014 auto-filled from active project canvas if omitted. Pass explicitly to override. Not used for 'list' action."},timestamp:{type:"number",description:"Version timestamp (epoch ms) for restore action. Omit to restore most recent version."}},required:["action"]}},{name:"jet_parse",description:`Parse documents into structured markdown.
256
+
257
+ Supports: PDF, DOCX, PPTX, XLSX, HTML, EPUB, RTF, EML, images (OCR), and text passthrough (md, txt, csv, json, yaml, xml).
258
+ Output: Markdown file saved to project notes (or .jetro/notes/ if no project).
259
+ Original file copied to project sources directory.
260
+
261
+ Options:
262
+ - ocr: true \u2014 force OCR for scanned PDFs or parse images
263
+ - pages: "1-5" \u2014 extract specific page range (PDF only)
264
+
265
+ Requires Python 3 on the user's machine. Parsing libraries (pymupdf4llm, markitdown, rapidocr) are auto-installed in a managed venv (.jetro/venv/) on first use \u2014 this takes 30-60 seconds and needs internet. Subsequent parses are instant. Text passthrough formats (md, txt, csv, json, yaml, xml) need no Python \u2014 they're read directly.
266
+
267
+ If the first parse fails with a Python error, tell the user: "jet_parse needs Python 3 installed. Install it from python.org or via your package manager, then try again."
268
+
269
+ Example:
270
+ jet_parse({ file: "annual_report.pdf", projectSlug: "cns_pharma", outputName: "alkem_ar_2025" })
271
+ \u2192 Parses PDF, saves to projects/cns_pharma/notes/alkem_ar_2025.md
272
+
273
+ After parsing, read the output markdown to analyze content, extract data, and render findings.`,inputSchema:{type:"object",properties:{file:{type:"string",description:"Path to document (relative to workspace)"},projectSlug:{type:"string",description:"Project to store output in. Auto-filled from active project canvas if omitted \u2014 pass explicitly to override."},outputName:{type:"string",description:"Name for output file (without .md). Defaults to input filename."},options:{type:"object",properties:{ocr:{type:"boolean",description:"Enable OCR for scanned documents"},pages:{type:"string",description:"Page range: '1-5', '3', or 'all'"}}}},required:["file"]}},{name:"jet_share",description:`Share canvas frame elements as interactive web pages viewable in any browser.
274
+
275
+ \u2550\u2550\u2550 ACTIONS \u2550\u2550\u2550
276
+ "create" \u2192 Create a new share from one or more frame elements. Returns { shareId, url }.
277
+ "list" \u2192 List all active shares for the current user.
278
+ "addElement" \u2192 Add a frame element to an existing share (new tab).
279
+ "removeElement" \u2192 Remove an element from a share.
280
+ "pause" \u2192 Pause a share (viewers see last data, no live updates).
281
+ "resume" \u2192 Resume a paused share (re-uploads all live elements).
282
+ "revoke" \u2192 Permanently delete a share (URL stops working).
283
+
284
+ \u2550\u2550\u2550 USAGE \u2550\u2550\u2550
285
+ After creating elements with jet_render, share them:
286
+ jet_share({ action: "create", title: "Q3 Portfolio Review", elementIds: ["elem-123"] })
287
+ \u2192 Returns URL that anyone can open in a browser
288
+
289
+ Share multiple elements as tabs in one URL:
290
+ jet_share({ action: "create", title: "Daily Report", elementIds: ["risk-1", "holdings-2", "perf-3"] })
291
+
292
+ Manage shares:
293
+ jet_share({ action: "list" }) \u2192 All active shares
294
+ jet_share({ action: "pause", shareId: "abc123" }) \u2192 Pause live updates
295
+ jet_share({ action: "revoke", shareId: "abc123" }) \u2192 Delete share permanently`,inputSchema:{type:"object",properties:{action:{type:"string",enum:["create","list","addElement","removeElement","pause","resume","revoke"],description:"Share operation to perform"},title:{type:"string",description:"Share title (required for create action)"},elementIds:{type:"array",items:{type:"string"},description:"Element IDs to share (required for create action)"},shareId:{type:"string",description:"Share ID (required for addElement, removeElement, pause, resume, revoke)"},elementId:{type:"string",description:"Element ID (required for addElement, removeElement)"},canvasId:{type:"string",description:"Target canvas ID. Omit to use the active/default canvas."}},required:["action"]}},{name:"jet_query",description:`Query the local DuckDB cache with read-only SQL.
296
+
297
+ The cache stores fetched financial data (stock_data table) and portfolio holdings (portfolio_holdings table).
298
+ Datasets registered via jet_save(type='datasource') are also queryable as tables.
299
+
300
+ \u2550\u2550\u2550 TABLES \u2550\u2550\u2550
301
+ stock_data: ticker VARCHAR, endpoint VARCHAR, data JSON, fetched_at TIMESTAMP
302
+ portfolio_holdings: portfolio VARCHAR, ticker VARCHAR, name VARCHAR, weight REAL, shares REAL, avg_cost REAL, sector VARCHAR, current_price REAL, current_value REAL, pnl REAL, pnl_pct REAL
303
+ + any registered dataset tables (CSV, Parquet, JSON files)
304
+
305
+ \u2550\u2550\u2550 EXAMPLES \u2550\u2550\u2550
306
+ List all tables: jet_query({ sql: "SELECT table_name FROM information_schema.tables WHERE table_schema = 'main'" })
307
+ Cached tickers: jet_query({ sql: "SELECT DISTINCT ticker FROM stock_data" })
308
+ Portfolio: jet_query({ sql: "SELECT ticker, weight, pnl_pct FROM portfolio_holdings WHERE portfolio = 'my-portfolio' ORDER BY weight DESC" })
309
+ JSON extraction: jet_query({ sql: "SELECT ticker, data->>'revenue' as revenue FROM stock_data WHERE endpoint = '/income-statement'" })
310
+
311
+ \u2550\u2550\u2550 RULES \u2550\u2550\u2550
312
+ Only SELECT, WITH (CTE), DESCRIBE, SUMMARIZE allowed. No writes, no multiple statements.`,inputSchema:{type:"object",properties:{sql:{type:"string",description:"Read-only SQL query (SELECT, WITH, DESCRIBE, SUMMARIZE only)"}},required:["sql"]}},{name:"jet_exec",description:`Execute Python or R code in a sandboxed subprocess.
313
+
314
+ The code runs in the workspace directory with access to:
315
+ - JET_WORKSPACE: workspace root path
316
+ - JET_PROJECT: active project slug (if a project canvas is focused, else unset)
317
+ - JET_DUCKDB_PATH: path to the DuckDB cache file (use with duckdb Python package)
318
+ - JET_API_URL, JET_JWT: for Jetro Data API calls
319
+ - JET_FRAMES_DIR: where to write HTML output files for jet_render(type='frame')
320
+ - PYTHONPATH: includes .jetro/lib/ for shared modules
321
+
322
+ \u2550\u2550\u2550 USE CASES \u2550\u2550\u2550
323
+ - Data transformation and computation
324
+ - Statistical analysis, regressions, backtesting
325
+ - Chart/dashboard HTML generation (write to JET_FRAMES_DIR)
326
+ - Refresh script prototyping
327
+ - File parsing and data wrangling
328
+ - DuckDB queries from Python (import duckdb; db = duckdb.connect(os.environ['JET_DUCKDB_PATH']))
329
+
330
+ \u2550\u2550\u2550 EXAMPLES \u2550\u2550\u2550
331
+ Python:
332
+ jet_exec({ language: "python", code: "import json\\nprint(json.dumps({'result': 42}))" })
333
+
334
+ R:
335
+ jet_exec({ language: "r", code: "cat(jsonlite::toJSON(list(result = 42)))" })
336
+
337
+ \u2550\u2550\u2550 LARGE OUTPUT \u2014 CRITICAL \u2550\u2550\u2550
338
+ stdout is returned as the tool result. If output exceeds ~8 KB it will be auto-truncated.
339
+ For large results, ALWAYS write to a file and print the path:
340
+ df.to_csv(os.path.join(os.environ['JET_WORKSPACE'], '.jetro', 'output', 'result.csv'), index=False)
341
+ print('Saved to .jetro/output/result.csv')
342
+ Or for markdown:
343
+ with open(os.path.join(os.environ['JET_WORKSPACE'], '.jetro', 'output', 'report.md'), 'w') as f:
344
+ f.write(report_text)
345
+ print('Saved to .jetro/output/report.md')
346
+ Then read the file or render it to canvas. NEVER print large DataFrames or raw JSON to stdout.
347
+
348
+ \u2550\u2550\u2550 RULES \u2550\u2550\u2550
349
+ - Code runs with a 60s timeout (configurable up to 120s)
350
+ - stdout is captured as the result; use print/cat for output
351
+ - stderr is returned separately for debugging
352
+ - Prefer .jetro/venv/ Python if available, falls back to system python3
353
+ - Max output buffer: 10 MB`,inputSchema:{type:"object",properties:{language:{type:"string",enum:["python","r"],description:"Script language"},code:{type:"string",description:"Source code to execute"},timeout:{type:"number",description:"Execution timeout in milliseconds (default 300000 = 5 minutes). Increase for long-running scripts."}},required:["language","code"]}},{name:"jet_deploy",description:`Deploy a project as a containerized web app with a public URL.
354
+
355
+ Actions:
356
+ - start: Build Docker image and run container. Requires projects/{slug}/deploy/ with server.py, requirements.txt, Dockerfile.
357
+ - stop: Stop the running container.
358
+ - redeploy: Rebuild image and restart container (picks up code changes).
359
+ - publish: Register a public URL ({slug}.jetro.io) and enable the relay.
360
+ - remove: Stop container, remove image, deregister public URL.
361
+ - status: Check if the app is running.
362
+
363
+ The deploy skill (jet_skill("Deploy App")) teaches you how to write server.py, requirements.txt, and Dockerfile.
364
+ Docker must be installed on the user's machine.`,inputSchema:{type:"object",properties:{action:{type:"string",enum:["start","stop","redeploy","publish","remove","status"],description:"Deploy action to perform"},projectSlug:{type:"string",description:"Project slug to deploy"}},required:["action","projectSlug"]}},{name:"jet_connector",description:`Create, manage, and use data connectors. Connectors are reusable Python modules that connect to external data sources (APIs, databases, spreadsheets, CRMs, etc.).
365
+
366
+ The agent writes the Python client code \u2014 the platform manages auth and credentials securely.
367
+
368
+ \u2550\u2550\u2550 ACTIONS \u2550\u2550\u2550
369
+
370
+ create \u2014 Create a new connector
371
+ Required: name, description, type, auth, clientCode
372
+ Optional: params, methods, requirements, credential
373
+
374
+ The clientCode must define a Client class:
375
+ class Client:
376
+ def __init__(self, config, params, credential):
377
+ # credential is the decrypted secret (API key, token, connection string, etc.)
378
+ self.credential = credential
379
+ # Initialize your client (requests session, DB driver, etc.)
380
+
381
+ def fetch(self, **kwargs):
382
+ # Main data-fetching method \u2014 return JSON-serializable data
383
+ ...
384
+
385
+ Auth methods:
386
+ "api_key" \u2014 API key injected as credential
387
+ "bearer" \u2014 Bearer token injected as credential
388
+ "basic" \u2014 "user:password" injected as credential
389
+ "connection_string" \u2014 Full connection string as credential
390
+ "none" \u2014 No auth needed
391
+
392
+ list \u2014 List all connectors with their configs
393
+ Returns: Array of connector configs (no client code)
394
+
395
+ read \u2014 Read connector config AND client code
396
+ Required: slug
397
+ Returns: { config, clientCode }
398
+
399
+ test \u2014 Test a connector by running its client
400
+ Required: slug
401
+ Executes client.py with a test call and returns success/error
402
+
403
+ delete \u2014 Delete a connector and its stored credential
404
+ Required: slug
405
+
406
+ \u2550\u2550\u2550 EXAMPLE: Google Sheets connector \u2550\u2550\u2550
407
+ jet_connector({
408
+ action: "create",
409
+ name: "Google Sheets",
410
+ type: "spreadsheet",
411
+ description: "Fetch data from Google Sheets via API key",
412
+ auth: { method: "api_key" },
413
+ credential: "AIzaSy...",
414
+ params: {
415
+ spreadsheetId: { type: "string", description: "Google Sheets document ID", required: true }
416
+ },
417
+ methods: {
418
+ fetch: { description: "Fetch sheet data as JSON rows", returns: "list of row dicts",
419
+ params: { sheet: { type: "string", description: "Sheet name", required: false, default: "Sheet1" } } }
420
+ },
421
+ clientCode: "import requests\\n\\nclass Client:\\n def __init__(self, config, params, credential):\\n self.key = credential\\n self.sheet_id = params.get('spreadsheetId')\\n\\n def fetch(self, sheet='Sheet1'):\\n url = f'https://sheets.googleapis.com/v4/spreadsheets/{self.sheet_id}/values/{sheet}?key={self.key}'\\n resp = requests.get(url)\\n resp.raise_for_status()\\n data = resp.json()\\n headers = data['values'][0]\\n return [dict(zip(headers, row)) for row in data['values'][1:]]"
422
+ })
423
+
424
+ \u2550\u2550\u2550 USING CONNECTORS IN SCRIPTS \u2550\u2550\u2550
425
+ In Python refresh scripts or jet_exec code:
426
+ from jet.connectors import use
427
+ sheets = use("google_sheets", spreadsheetId="1abc...")
428
+ data = sheets.fetch(sheet="Revenue")
429
+
430
+ The platform injects credentials as environment variables automatically.
431
+ Connectors persist at .jetro/connectors/{slug}/ and survive extension restarts.`,inputSchema:{type:"object",properties:{action:{type:"string",enum:["create","list","test","delete","read"],description:"Action to perform"},name:{type:"string",description:"Connector name (for create)"},slug:{type:"string",description:"Connector slug (for test/delete/read)"},description:{type:"string",description:"What this connector does (for create)"},type:{type:"string",description:"Connector type: api, spreadsheet, database, crm, mcp, custom"},auth:{type:"object",description:"Auth config: { method: 'api_key'|'bearer'|'basic'|'connection_string'|'none', inject?: 'header'|'query', headerName?: string, queryParam?: string }"},credential:{type:"string",description:"The secret value (API key, token, connection string). Stored securely in OS keychain, never logged or persisted in plain text."},params:{type:"object",description:"Connector parameter schema: { paramName: { type, description, required, default? } }"},methods:{type:"object",description:"Available methods: { methodName: { description, params?, returns } }"},clientCode:{type:"string",description:"Python source code for client.py \u2014 must define a Client class"},requirements:{type:"string",description:"Python dependencies (pip format, one per line, e.g. 'requests>=2.31.0')"}},required:["action"]}}];async function bP(e){let t=await pf("/api/data",{provider:e.provider,endpoint:e.endpoint,params:e.params}),r=v.join(w,".jetro","cache");await Y(r);let n=`${e.provider}_${Ss(e.endpoint)}`;return await $.writeFile(v.join(r,`${n}.json`),JSON.stringify(t,null,2)),JSON.stringify(t,null,2)}async function xP(e){return(await pf("/api/skill",{name:e.name})).prompt}async function wP(e){let{name:t}=e,r=v.join(v.dirname(v.dirname(__dirname)),"agent","templates");try{let a=await $.readdir(r);for(let s of a)if(s.endsWith(".json"))try{let c=await $.readFile(v.join(r,s),"utf-8"),u=JSON.parse(c);if(u.name===t)return u.content}catch{}}catch{}let n=t.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,""),i=v.join(w,".jetro"),o=v.join(i,"templates",`${n}.html`);try{return await $.readFile(o,"utf-8")}catch{}throw new Error(`Template not found: ${t}`)}function kP(e){return typeof e.file=="string"&&e.file?e.file:typeof e.filePath=="string"&&e.filePath?e.filePath:typeof e.src=="string"&&e.src&&!e.src.startsWith("http")&&(e.src.includes("/")||e.src.includes("."))?e.src:null}function ks(){try{return JSON.parse(vt.readFileSync(v.join(w,".jetro","context.json"),"utf-8")).activeProjectSlug||null}catch{return null}}var Ne=0;async function SP(e){Ne++;let t=e.id||`mcp-${Date.now()}-${Ne}`,r=typeof e.data=="string"?(()=>{try{return JSON.parse(e.data)}catch{return{html:e.data}}})():e.data;if(e.type==="frame"){let p=kP(r);if(p){let h=v.resolve(w,p);st(h,w);try{let g=await $.readFile(h,"utf-8");r={...r,html:g,file:void 0,filePath:void 0},typeof r.src=="string"&&!r.src.startsWith("http")&&(r={...r,src:void 0})}catch{throw new Error(`Frame file not found: ${p}`)}}}let n={frame:500,embed:500},i={frame:400,embed:350},o=n[e.type]||340,a=i[e.type]||200;e.type==="frame"&&!r.html&&console.error(`[jet_render] WARNING: Frame "${r.title||t}" has no HTML content. Keys in data: ${Object.keys(r).join(", ")}`);let s=a;if(e.type==="frame"&&typeof r.html=="string"){let p=r.html.split(`
432
+ `).length;p>200&&(s=Math.min(p*2,2e3))}let c={id:t,type:e.type,data:r,position:e.position||{x:40+Ne%3*360,y:40+Math.floor(Ne/3)*300},size:{width:e.width||o,height:s},config:{width:e.width||o,projectSlug:e.projectSlug}};if(e.refreshBinding?.scriptPath||e.refreshBinding?.refreshPrompt){let p={bindingType:e.refreshBinding.bindingType||(e.refreshBinding.refreshPrompt?"prompt":"script"),intervalMs:e.refreshBinding.intervalMs||(e.refreshBinding.refreshPrompt?3e5:12e4)};e.refreshBinding.scriptPath&&(p.scriptPath=e.refreshBinding.scriptPath),e.refreshBinding.refreshPrompt&&(p.refreshPrompt=e.refreshBinding.refreshPrompt),e.refreshBinding.elementTitle&&(p.elementTitle=e.refreshBinding.elementTitle),e.refreshBinding.sourceDomain&&(p.sourceDomain=e.refreshBinding.sourceDomain),c.refreshBinding=p}let u=v.join(w,".jetro","render_queue");if(await Y(u),await $.writeFile(v.join(u,`${t}.json`),JSON.stringify(c,null,2)),e.projectSlug){let p=at(e.projectSlug);if(!p)throw new Error("Invalid projectSlug");let h=v.join(w,".jetro","projects",p,"canvas.json");st(h,w);let g;try{let _=await $.readFile(h,"utf-8");g=JSON.parse(_)}catch{g={name:"Research Board",elements:[],edges:[],viewport:{x:0,y:0,zoom:1}}}if(g.elements.push({...c,connections:[]}),e.refreshBinding?.scriptPath||e.refreshBinding?.refreshPrompt){g.refreshBindings||(g.refreshBindings=[]);let _={elementId:t,bindingType:e.refreshBinding.bindingType||(e.refreshBinding.refreshPrompt?"prompt":"script"),intervalMs:e.refreshBinding.intervalMs||(e.refreshBinding.refreshPrompt?3e5:12e4),enabled:!0,createdAt:new Date().toISOString()};e.refreshBinding.scriptPath&&(_.scriptPath=e.refreshBinding.scriptPath),e.refreshBinding.refreshPrompt&&(_.refreshPrompt=e.refreshBinding.refreshPrompt),e.refreshBinding.elementTitle&&(_.elementTitle=e.refreshBinding.elementTitle),g.refreshBindings.push(_)}await $.writeFile(h,JSON.stringify(g,null,2))}let l=e.refreshBinding?.bindingType||(e.refreshBinding?.refreshPrompt?"prompt":"script"),d=e.refreshBinding?.scriptPath||e.refreshBinding?.refreshPrompt?` [${l==="prompt"?"AI LIVE":"LIVE"}: ${e.refreshBinding.scriptPath||"prompt"} every ${(e.refreshBinding.intervalMs||(l==="prompt"?3e5:12e4))/1e3}s]`:"",f=e.id?" (in-place update)":"";return`Rendered ${e.type} "${e.data.title||t}" to canvas (id: ${t})${f}${d}`}async function zP(e){let t=await pf("/api/data",{provider:"fmp",endpoint:"/search",params:{query:e.query,limit:String(e.limit??10),...e.exchange?{exchange:e.exchange}:{}}});return JSON.stringify(t,null,2)}async function P_(e){let{action:t,projectSlug:r}=e;console.error(`[jet_canvas] action=${t} canvasId=${e.canvasId??"(none)"} projectSlug=${r??"(none)"} elementId=${e.elementId??"(none)"} WORKSPACE=${w}`);function n(){let a=v.join(w,".jetro","canvas-registry.json");console.error(`[jet_canvas] readRegistry path=${a}`);try{let s=vt.readFileSync(a,"utf-8"),c=JSON.parse(s),u=Array.isArray(c)?c:c.canvases||[];return console.error(`[jet_canvas] readRegistry found ${u.length} entries: ${u.map(l=>l.id).join(", ")}`),u}catch(s){return console.error(`[jet_canvas] readRegistry FAILED: ${s}`),[]}}function i(a){return a.projectSlug?v.join(w,"projects",at(a.projectSlug),"canvases",`${a.id}.json`):v.join(w,".jetro","canvases",`${a.id}.json`)}function o(){let a;if(e.canvasId){let u=n().find(l=>l.id===e.canvasId);u?a=i(u):a=v.join(w,".jetro","canvases",`${e.canvasId}.json`)}else if(r){let u=n().find(l=>l.projectSlug===r);u?a=i(u):a=v.join(w,"projects",at(r),"canvases",`${r}.json`)}else{let c=n();c.length>0?a=i(c[0]):a=v.join(w,".jetro","canvas.json")}let s=vt.existsSync(a);return console.error(`[jet_canvas] resolveCanvasPath \u2192 ${a} (exists=${s})`),a}switch(t){case"list":{let a=n(),s=null;try{s=JSON.parse(vt.readFileSync(v.join(w,".jetro","context.json"),"utf-8")).activeCanvasId||null}catch{}if(a.length>0)return JSON.stringify({canvases:a.map(u=>({id:u.id,name:u.name||u.id,projectSlug:u.projectSlug,isActive:u.id===s}))},null,2);let c=v.join(w,".jetro","canvas.json");try{return await $.access(c),JSON.stringify({canvases:[{id:"default",name:"Research Board",isActive:s==="default"}]},null,2)}catch{return JSON.stringify({canvases:[]},null,2)}}case"read":{let a=o();r&&st(a,w);try{let s=await $.readFile(a,"utf-8");console.error(`[jet_canvas] read: file size=${s.length} bytes`);let c=JSON.parse(s),u=c.refreshBindings||[];console.error(`[jet_canvas] read: elements=${(c.elements||[]).length} bindings=${u.length} keys=${Object.keys(c).join(",")}`);let l=(c.elements||[]).map(f=>{let p=f.data||{},h=u.find(g=>g.elementId===f.id);return{id:f.id,type:f.type,position:f.position,size:f.size,title:p.title||p.name||p.ticker||f.type,refreshBinding:h?{scriptPath:h.scriptPath,intervalMs:h.intervalMs,enabled:h.enabled,lastRun:h.lastRun}:void 0}}),d=c.c2;return JSON.stringify({name:c.name||"Research Board",elementCount:l.length,elements:l,edges:c.edges||[],c2:d?{enabled:!!d.enabled,wireCount:(d.wires||[]).length}:void 0},null,2)}catch{return JSON.stringify({name:"Research Board",elementCount:0,elements:[],edges:[]})}}case"move":{if(!e.elementId)throw new Error("elementId is required for move");if(!e.position)throw new Error("position { x, y } is required for move");let a=`cmd-${Date.now()}-${++Ne}`,s={command:"move",elementId:e.elementId,position:e.position,projectSlug:r},c=v.join(w,".jetro","render_queue");return await Y(c),await $.writeFile(v.join(c,`${a}.json`),JSON.stringify(s)),`Moved element ${e.elementId} to (${e.position.x}, ${e.position.y})`}case"resize":{if(!e.elementId)throw new Error("elementId is required for resize");if(!e.size)throw new Error("size { width, height? } is required for resize");let a=`cmd-${Date.now()}-${++Ne}`,s={command:"resize",elementId:e.elementId,size:e.size,projectSlug:r},c=v.join(w,".jetro","render_queue");return await Y(c),await $.writeFile(v.join(c,`${a}.json`),JSON.stringify(s)),`Resized element ${e.elementId} to ${e.size.width}${e.size.height?`\xD7${e.size.height}`:""}`}case"delete":{if(!e.elementId)throw new Error("elementId is required for delete");let a=`cmd-${Date.now()}-${++Ne}`,s={command:"delete",elementId:e.elementId,projectSlug:r},c=v.join(w,".jetro","render_queue");return await Y(c),await $.writeFile(v.join(c,`${a}.json`),JSON.stringify(s)),`Deleted element ${e.elementId} from canvas`}case"arrange":{if(!e.operations||e.operations.length===0)throw new Error("operations array is required for arrange");let a=`cmd-${Date.now()}-${++Ne}`,s={command:"arrange",operations:e.operations,projectSlug:r},c=v.join(w,".jetro","render_queue");return await Y(c),await $.writeFile(v.join(c,`${a}.json`),JSON.stringify(s)),`Arranged ${e.operations.length} elements on canvas`}case"bind":{if(!e.elementId)throw new Error("bind requires elementId");let a=e.refreshBinding?.bindingType==="prompt"||!!e.refreshBinding?.refreshPrompt;if(!a&&!e.refreshBinding?.scriptPath)throw new Error("bind requires refreshBinding.scriptPath (for script bindings) or refreshBinding.refreshPrompt (for prompt bindings)");let s=o(),c;try{c=JSON.parse(await $.readFile(s,"utf-8"))}catch{throw new Error("Canvas not found \u2014 render elements first")}let u=a?"prompt":"script",l={elementId:e.elementId,bindingType:u,intervalMs:e.refreshBinding.intervalMs||(a?3e5:12e4),enabled:!0,createdAt:new Date().toISOString()};e.refreshBinding.scriptPath&&(l.scriptPath=e.refreshBinding.scriptPath),e.refreshBinding.refreshPrompt&&(l.refreshPrompt=e.refreshBinding.refreshPrompt),e.refreshBinding.elementTitle&&(l.elementTitle=e.refreshBinding.elementTitle),e.refreshBinding.sourceDomain&&(l.sourceDomain=e.refreshBinding.sourceDomain,l.consecutiveSuccesses=0,l.patternSubmitted=!1);let d=c.refreshBindings||[],f=d.findIndex(E=>E.elementId===e.elementId&&(E.bindingType||"script")===u);f>=0?d[f]=l:d.push(l),c.refreshBindings=d,await $.writeFile(s,JSON.stringify(c,null,2));let p=!1;if(l.scriptPath){let E=v.join(w,l.scriptPath);try{let I=await $.readFile(E,"utf-8");p=/import\s+(playwright|bs4|beautifulsoup4|lxml|selenium)|from\s+(playwright|bs4|beautifulsoup4|lxml)/.test(I)}catch{}}let h=v.join(w,".jetro","venv","bin","python3"),g=await $.access(h).then(()=>!0).catch(()=>!1),_=`cmd-${Date.now()}-${++Ne}`,k=v.join(w,".jetro","render_queue");if(await Y(k),await $.writeFile(v.join(k,`${_}.json`),JSON.stringify({command:"bind",elementId:e.elementId,refreshBinding:l,projectSlug:r})),p&&!g){let E=`cmd-${Date.now()}-${++Ne}`;await $.writeFile(v.join(k,`${E}.json`),JSON.stringify({command:"setupVenv"}))}return JSON.stringify({bound:e.elementId,bindingType:l.bindingType,scriptPath:l.scriptPath,refreshPrompt:l.refreshPrompt,intervalMs:l.intervalMs,needsVenv:p&&!g})}case"unbind":{if(!e.elementId)throw new Error("unbind requires elementId");let a=o(),s;try{s=JSON.parse(await $.readFile(a,"utf-8"))}catch{throw new Error("Canvas not found")}let c=s.refreshBindings||[];s.refreshBindings=c.filter(d=>d.elementId!==e.elementId),await $.writeFile(a,JSON.stringify(s,null,2));let u=`cmd-${Date.now()}-${++Ne}`,l=v.join(w,".jetro","render_queue");return await Y(l),await $.writeFile(v.join(l,`${u}.json`),JSON.stringify({command:"unbind",elementId:e.elementId,projectSlug:r})),JSON.stringify({unbound:e.elementId})}case"bindings":{let a=o();try{let s=JSON.parse(await $.readFile(a,"utf-8"));return JSON.stringify({bindings:s.refreshBindings||[]},null,2)}catch{return JSON.stringify({bindings:[]})}}case"trigger":{if(!e.elementId)throw new Error("trigger requires elementId");let a=`cmd-${Date.now()}-${++Ne}`,s=v.join(w,".jetro","render_queue");return await Y(s),await $.writeFile(v.join(s,`${a}.json`),JSON.stringify({command:"trigger",elementId:e.elementId,projectSlug:r})),JSON.stringify({triggered:e.elementId})}case"history":{let a=n(),s;if(e.canvasId?s=a.find(u=>u.id===e.canvasId):r?s=a.find(u=>u.projectSlug===r):s=a[0],!s)return JSON.stringify({versions:[],error:"Canvas not found"});let c=s.projectSlug?v.join(w,"projects",at(s.projectSlug),"canvases",`${s.id}.history`):v.join(w,".jetro","canvases",`${s.id}.history`);try{let u=(await $.readdir(c)).filter(d=>d.startsWith("v_")&&d.endsWith(".json")).sort().reverse(),l=[];for(let d of u.slice(0,20)){let f=d.match(/v_(\d+)\.json/);if(!f)continue;let p=parseInt(f[1],10);try{let h=await $.readFile(v.join(c,d),"utf-8"),g=JSON.parse(h);l.push({timestamp:p,date:new Date(p).toISOString(),elementCount:(g.elements||[]).length,edgeCount:(g.edges||[]).length})}catch{l.push({timestamp:p,date:new Date(p).toISOString(),elementCount:"?",edgeCount:"?"})}}return JSON.stringify({canvasId:s.id,versions:l},null,2)}catch{return JSON.stringify({canvasId:s.id,versions:[]})}}case"restore":{let a=n(),s;if(e.canvasId?s=a.find(u=>u.id===e.canvasId):r?s=a.find(u=>u.projectSlug===r):s=a[0],!s)throw new Error("Canvas not found");let c=s.projectSlug?v.join(w,"projects",at(s.projectSlug),"canvases",`${s.id}.history`):v.join(w,".jetro","canvases",`${s.id}.history`);if(e.timestamp){let u=v.join(c,`v_${e.timestamp}.json`);try{let l=await $.readFile(u,"utf-8"),d=JSON.parse(l),f=i(s);try{let g=await $.readFile(f,"utf-8"),_=JSON.parse(g);_.elements&&_.elements.length>0&&(await Y(c),await $.writeFile(v.join(c,`v_${Date.now()}.json`),g))}catch{}await $.writeFile(f,JSON.stringify(d,null,2));let p=`cmd-${Date.now()}-${++Ne}`,h=v.join(w,".jetro","render_queue");return await Y(h),await $.writeFile(v.join(h,`${p}.json`),JSON.stringify({command:"restore",canvasId:s.id,projectSlug:s.projectSlug||void 0})),JSON.stringify({restored:!0,canvasId:s.id,timestamp:e.timestamp,elementCount:(d.elements||[]).length})}catch{throw new Error(`Version v_${e.timestamp} not found`)}}else{try{let u=(await $.readdir(c)).filter(l=>l.startsWith("v_")&&l.endsWith(".json")).sort().reverse();for(let l of u){let d=await $.readFile(v.join(c,l),"utf-8"),f=JSON.parse(d);if(f.elements&&f.elements.length>0){let p=l.match(/v_(\d+)\.json/),h=p?parseInt(p[1],10):0;return e.timestamp=h,P_(e)}}}catch{}throw new Error("No version with elements found in history")}}case"enableC2":case"disableC2":{let a=o(),s;try{s=JSON.parse(await $.readFile(a,"utf-8"))}catch{throw new Error("Canvas not found \u2014 create it first")}let u=n().find(h=>e.canvasId?h.id===e.canvasId:r?h.projectSlug===r:!1);if(!u?.projectSlug)throw new Error("C2 mode is only available on project canvases");let l=t==="enableC2",d=s.c2||{};d.enabled=l,l&&!d.wires&&(d.wires=[]),s.c2=d,await $.writeFile(a,JSON.stringify(s,null,2));let f=`cmd-${Date.now()}-${++Ne}`,p=v.join(w,".jetro","render_queue");return await Y(p),await $.writeFile(v.join(p,`${f}.json`),JSON.stringify({command:"c2Toggle",canvasId:u.id,enabled:l,projectSlug:u.projectSlug})),JSON.stringify({c2Enabled:l,canvasId:u.id})}case"addWire":{if(!e.sourceId)throw new Error("addWire requires sourceId");if(!e.targetId)throw new Error("addWire requires targetId");if(!e.channel)throw new Error("addWire requires channel");let a=o(),s;try{s=JSON.parse(await $.readFile(a,"utf-8"))}catch{throw new Error("Canvas not found")}let c=s.c2||{};if(!c.enabled)throw new Error("C2 mode is not enabled on this canvas \u2014 call enableC2 first");let u=c.wires||[],l=`wire-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,d={id:l,sourceId:e.sourceId,targetId:e.targetId,channel:e.channel,bidirectional:e.bidirectional||!1};u.push(d),c.wires=u,s.c2=c;let f=s.edges||[];f.push({id:l,source:e.sourceId,target:e.targetId,type:"wire",data:{channel:e.channel,bidirectional:e.bidirectional||!1}}),s.edges=f,await $.writeFile(a,JSON.stringify(s,null,2));let p=`cmd-${Date.now()}-${++Ne}`,h=v.join(w,".jetro","render_queue");return await Y(h),await $.writeFile(v.join(h,`${p}.json`),JSON.stringify({command:"addWire",canvasId:e.canvasId,wire:d,projectSlug:r})),JSON.stringify({wireId:l,channel:e.channel,sourceId:e.sourceId,targetId:e.targetId})}case"removeWire":{if(!e.wireId)throw new Error("removeWire requires wireId");let a=o(),s;try{s=JSON.parse(await $.readFile(a,"utf-8"))}catch{throw new Error("Canvas not found")}let c=s.c2||{},u=c.wires||[];c.wires=u.filter(p=>p.id!==e.wireId),s.c2=c;let l=s.edges||[];s.edges=l.filter(p=>p.id!==e.wireId),await $.writeFile(a,JSON.stringify(s,null,2));let d=`cmd-${Date.now()}-${++Ne}`,f=v.join(w,".jetro","render_queue");return await Y(f),await $.writeFile(v.join(f,`${d}.json`),JSON.stringify({command:"removeWire",canvasId:e.canvasId,wireId:e.wireId,projectSlug:r})),JSON.stringify({removed:e.wireId})}case"listWires":{let a=o();try{let c=JSON.parse(await $.readFile(a,"utf-8")).c2||{};return JSON.stringify({c2Enabled:!!c.enabled,wires:c.wires||[],framePorts:c.framePorts||{}},null,2)}catch{return JSON.stringify({c2Enabled:!1,wires:[],framePorts:{}})}}default:throw new Error(`Unknown canvas action: ${t}`)}}async function IP(e){let t=v.join(w,".jetro"),r=Ss(e.name),n;switch(e.type){case"stock":{let i=at(e.name),o=at(e.payload.dataType??"profile");if(!i||!o)throw new Error("Invalid ticker or dataType");let a=v.join(w,"data","stocks",i);await Y(a),n=v.join(a,`${o}.json`),st(n,w);break}case"list":{let i=v.join(w,"data","lists");if(await Y(i),n=v.join(i,`${r}.json`),!e.payload.tickers&&Array.isArray(e.payload.stocks)){let o=e.payload.stocks;e.payload.tickers=o.map(a=>typeof a=="string"?a:a?.ticker||"").filter(Boolean)}e.payload.name||(e.payload.name=e.name),e.payload.createdAt||(e.payload.createdAt=new Date().toISOString()),e.payload.refreshable===void 0&&(e.payload.refreshable=!!(e.payload.criteria||e.payload.recipeSlug||e.payload.scriptPath)),!e.payload.refreshInterval&&e.payload.refreshable&&(e.payload.refreshInterval="manual"),e.payload.columns&&!e.payload.refreshable&&(e.payload.refreshable=!0,e.payload.refreshInterval||(e.payload.refreshInterval="manual"));try{let o=await $.readFile(v.join(w,"data","lists",`${r}.json`),"utf-8"),a=JSON.parse(o);!e.payload.canvasElementId&&a.canvasElementId&&(e.payload.canvasElementId=a.canvasElementId),!e.payload.thesis&&a.thesis&&(e.payload.thesis=a.thesis),!e.payload.columns&&a.columns&&(e.payload.columns=a.columns),!e.payload.lastRefreshed&&a.lastRefreshed&&(e.payload.lastRefreshed=a.lastRefreshed)}catch{}break}case"project":{let i=v.join(w,"projects",r);await Y(i),await Y(v.join(i,"notes")),await Y(v.join(i,"sources")),n=v.join(i,"project.json");try{let o=await $.readFile(n,"utf-8"),a=JSON.parse(o);for(let s of["linkedConnections","linkedTemplates","linkedRecipes","securities","sources"])!e.payload[s]&&a[s]&&(e.payload[s]=a[s])}catch{}break}case"preference":{await Y(t),n=v.join(t,"config.yaml");break}case"element":{let i=v.join(t,"elements");await Y(i),n=v.join(i,`${r}.json`);break}case"recipe":{let i=v.join(t,"recipes");await Y(i),n=v.join(i,`${r}.json`);break}case"datasource":{let i=v.join(t,"datasources");await Y(i),n=v.join(i,`${r}.json`);break}case"portfolio":{let i=v.join(w,"projects",r);await Y(i),n=v.join(i,"portfolio.json");let o=v.join(i,"project.json");try{await $.access(o)}catch{let a={name:e.name,slug:r,status:"active",mode:"portfolio",securities:[],sources:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};await $.writeFile(o,JSON.stringify(a,null,2))}break}case"template":{let i=v.join(t,"templates");await Y(i),n=v.join(i,`${r}.html`);break}default:{let i=at(e.type);if(!i)throw new Error("Invalid save type");let o=v.join(t,i);await Y(o),n=v.join(o,`${r}.json`)}}return st(n,w),await $.writeFile(n,JSON.stringify(e.payload,null,2)),`Saved ${e.type} "${e.name}" \u2192 ${v.relative(w,n)}`}var S_=new Set([".pdf",".docx",".doc",".pptx",".ppt",".xlsx",".xls",".html",".htm",".epub",".rtf",".eml",".msg",".png",".jpg",".jpeg",".tiff",".bmp",".webp",".md",".txt",".csv",".json",".yaml",".yml",".xml"]),jP=new Set([".md",".txt",".csv",".json",".yaml",".yml",".xml"]),PP={".pdf":"pdf",".docx":"docx",".doc":"docx",".pptx":"pptx",".ppt":"pptx",".xlsx":"xlsx",".xls":"xlsx",".html":"html",".htm":"html",".epub":"epub",".rtf":"rtf",".eml":"email",".msg":"email",".png":"image",".jpg":"image",".jpeg":"image",".tiff":"image",".bmp":"image",".webp":"image",".md":"text",".txt":"text",".csv":"text",".json":"text",".yaml":"text",".yml":"text",".xml":"text"},TP=`
433
+ import sys, json, os
434
+
435
+ def parse_page_range(spec, total):
436
+ if not spec or spec == "all":
437
+ return list(range(total))
438
+ pages = set()
439
+ for part in spec.split(","):
440
+ part = part.strip()
441
+ if "-" in part:
442
+ start, end = part.split("-", 1)
443
+ start = max(1, int(start))
444
+ end = min(total, int(end))
445
+ pages.update(range(start - 1, end))
446
+ else:
447
+ p = int(part)
448
+ if 1 <= p <= total:
449
+ pages.add(p - 1)
450
+ return sorted(pages)
451
+
452
+ def parse_pdf(file_path, options):
453
+ import pymupdf
454
+ import pymupdf4llm
455
+
456
+ doc = pymupdf.open(file_path)
457
+ page_count = len(doc)
458
+
459
+ pages = None
460
+ if options.get("pages"):
461
+ pages = parse_page_range(options["pages"], page_count)
462
+
463
+ md = pymupdf4llm.to_markdown(file_path, pages=pages)
464
+
465
+ table_count = 0
466
+ for page in doc:
467
+ try:
468
+ tables = page.find_tables()
469
+ table_count += len(tables.tables)
470
+ except Exception:
471
+ pass
472
+ doc.close()
473
+
474
+ title = os.path.splitext(os.path.basename(file_path))[0]
475
+ return md, {"title": title, "pages": page_count, "tables": table_count}
476
+
477
+ def parse_pdf_ocr(file_path, options):
478
+ import pymupdf
479
+ from rapidocr_onnxruntime import RapidOCR
480
+
481
+ ocr = RapidOCR()
482
+ doc = pymupdf.open(file_path)
483
+ page_count = len(doc)
484
+ pages = parse_page_range(options.get("pages"), page_count) if options.get("pages") else range(page_count)
485
+
486
+ text_parts = []
487
+ for page_num in pages:
488
+ page = doc[page_num]
489
+ text = page.get_text().strip()
490
+ if len(text) > 50:
491
+ text_parts.append(text)
492
+ else:
493
+ pix = page.get_pixmap(dpi=300)
494
+ img_bytes = pix.tobytes("png")
495
+ result, _ = ocr(img_bytes)
496
+ if result:
497
+ text_parts.append("\\n".join([line[1] for line in result]))
498
+
499
+ doc.close()
500
+ md = "\\n\\n---\\n\\n".join(text_parts)
501
+ title = os.path.splitext(os.path.basename(file_path))[0]
502
+ return md, {"title": title, "pages": page_count, "tables": 0}
503
+
504
+ def parse_office(file_path, options):
505
+ from markitdown import MarkItDown
506
+
507
+ mid = MarkItDown()
508
+ result = mid.convert(file_path)
509
+ md = result.text_content
510
+ title = getattr(result, "title", "") or os.path.splitext(os.path.basename(file_path))[0]
511
+ return md, {"title": title, "pages": None, "tables": 0}
512
+
513
+ def parse_image_ocr(file_path, options):
514
+ from rapidocr_onnxruntime import RapidOCR
515
+
516
+ ocr = RapidOCR()
517
+ result, _ = ocr(file_path)
518
+ if result:
519
+ md = "\\n".join([line[1] for line in result])
520
+ else:
521
+ md = "(No text detected in image)"
522
+ title = os.path.splitext(os.path.basename(file_path))[0]
523
+ return md, {"title": title, "pages": None, "tables": 0}
524
+
525
+ def main():
526
+ file_path = sys.argv[1]
527
+ options = json.loads(sys.argv[2]) if len(sys.argv) > 2 else {}
528
+ ext = os.path.splitext(file_path)[1].lower()
529
+ file_size = os.path.getsize(file_path)
530
+
531
+ PDF_EXTS = {".pdf"}
532
+ OFFICE_EXTS = {".docx", ".doc", ".pptx", ".ppt", ".xlsx", ".xls", ".html", ".htm", ".epub", ".rtf", ".eml", ".msg"}
533
+ IMAGE_EXTS = {".png", ".jpg", ".jpeg", ".tiff", ".bmp", ".webp"}
534
+
535
+ try:
536
+ if ext in PDF_EXTS:
537
+ if options.get("ocr"):
538
+ md, meta = parse_pdf_ocr(file_path, options)
539
+ else:
540
+ md, meta = parse_pdf(file_path, options)
541
+ elif ext in OFFICE_EXTS:
542
+ md, meta = parse_office(file_path, options)
543
+ elif ext in IMAGE_EXTS:
544
+ md, meta = parse_image_ocr(file_path, options)
545
+ else:
546
+ print(json.dumps({"error": "Unsupported format: " + ext}))
547
+ sys.exit(1)
548
+ except ImportError as e:
549
+ module = str(e).split("'")[1] if "'" in str(e) else str(e)
550
+ pkg_map = {
551
+ "pymupdf4llm": "pymupdf4llm", "fitz": "pymupdf", "pymupdf": "pymupdf",
552
+ "markitdown": "markitdown[docx,pptx,xlsx]",
553
+ "rapidocr_onnxruntime": "rapidocr-onnxruntime",
554
+ }
555
+ pkg = pkg_map.get(module, module)
556
+ print(json.dumps({"error": "Missing library: " + module + ". Install with: pip install " + pkg}))
557
+ sys.exit(1)
558
+
559
+ word_count = len(md.split()) if md else 0
560
+ meta["wordCount"] = word_count
561
+ meta["fileSize"] = file_size
562
+ meta.setdefault("title", "")
563
+ meta.setdefault("pages", None)
564
+ meta.setdefault("tables", 0)
565
+
566
+ print(json.dumps({"markdown": md, "meta": meta}))
567
+
568
+ if __name__ == "__main__":
569
+ main()
570
+ `.trim();async function EP(e){let{action:t,projectSlug:r}=e;if(!r)throw new Error("projectSlug is required");let n=v.join(w,".jetro","render_queue");await Y(n);let i=`deploy-${Date.now()}`,o={command:"deploy",action:t,projectSlug:r,id:i};await $.writeFile(v.join(n,`${i}.json`),JSON.stringify(o,null,2));let a=v.join(n,`result-${i}.json`),s=t==="start"||t==="redeploy"?3e5:3e4,c=500,u=0;for(;u<s;){await new Promise(l=>setTimeout(l,c)),u+=c;try{let l=await $.readFile(a,"utf-8");try{await $.unlink(a)}catch{}return l}catch{}}return JSON.stringify({error:"Deploy command timed out"})}async function OP(e){let t=`share-${Date.now()}-${++Ne}`,r=e.canvasId;if(!r)try{let a=v.join(w,".jetro","canvas-registry.json"),s=vt.readFileSync(a,"utf-8"),c=JSON.parse(s),u=Array.isArray(c)?c:c.canvases||[];u.length>0&&(r=u[0].id)}catch{}let n={command:"share",action:e.action,cmdId:t,canvasId:r};e.title&&(n.title=e.title),e.elementIds&&(n.elementIds=e.elementIds),e.shareId&&(n.shareId=e.shareId),e.elementId&&(n.elementId=e.elementId);let i=v.join(w,".jetro","render_queue");await Y(i),await $.writeFile(v.join(i,`${t}.json`),JSON.stringify(n));let o=v.join(i,`result-${t}.json`);for(let a=0;a<30;a++){await new Promise(s=>setTimeout(s,200));try{let s=await $.readFile(o,"utf-8");return await $.unlink(o).catch(()=>{}),s}catch{}}return JSON.stringify({error:"Share command timed out \u2014 is the extension running?"})}async function NP(e){let{file:t,projectSlug:r,outputName:n,options:i}=e,o=v.isAbsolute(t)?t:v.resolve(w,t);st(o,w);let a=v.extname(o).toLowerCase();if(!S_.has(a))throw new Error(`Unsupported format: ${a}. Supported: ${[...S_].join(", ")}`);try{await $.access(o)}catch{throw new Error(`File not found: ${t}`)}let s=PP[a]||"unknown",c=n||v.basename(o,a),u=v.basename(o),l;if(r){let we=at(r);l=v.join(w,"projects",we,"sources")}else l=v.join(w,".jetro","sources");await Y(l);let d=v.join(l,u);if(st(d,w),await $.copyFile(o,d),jP.has(a)){let we=await $.readFile(o,"utf-8"),Ke=we.split(/\s+/).filter(Boolean).length,ze=await $.stat(o),ke;if(r){let Dr=at(r);ke=v.join(w,"projects",Dr,"notes")}else ke=v.join(w,".jetro","notes");await Y(ke);let Gt=v.join(ke,`${c}.md`);if(st(Gt,w),await $.writeFile(Gt,we),r){let Dr=at(r),ho=v.join(w,"projects",Dr,"project.json");try{let T_=await $.readFile(ho,"utf-8"),jn=JSON.parse(T_);jn.sources&&!jn.sources.includes(u)&&(jn.sources.push(u),jn.updatedAt=new Date().toISOString(),await $.writeFile(ho,JSON.stringify(jn,null,2)))}catch{}}return JSON.stringify({outputPath:v.relative(w,Gt),sourcePath:v.relative(w,d),title:c,format:s,wordCount:Ke,fileSize:ze.size},null,2)}let{exec:f}=await import("node:child_process"),p=v.join(w,".jetro","venv","bin","python3"),h="python3";try{await $.access(p),h=p}catch{}try{await new Promise((we,Ke)=>{f(`"${h}" -c "import pymupdf"`,{timeout:5e3},ze=>ze?Ke(ze):we())})}catch{let we=v.join(w,".jetro","venv","bin","pip");try{await $.access(we),await new Promise((Ke,ze)=>{f(`"${we}" install pymupdf pymupdf4llm "markitdown[docx,pptx,xlsx]" rapidocr-onnxruntime`,{timeout:12e4,cwd:w},ke=>ke?ze(ke):Ke())})}catch{}}let g=v.join(w,".jetro","scripts");await Y(g);let _=v.join(g,"_jet_parse_runner.py");await $.writeFile(_,TP);let k=JSON.stringify(i||{}),E=await new Promise((we,Ke)=>{f(`"${h}" "${_}" "${o}" '${k}'`,{cwd:w,timeout:12e4,maxBuffer:10*1024*1024,env:{...process.env}},(ze,ke,Gt)=>{ze?Ke(new Error(`Parse failed: ${Gt||ze.message}`)):we(ke)})}),I;try{I=JSON.parse(E.trim())}catch{throw new Error(`Parse script returned invalid JSON. Raw output:
571
+ `+E.substring(0,500))}if(I.error)throw new Error(I.error);if(!I.markdown)throw new Error("Parse script returned empty markdown");let A;if(r){let we=at(r);A=v.join(w,"projects",we,"notes")}else A=v.join(w,".jetro","notes");await Y(A);let O=v.join(A,`${c}.md`);if(st(O,w),await $.writeFile(O,I.markdown),r){let we=at(r),Ke=v.join(w,"projects",we,"project.json");try{let ze=await $.readFile(Ke,"utf-8"),ke=JSON.parse(ze);ke.sources&&!ke.sources.includes(u)&&(ke.sources.push(u),ke.updatedAt=new Date().toISOString(),await $.writeFile(Ke,JSON.stringify(ke,null,2)))}catch{}}try{await $.unlink(_)}catch{}let xe=I.meta||{},Qe={outputPath:v.relative(w,O),sourcePath:v.relative(w,d),pageCount:xe.pages??void 0,title:xe.title||c,tables:xe.tables??void 0,format:s,wordCount:xe.wordCount??void 0,fileSize:xe.fileSize??void 0};return JSON.stringify(Qe,null,2)}async function RP(e){let{Database:t}=await import("duckdb-async"),r=v.join(w,".jetro","cache.duckdb");await Y(v.dirname(r));let n=await t.create(r);try{await n.exec(`
572
+ CREATE TABLE IF NOT EXISTS stock_data (
573
+ ticker VARCHAR,
574
+ endpoint VARCHAR,
575
+ data JSON,
576
+ fetched_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
577
+ PRIMARY KEY (ticker, endpoint)
578
+ );
579
+ CREATE TABLE IF NOT EXISTS portfolio_holdings (
580
+ portfolio VARCHAR,
581
+ ticker VARCHAR,
582
+ name VARCHAR,
583
+ weight REAL,
584
+ shares REAL,
585
+ avg_cost REAL,
586
+ sector VARCHAR,
587
+ current_price REAL,
588
+ current_value REAL,
589
+ pnl REAL,
590
+ pnl_pct REAL,
591
+ updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
592
+ PRIMARY KEY (portfolio, ticker)
593
+ );
594
+ `);try{let i=v.join(w,".jetro","datasets"),o=(await $.readdir(i)).filter(a=>a.endsWith(".json"));for(let a of o)try{let s=await $.readFile(v.join(i,a),"utf-8"),c=JSON.parse(s),u=c.duckdbTable||c.slug;if(!u||!c.files?.length)continue;for(let l of c.files){let d=v.resolve(w,l);st(d,w);let f=v.extname(d).toLowerCase(),p=`ds_${Ss(u)}`;f===".csv"||f===".tsv"?await n.exec(`CREATE OR REPLACE VIEW ${p} AS SELECT * FROM read_csv_auto('${d.replace(/'/g,"''")}');`):f===".parquet"?await n.exec(`CREATE OR REPLACE VIEW ${p} AS SELECT * FROM read_parquet('${d.replace(/'/g,"''")}');`):(f===".json"||f===".jsonl"||f===".ndjson")&&await n.exec(`CREATE OR REPLACE VIEW ${p} AS SELECT * FROM read_json_auto('${d.replace(/'/g,"''")}');`)}}catch(s){console.error(`[duckdb] Failed to register dataset ${a}: ${s}`)}}catch{}return await e(n)}finally{await n.close()}}function DP(e){let t=e.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim(),r=t.toUpperCase();if(!r.startsWith("SELECT")&&!r.startsWith("WITH")&&!r.startsWith("DESCRIBE")&&!r.startsWith("SUMMARIZE"))throw new Error("Only SELECT, WITH (CTE), DESCRIBE, and SUMMARIZE queries are allowed");if(t.split(";").filter(o=>o.trim().length>0).length>1)throw new Error("Multiple SQL statements are not allowed");let i=["COPY","EXPORT","IMPORT","ATTACH","DETACH","INSTALL","LOAD","CALL","PRAGMA","CREATE","DROP","ALTER","DELETE","INSERT","UPDATE","TRUNCATE","GRANT","REVOKE"];for(let o of i)if(new RegExp(`\\b${o}\\b`,"i").test(t))throw new Error(`SQL keyword "${o}" is not allowed in read-only queries`)}async function AP(e){let{sql:t}=e;if(!t||!t.trim())throw new Error("No SQL query provided");DP(t);let r=t.replace(/--.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"").trim();return RP(async n=>{let i=await n.all(r);return console.error(`[jet_query] ${i.length} row(s) returned`),JSON.stringify(i,null,2)})}async function CP(e){let{language:t,code:r,timeout:n=3e5}=e;if(!r||!r.trim())throw new Error("No code provided");let i=Math.max(n,1e3),o=t==="r"?"R":"py",a;if(t==="r")a="Rscript";else{let h=v.join(w,".jetro","venv","bin","python3");try{await $.access(h,vt.constants.X_OK),a=h}catch{a="python3"}}let s=v.join(w,".jetro","scripts");await Y(s);let c=`_exec_${Date.now()}.${o}`,u=v.join(s,c);await $.writeFile(u,r,"utf-8");let l=v.join(w,".jetro","lib"),d=process.env.PYTHONPATH||"",f=ks(),p={...process.env,JET_WORKSPACE:w,JET_DUCKDB_PATH:v.join(w,".jetro","cache.duckdb"),JET_API_URL:z_,JET_JWT:j_(),JET_FRAMES_DIR:v.join(w,".jetro","frames"),PYTHONPATH:d?`${l}:${d}`:l,...f?{JET_PROJECT:f}:{}};console.error(`[jet_exec] ${t} (${r.length} chars, timeout ${i}ms)`);try{let{exec:h}=await import("node:child_process"),g=await new Promise(I=>{h(`${a} "${u}"`,{cwd:w,timeout:i,maxBuffer:10*1024*1024,env:p},(A,O,xe)=>{I({stdout:O||"",stderr:xe||"",exitCode:A?1:0})})});console.error(`[jet_exec] exit=${g.exitCode} stdout=${g.stdout.length}B stderr=${g.stderr.length}B`);let _=8*1024,k=g.stdout,E;if(k.length>_){let I=v.join(w,".jetro","output");await Y(I);let A=Date.now();E=v.join(I,`exec_${A}.txt`),await $.writeFile(E,k,"utf-8"),k=k.slice(0,_)+`
595
+
596
+ --- OUTPUT TRUNCATED (${g.stdout.length} bytes) ---
597
+ Full output saved to: .jetro/output/exec_${A}.txt
598
+ Read this file to see complete results.`}return JSON.stringify({exitCode:g.exitCode,stdout:k,stderr:g.stderr,...E?{outputFile:`.jetro/output/${v.basename(E)}`}:{}},null,2)}finally{try{await $.unlink(u)}catch{}}}var ff=new bs({name:"jetro",version:"1.0.0"},{capabilities:{tools:{}}});ff.setRequestHandler(fd,async()=>({tools:$P}));ff.setRequestHandler(Di,async e=>{let{name:t,arguments:r}=e.params;try{let n;switch(t){case"jet_data":n=await bP(r);break;case"jet_skill":n=await xP(r);break;case"jet_template":n=await wP(r);break;case"jet_render":{let i=r;i.projectSlug||(i.projectSlug=ks()??void 0),n=await SP(i);break}case"jet_search":n=await zP(r);break;case"jet_save":n=await IP(r);break;case"jet_canvas":{let i=r;!i.canvasId&&!i.projectSlug&&i.action!=="list"&&(i.projectSlug=ks()??void 0),n=await P_(i);break}case"jet_parse":{let i=r;i.projectSlug||(i.projectSlug=ks()??void 0),n=await NP(i);break}case"jet_share":n=await OP(r);break;case"jet_deploy":n=await EP(r);break;case"jet_query":n=await AP(r);break;case"jet_exec":n=await CP(r);break;case"jet_connector":n=await ZP(r);break;default:return{content:[{type:"text",text:`Unknown tool: ${t}`}],isError:!0}}return{content:[{type:"text",text:n}]}}catch(n){return{content:[{type:"text",text:`Error: ${n instanceof Error?n.message:String(n)}`}],isError:!0}}});async function ZP(e){let t=v.join(w,".jetro","connectors");switch(await Y(t),e.action){case"create":{if(!e.name)throw new Error("name is required for create");if(!e.clientCode)throw new Error("clientCode is required for create");if(!e.auth)throw new Error("auth is required for create");let r=Ss(e.name),n=v.join(t,r);await Y(n);let i={slug:r,name:e.name,description:e.description||"",type:e.type||"custom",origin:"agent",auth:{method:e.auth.method||"none",...e.auth,credentialKey:e.auth.method!=="none"?`jet_connector_${r}`:void 0},params:e.params||{},methods:e.methods||{},createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};if(await $.writeFile(v.join(n,"connector.json"),JSON.stringify(i,null,2),"utf-8"),await $.writeFile(v.join(n,"client.py"),e.clientCode,"utf-8"),e.requirements&&await $.writeFile(v.join(n,"requirements.txt"),e.requirements,"utf-8"),e.credential&&i.auth.credentialKey){let o=v.join(w,".jetro","connector_queue");await Y(o),await $.writeFile(v.join(o,`${r}.json`),JSON.stringify({action:"store",slug:r,credentialKey:i.auth.credentialKey,credential:e.credential}),"utf-8")}return console.error(`[jet_connector] Created connector: ${r}`),JSON.stringify({status:"created",slug:r,name:e.name,type:i.type,auth:i.auth.method,path:`.jetro/connectors/${r}/`,usage:`from jet.connectors import use; client = use("${r}"); data = client.fetch()`})}case"list":{let r=await $.readdir(t).catch(()=>[]),n=[];for(let i of r){let o=v.join(t,i,"connector.json");try{let a=await $.readFile(o,"utf-8");n.push(JSON.parse(a))}catch{}}return JSON.stringify({count:n.length,connectors:n})}case"read":{if(!e.slug)throw new Error("slug is required for read");let r=v.join(t,e.slug);st(r,w);let n=v.join(r,"connector.json"),i=v.join(r,"client.py"),o=await $.readFile(n,"utf-8").catch(()=>null);if(!o)throw new Error(`Connector not found: ${e.slug}`);let a=await $.readFile(i,"utf-8").catch(()=>"");return JSON.stringify({config:JSON.parse(o),clientCode:a})}case"test":{if(!e.slug)throw new Error("slug is required for test");let r=v.join(t,e.slug);st(r,w);let n=v.join(r,"connector.json"),i=await $.readFile(n,"utf-8").catch(()=>null);if(!i)throw new Error(`Connector not found: ${e.slug}`);let o=JSON.parse(i),a=v.join(w,".jetro","venv","bin","python3"),s;try{await $.access(a,vt.constants.X_OK),s=a}catch{s="python3"}let c=["import json, os, sys",`os.environ['JET_WORKSPACE'] = ${JSON.stringify(w)}`,"sys.path.insert(0, os.path.join(os.environ['JET_WORKSPACE'], '.jetro', 'lib'))","from jet.connectors import use",`client = use(${JSON.stringify(e.slug)})`,"# Try calling fetch() or the first available method","result = None","if hasattr(client, 'fetch'):"," result = client.fetch()","elif hasattr(client, 'test'):"," result = client.test()","else:"," result = {'status': 'ok', 'message': 'Client instantiated successfully (no fetch/test method)'}","print(json.dumps(result, default=str))"].join(`
599
+ `),u=v.join(w,".jetro","lib"),l={...process.env,JET_WORKSPACE:w,PYTHONPATH:u},d=o.auth?.credentialKey;if(d){let h=v.join(w,".jetro","connector_queue",`${e.slug}.json`);try{let g=await $.readFile(h,"utf-8"),_=JSON.parse(g);_.credential&&(l[`JET_CRED_${d.toUpperCase().replace(/-/g,"_")}`]=_.credential)}catch{}}let{exec:f}=await import("node:child_process"),p=await new Promise(h=>{f(`${s} -c ${JSON.stringify(c)}`,{cwd:w,timeout:3e4,maxBuffer:4*1024*1024,env:l},(g,_,k)=>{h({stdout:(_||"").toString().trim(),stderr:(k||"").toString().trim(),exitCode:g?g.code||1:0})})});return p.exitCode!==0?JSON.stringify({status:"error",slug:e.slug,error:p.stderr||p.stdout||"Test failed"}):JSON.stringify({status:"ok",slug:e.slug,output:p.stdout})}case"delete":{if(!e.slug)throw new Error("slug is required for delete");let r=v.join(t,e.slug);st(r,w);let n=v.join(r,"connector.json"),i;try{let o=await $.readFile(n,"utf-8");i=JSON.parse(o).auth?.credentialKey}catch{}if(await $.rm(r,{recursive:!0,force:!0}),i){let o=v.join(w,".jetro","connector_queue");await Y(o),await $.writeFile(v.join(o,`${e.slug}.json`),JSON.stringify({action:"delete",slug:e.slug,credentialKey:i}),"utf-8")}return console.error(`[jet_connector] Deleted connector: ${e.slug}`),JSON.stringify({status:"deleted",slug:e.slug})}default:throw new Error(`Unknown jet_connector action: ${e.action}`)}}var UP=new ws;await ff.connect(UP);