@kleo.so/cli 1.0.0 → 1.1.1

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 (3) hide show
  1. package/README.md +30 -18
  2. package/dist/kleo.js +33 -30
  3. package/package.json +1 -1
package/dist/kleo.js CHANGED
@@ -5,16 +5,16 @@ import { dirname as __dirname_fn } from 'node:path';
5
5
  const require = __createRequire(import.meta.url);
6
6
  const __filename = __fileURLToPath(import.meta.url);
7
7
  const __dirname = __dirname_fn(__filename);
8
- var u_=Object.create;var bs=Object.defineProperty;var l_=Object.getOwnPropertyDescriptor;var d_=Object.getOwnPropertyNames;var p_=Object.getPrototypeOf,f_=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),zs=(e,t)=>{for(var r in t)bs(e,r,{get:t[r],enumerable:!0})},m_=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d_(t))!f_.call(e,n)&&n!==r&&bs(e,n,{get:()=>t[n],enumerable:!(o=l_(t,n))||o.enumerable});return e};var su=(e,t,r)=>(r=e!=null?u_(p_(e)):{},m_(t||!e||!e.__esModule?bs(r,"default",{value:e,enumerable:!0}):r,e));var io=S(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.regexpCode=V.getEsmExportName=V.getProperty=V.safeStringify=V.stringify=V.strConcat=V.addCodeArg=V.str=V._=V.nil=V._Code=V.Name=V.IDENTIFIER=V._CodeOrName=void 0;var no=class{};V._CodeOrName=no;V.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Mt=class extends no{constructor(t){if(super(),!V.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}}};V.Name=Mt;var Ue=class extends no{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,o)=>`${r}${o}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,o)=>(o instanceof Mt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};V._Code=Ue;V.nil=new Ue("");function Ff(e,...t){let r=[e[0]],o=0;for(;o<t.length;)Gi(r,t[o]),r.push(e[++o]);return new Ue(r)}V._=Ff;var Wi=new Ue("+");function Vf(e,...t){let r=[so(e[0])],o=0;for(;o<t.length;)r.push(Wi),Gi(r,t[o]),r.push(Wi,so(e[++o]));return A$(r),new Ue(r)}V.str=Vf;function Gi(e,t){t instanceof Ue?e.push(...t._items):t instanceof Mt?e.push(t):e.push(j$(t))}V.addCodeArg=Gi;function A$(e){let t=1;for(;t<e.length-1;){if(e[t]===Wi){let r=C$(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function C$(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Mt||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 Mt))return`"${e}${t.slice(1)}`}function N$(e,t){return t.emptyStr()?e:e.emptyStr()?t:Vf`${e}${t}`}V.strConcat=N$;function j$(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:so(Array.isArray(e)?e.join(","):e)}function Z$(e){return new Ue(so(e))}V.stringify=Z$;function so(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}V.safeStringify=so;function q$(e){return typeof e=="string"&&V.IDENTIFIER.test(e)?new Ue(`.${e}`):Ff`[${e}]`}V.getProperty=q$;function M$(e){if(typeof e=="string"&&V.IDENTIFIER.test(e))return new Ue(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}V.getEsmExportName=M$;function D$(e){return new Ue(e.toString())}V.regexpCode=D$});var Xi=S(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.ValueScope=Ie.ValueScopeName=Ie.Scope=Ie.varKinds=Ie.UsedValueState=void 0;var Oe=io(),Yi=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Rn;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Rn||(Ie.UsedValueState=Rn={}));Ie.varKinds={const:new Oe.Name("const"),let:new Oe.Name("let"),var:new Oe.Name("var")};var On=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Oe.Name?t:this.name(t)}name(t){return new Oe.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.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}}};Ie.Scope=On;var In=class extends Oe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:o}){this.value=t,this.scopePath=(0,Oe._)`.${new Oe.Name(r)}[${o}]`}};Ie.ValueScopeName=In;var U$=(0,Oe._)`\n`,Qi=class extends On{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?U$:Oe.nil}}get(){return this._scope}name(t){return new In(t,this._newName(t))}value(t,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,Oe._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(t,r,o={},n){let s=Oe.nil;for(let i in t){let a=t[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Rn.Started);let l=r(u);if(l){let d=this.opts.es5?Ie.varKinds.var:Ie.varKinds.const;s=(0,Oe._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,Oe._)`${s}${l}${this.opts._n}`;else throw new Yi(u);c.set(u,Rn.Completed)})}return s}};Ie.ValueScope=Qi});var j=S(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.or=Z.and=Z.not=Z.CodeGen=Z.operators=Z.varKinds=Z.ValueScopeName=Z.ValueScope=Z.Scope=Z.Name=Z.regexpCode=Z.stringify=Z.getProperty=Z.nil=Z.strConcat=Z.str=Z._=void 0;var D=io(),Je=Xi(),St=io();Object.defineProperty(Z,"_",{enumerable:!0,get:function(){return St._}});Object.defineProperty(Z,"str",{enumerable:!0,get:function(){return St.str}});Object.defineProperty(Z,"strConcat",{enumerable:!0,get:function(){return St.strConcat}});Object.defineProperty(Z,"nil",{enumerable:!0,get:function(){return St.nil}});Object.defineProperty(Z,"getProperty",{enumerable:!0,get:function(){return St.getProperty}});Object.defineProperty(Z,"stringify",{enumerable:!0,get:function(){return St.stringify}});Object.defineProperty(Z,"regexpCode",{enumerable:!0,get:function(){return St.regexpCode}});Object.defineProperty(Z,"Name",{enumerable:!0,get:function(){return St.Name}});var jn=Xi();Object.defineProperty(Z,"Scope",{enumerable:!0,get:function(){return jn.Scope}});Object.defineProperty(Z,"ValueScope",{enumerable:!0,get:function(){return jn.ValueScope}});Object.defineProperty(Z,"ValueScopeName",{enumerable:!0,get:function(){return jn.ValueScopeName}});Object.defineProperty(Z,"varKinds",{enumerable:!0,get:function(){return jn.varKinds}});Z.operators={GT:new D._Code(">"),GTE:new D._Code(">="),LT:new D._Code("<"),LTE:new D._Code("<="),EQ:new D._Code("==="),NEQ:new D._Code("!=="),NOT:new D._Code("!"),OR:new D._Code("||"),AND:new D._Code("&&"),ADD:new D._Code("+")};var ut=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},ea=class extends ut{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let o=t?Je.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=gr(this.rhs,t,r)),this}get names(){return this.rhs instanceof D._CodeOrName?this.rhs.names:{}}},An=class extends ut{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof D.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=gr(this.rhs,t,r),this}get names(){let t=this.lhs instanceof D.Name?{}:{...this.lhs.names};return Nn(t,this.rhs)}},ta=class extends An{constructor(t,r,o,n){super(t,o,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},ra=class extends ut{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},oa=class extends ut{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},na=class extends ut{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},sa=class extends ut{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=gr(this.code,t,r),this}get names(){return this.code instanceof D._CodeOrName?this.code.names:{}}},ao=class extends ut{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(t,r)||(L$(t,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Lt(t,r.names),{})}},lt=class extends ao{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},ia=class extends ao{},hr=class extends lt{};hr.kind="else";var Dt=class e extends lt{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 o=r.optimizeNodes();r=this.else=Array.isArray(o)?new hr(o):o}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Hf(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=gr(this.condition,t,r),this}get names(){let t=super.names;return Nn(t,this.condition),this.else&&Lt(t,this.else.names),t}};Dt.kind="if";var Ut=class extends lt{};Ut.kind="for";var aa=class extends Ut{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=gr(this.iteration,t,r),this}get names(){return Lt(super.names,this.iteration.names)}},ca=class extends Ut{constructor(t,r,o,n){super(),this.varKind=t,this.name=r,this.from=o,this.to=n}render(t){let r=t.es5?Je.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(t)}get names(){let t=Nn(super.names,this.from);return Nn(t,this.to)}},Cn=class extends Ut{constructor(t,r,o,n){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=n}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=gr(this.iterable,t,r),this}get names(){return Lt(super.names,this.iterable.names)}},co=class extends lt{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};co.kind="func";var uo=class extends ao{render(t){return"return "+super.render(t)}};uo.kind="return";var ua=class extends lt{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 o,n;return super.optimizeNames(t,r),(o=this.catch)===null||o===void 0||o.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Lt(t,this.catch.names),this.finally&&Lt(t,this.finally.names),t}},lo=class extends lt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};lo.kind="catch";var po=class extends lt{render(t){return"finally"+super.render(t)}};po.kind="finally";var la=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
9
- `:""},this._extScope=t,this._scope=new Je.Scope({parent:t}),this._nodes=[new ia]}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 o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}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,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new ea(t,s,o)),s}const(t,r,o){return this._def(Je.varKinds.const,t,r,o)}let(t,r,o){return this._def(Je.varKinds.let,t,r,o)}var(t,r,o){return this._def(Je.varKinds.var,t,r,o)}assign(t,r,o){return this._leafNode(new An(t,r,o))}add(t,r){return this._leafNode(new ta(t,Z.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==D.nil&&this._leafNode(new sa(t)),this}object(...t){let r=["{"];for(let[o,n]of t)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,D.addCodeArg)(r,n));return r.push("}"),new D._Code(r)}if(t,r,o){if(this._blockNode(new Dt(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Dt(t))}else(){return this._elseNode(new hr)}endIf(){return this._endBlockNode(Dt,hr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new aa(t),r)}forRange(t,r,o,n,s=this.opts.es5?Je.varKinds.var:Je.varKinds.let){let i=this._scope.toName(t);return this._for(new ca(s,i,r,o),()=>n(i))}forOf(t,r,o,n=Je.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof D.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,D._)`${i}.length`,a=>{this.var(s,(0,D._)`${i}[${a}]`),o(s)})}return this._for(new Cn("of",n,s,r),()=>o(s))}forIn(t,r,o,n=this.opts.es5?Je.varKinds.var:Je.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,D._)`Object.keys(${r})`,o);let s=this._scope.toName(t);return this._for(new Cn("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(Ut)}label(t){return this._leafNode(new ra(t))}break(t){return this._leafNode(new oa(t))}return(t){let r=new uo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(uo)}try(t,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new ua;if(this._blockNode(n),this.code(t),r){let s=this.name("e");this._currNode=n.catch=new lo(s),r(s)}return o&&(this._currNode=n.finally=new po,this.code(o)),this._endBlockNode(lo,po)}throw(t){return this._leafNode(new na(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 o=this._nodes.length-r;if(o<0||t!==void 0&&o!==t)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=D.nil,o,n){return this._blockNode(new co(t,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(co)}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 o=this._currNode;if(o instanceof t||r&&o 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 Dt))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}};Z.CodeGen=la;function Lt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Nn(e,t){return t instanceof D._CodeOrName?Lt(e,t.names):e}function gr(e,t,r){if(e instanceof D.Name)return o(e);if(!n(e))return e;return new D._Code(e._items.reduce((s,i)=>(i instanceof D.Name&&(i=o(i)),i instanceof D._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function n(s){return s instanceof D._Code&&s._items.some(i=>i instanceof D.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function L$(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Hf(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,D._)`!${da(e)}`}Z.not=Hf;var F$=Kf(Z.operators.AND);function V$(...e){return e.reduce(F$)}Z.and=V$;var H$=Kf(Z.operators.OR);function K$(...e){return e.reduce(H$)}Z.or=K$;function Kf(e){return(t,r)=>t===D.nil?r:r===D.nil?t:(0,D._)`${da(t)} ${e} ${da(r)}`}function da(e){return e instanceof D.Name?e:(0,D._)`(${e})`}});var U=S(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.checkStrictMode=q.getErrorPath=q.Type=q.useFunc=q.setEvaluated=q.evaluatedPropsToName=q.mergeEvaluated=q.eachItem=q.unescapeJsonPointer=q.escapeJsonPointer=q.escapeFragment=q.unescapeFragment=q.schemaRefOrVal=q.schemaHasRulesButRef=q.schemaHasRules=q.checkUnknownRules=q.alwaysValidSchema=q.toHash=void 0;var G=j(),J$=io();function B$(e){let t={};for(let r of e)t[r]=!0;return t}q.toHash=B$;function W$(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Wf(e,t),!Gf(t,e.self.RULES.all))}q.alwaysValidSchema=W$;function Wf(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=o.RULES.keywords;for(let s in t)n[s]||Xf(e,`unknown keyword: "${s}"`)}q.checkUnknownRules=Wf;function Gf(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}q.schemaHasRules=Gf;function G$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}q.schemaHasRulesButRef=G$;function Y$({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,G._)`${r}`}return(0,G._)`${e}${t}${(0,G.getProperty)(o)}`}q.schemaRefOrVal=Y$;function Q$(e){return Yf(decodeURIComponent(e))}q.unescapeFragment=Q$;function X$(e){return encodeURIComponent(fa(e))}q.escapeFragment=X$;function fa(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=fa;function Yf(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=Yf;function ew(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}q.eachItem=ew;function Jf({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof G.Name?(s instanceof G.Name?e(n,s,i):t(n,s,i),i):s instanceof G.Name?(t(n,i,s),s):r(s,i);return a===G.Name&&!(c instanceof G.Name)?o(n,c):c}}q.mergeEvaluated={props:Jf({mergeNames:(e,t,r)=>e.if((0,G._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,G._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,G._)`${r} || {}`).code((0,G._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,G._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,G._)`${r} || {}`),ma(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Qf}),items:Jf({mergeNames:(e,t,r)=>e.if((0,G._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,G._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,G._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,G._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Qf(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,G._)`{}`);return t!==void 0&&ma(e,r,t),r}q.evaluatedPropsToName=Qf;function ma(e,t,r){Object.keys(r).forEach(o=>e.assign((0,G._)`${t}${(0,G.getProperty)(o)}`,!0))}q.setEvaluated=ma;var Bf={};function tw(e,t){return e.scopeValue("func",{ref:t,code:Bf[t.code]||(Bf[t.code]=new J$._Code(t.code))})}q.useFunc=tw;var pa;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(pa||(q.Type=pa={}));function rw(e,t,r){if(e instanceof G.Name){let o=t===pa.Num;return r?o?(0,G._)`"[" + ${e} + "]"`:(0,G._)`"['" + ${e} + "']"`:o?(0,G._)`"/" + ${e}`:(0,G._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,G.getProperty)(e).toString():"/"+fa(e)}q.getErrorPath=rw;function Xf(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}q.checkStrictMode=Xf});var dt=S(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var $e=j(),ow={data:new $e.Name("data"),valCxt:new $e.Name("valCxt"),instancePath:new $e.Name("instancePath"),parentData:new $e.Name("parentData"),parentDataProperty:new $e.Name("parentDataProperty"),rootData:new $e.Name("rootData"),dynamicAnchors:new $e.Name("dynamicAnchors"),vErrors:new $e.Name("vErrors"),errors:new $e.Name("errors"),this:new $e.Name("this"),self:new $e.Name("self"),scope:new $e.Name("scope"),json:new $e.Name("json"),jsonPos:new $e.Name("jsonPos"),jsonLen:new $e.Name("jsonLen"),jsonPart:new $e.Name("jsonPart")};ha.default=ow});var fo=S(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.extendErrors=we.resetErrorsCount=we.reportExtraError=we.reportError=we.keyword$DataError=we.keywordError=void 0;var L=j(),Zn=U(),Se=dt();we.keywordError={message:({keyword:e})=>(0,L.str)`must pass "${e}" keyword validation`};we.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,L.str)`"${e}" keyword must be ${t} ($data)`:(0,L.str)`"${e}" keyword is invalid ($data)`};function nw(e,t=we.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=rm(e,t,r);o??(i||a)?em(s,c):tm(n,(0,L._)`[${c}]`)}we.reportError=nw;function sw(e,t=we.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=rm(e,t,r);em(n,a),s||i||tm(o,Se.default.vErrors)}we.reportExtraError=sw;function iw(e,t){e.assign(Se.default.errors,t),e.if((0,L._)`${Se.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,L._)`${Se.default.vErrors}.length`,t),()=>e.assign(Se.default.vErrors,null)))}we.resetErrorsCount=iw;function aw({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,Se.default.errors,a=>{e.const(i,(0,L._)`${Se.default.vErrors}[${a}]`),e.if((0,L._)`${i}.instancePath === undefined`,()=>e.assign((0,L._)`${i}.instancePath`,(0,L.strConcat)(Se.default.instancePath,s.errorPath))),e.assign((0,L._)`${i}.schemaPath`,(0,L.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,L._)`${i}.schema`,r),e.assign((0,L._)`${i}.data`,o))})}we.extendErrors=aw;function em(e,t){let r=e.const("err",t);e.if((0,L._)`${Se.default.vErrors} === null`,()=>e.assign(Se.default.vErrors,(0,L._)`[${r}]`),(0,L._)`${Se.default.vErrors}.push(${r})`),e.code((0,L._)`${Se.default.errors}++`)}function tm(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;n.$async?r.throw((0,L._)`new ${e.ValidationError}(${t})`):(r.assign((0,L._)`${o}.errors`,t),r.return(!1))}var Ft={keyword:new L.Name("keyword"),schemaPath:new L.Name("schemaPath"),params:new L.Name("params"),propertyName:new L.Name("propertyName"),message:new L.Name("message"),schema:new L.Name("schema"),parentSchema:new L.Name("parentSchema")};function rm(e,t,r){let{createErrors:o}=e.it;return o===!1?(0,L._)`{}`:cw(e,t,r)}function cw(e,t,r={}){let{gen:o,it:n}=e,s=[uw(n,r),lw(e,r)];return dw(e,t,s),o.object(...s)}function uw({errorPath:e},{instancePath:t}){let r=t?(0,L.str)`${e}${(0,Zn.getErrorPath)(t,Zn.Type.Str)}`:e;return[Se.default.instancePath,(0,L.strConcat)(Se.default.instancePath,r)]}function lw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:(0,L.str)`${t}/${e}`;return r&&(n=(0,L.str)`${n}${(0,Zn.getErrorPath)(r,Zn.Type.Str)}`),[Ft.schemaPath,n]}function dw(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([Ft.keyword,n],[Ft.params,typeof t=="function"?t(e):t||(0,L._)`{}`]),c.messages&&o.push([Ft.message,typeof r=="function"?r(e):r]),c.verbose&&o.push([Ft.schema,i],[Ft.parentSchema,(0,L._)`${l}${d}`],[Se.default.data,s]),u&&o.push([Ft.propertyName,u])}});var nm=S(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.boolOrEmptySchema=_r.topBoolOrEmptySchema=void 0;var pw=fo(),fw=j(),mw=dt(),hw={message:"boolean schema is false"};function gw(e){let{gen:t,schema:r,validateName:o}=e;r===!1?om(e,!1):typeof r=="object"&&r.$async===!0?t.return(mw.default.data):(t.assign((0,fw._)`${o}.errors`,null),t.return(!0))}_r.topBoolOrEmptySchema=gw;function _w(e,t){let{gen:r,schema:o}=e;o===!1?(r.var(t,!1),om(e)):r.var(t,!0)}_r.boolOrEmptySchema=_w;function om(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,pw.reportError)(n,hw,void 0,t)}});var ga=S(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.getRules=yr.isJSONType=void 0;var yw=["string","number","integer","boolean","null","object","array"],vw=new Set(yw);function $w(e){return typeof e=="string"&&vw.has(e)}yr.isJSONType=$w;function ww(){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:{}}}yr.getRules=ww});var _a=S(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.shouldUseRule=kt.shouldUseGroup=kt.schemaHasRulesForType=void 0;function bw({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&sm(e,o)}kt.schemaHasRulesForType=bw;function sm(e,t){return t.rules.some(r=>im(e,r))}kt.shouldUseGroup=sm;function im(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(o=>e[o]!==void 0))}kt.shouldUseRule=im});var mo=S(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.reportTypeError=be.checkDataTypes=be.checkDataType=be.coerceAndCheckDataType=be.getJSONTypes=be.getSchemaTypes=be.DataType=void 0;var zw=ga(),xw=_a(),Sw=fo(),N=j(),am=U(),vr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(vr||(be.DataType=vr={}));function kw(e){let t=cm(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}be.getSchemaTypes=kw;function cm(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(zw.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}be.getJSONTypes=cm;function Pw(e,t){let{gen:r,data:o,opts:n}=e,s=Ew(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,xw.schemaHasRulesForType)(e,t[0]));if(i){let a=va(t,o,n.strictNumbers,vr.Wrong);r.if(a,()=>{s.length?Tw(e,t,s):$a(e)})}return i}be.coerceAndCheckDataType=Pw;var um=new Set(["string","number","integer","boolean","null"]);function Ew(e,t){return t?e.filter(r=>um.has(r)||t==="array"&&r==="array"):[]}function Tw(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",(0,N._)`typeof ${n}`),a=o.let("coerced",(0,N._)`undefined`);s.coerceTypes==="array"&&o.if((0,N._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,N._)`${n}[0]`).assign(i,(0,N._)`typeof ${n}`).if(va(t,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,N._)`${a} !== undefined`);for(let u of r)(um.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),$a(e),o.endIf(),o.if((0,N._)`${a} !== undefined`,()=>{o.assign(n,a),Rw(e,a)});function c(u){switch(u){case"string":o.elseIf((0,N._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,N._)`"" + ${n}`).elseIf((0,N._)`${n} === null`).assign(a,(0,N._)`""`);return;case"number":o.elseIf((0,N._)`${i} == "boolean" || ${n} === null
8
+ var h_=Object.create;var ks=Object.defineProperty;var g_=Object.getOwnPropertyDescriptor;var __=Object.getOwnPropertyNames;var y_=Object.getPrototypeOf,v_=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ps=(e,t)=>{for(var r in t)ks(e,r,{get:t[r],enumerable:!0})},w_=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of __(t))!v_.call(e,n)&&n!==r&&ks(e,n,{get:()=>t[n],enumerable:!(o=g_(t,n))||o.enumerable});return e};var cu=(e,t,r)=>(r=e!=null?h_(y_(e)):{},w_(t||!e||!e.__esModule?ks(r,"default",{value:e,enumerable:!0}):r,e));var $o=S(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.regexpCode=V.getEsmExportName=V.getProperty=V.safeStringify=V.stringify=V.strConcat=V.addCodeArg=V.str=V._=V.nil=V._Code=V.Name=V.IDENTIFIER=V._CodeOrName=void 0;var vo=class{};V._CodeOrName=vo;V.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ft=class extends vo{constructor(t){if(super(),!V.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}}};V.Name=Ft;var Le=class extends vo{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,o)=>`${r}${o}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,o)=>(o instanceof Ft&&(r[o.str]=(r[o.str]||0)+1),r),{})}};V._Code=Le;V.nil=new Le("");function im(e,...t){let r=[e[0]],o=0;for(;o<t.length;)ua(r,t[o]),r.push(e[++o]);return new Le(r)}V._=im;var ca=new Le("+");function am(e,...t){let r=[wo(e[0])],o=0;for(;o<t.length;)r.push(ca),ua(r,t[o]),r.push(ca,wo(e[++o]));return l$(r),new Le(r)}V.str=am;function ua(e,t){t instanceof Le?e.push(...t._items):t instanceof Ft?e.push(t):e.push(f$(t))}V.addCodeArg=ua;function l$(e){let t=1;for(;t<e.length-1;){if(e[t]===ca){let r=d$(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function d$(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Ft||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 Ft))return`"${e}${t.slice(1)}`}function p$(e,t){return t.emptyStr()?e:e.emptyStr()?t:am`${e}${t}`}V.strConcat=p$;function f$(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:wo(Array.isArray(e)?e.join(","):e)}function m$(e){return new Le(wo(e))}V.stringify=m$;function wo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}V.safeStringify=wo;function h$(e){return typeof e=="string"&&V.IDENTIFIER.test(e)?new Le(`.${e}`):im`[${e}]`}V.getProperty=h$;function g$(e){if(typeof e=="string"&&V.IDENTIFIER.test(e))return new Le(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}V.getEsmExportName=g$;function _$(e){return new Le(e.toString())}V.regexpCode=_$});var pa=S(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.ValueScope=Ie.ValueScopeName=Ie.Scope=Ie.varKinds=Ie.UsedValueState=void 0;var Oe=$o(),la=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Cn;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Cn||(Ie.UsedValueState=Cn={}));Ie.varKinds={const:new Oe.Name("const"),let:new Oe.Name("let"),var:new Oe.Name("var")};var An=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Oe.Name?t:this.name(t)}name(t){return new Oe.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.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}}};Ie.Scope=An;var Nn=class extends Oe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:o}){this.value=t,this.scopePath=(0,Oe._)`.${new Oe.Name(r)}[${o}]`}};Ie.ValueScopeName=Nn;var y$=(0,Oe._)`\n`,da=class extends An{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?y$:Oe.nil}}get(){return this._scope}name(t){return new Nn(t,this._newName(t))}value(t,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,Oe._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(t,r,o={},n){let s=Oe.nil;for(let i in t){let a=t[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Cn.Started);let l=r(u);if(l){let d=this.opts.es5?Ie.varKinds.var:Ie.varKinds.const;s=(0,Oe._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,Oe._)`${s}${l}${this.opts._n}`;else throw new la(u);c.set(u,Cn.Completed)})}return s}};Ie.ValueScope=da});var j=S(Z=>{"use strict";Object.defineProperty(Z,"__esModule",{value:!0});Z.or=Z.and=Z.not=Z.CodeGen=Z.operators=Z.varKinds=Z.ValueScopeName=Z.ValueScope=Z.Scope=Z.Name=Z.regexpCode=Z.stringify=Z.getProperty=Z.nil=Z.strConcat=Z.str=Z._=void 0;var D=$o(),Be=pa(),kt=$o();Object.defineProperty(Z,"_",{enumerable:!0,get:function(){return kt._}});Object.defineProperty(Z,"str",{enumerable:!0,get:function(){return kt.str}});Object.defineProperty(Z,"strConcat",{enumerable:!0,get:function(){return kt.strConcat}});Object.defineProperty(Z,"nil",{enumerable:!0,get:function(){return kt.nil}});Object.defineProperty(Z,"getProperty",{enumerable:!0,get:function(){return kt.getProperty}});Object.defineProperty(Z,"stringify",{enumerable:!0,get:function(){return kt.stringify}});Object.defineProperty(Z,"regexpCode",{enumerable:!0,get:function(){return kt.regexpCode}});Object.defineProperty(Z,"Name",{enumerable:!0,get:function(){return kt.Name}});var qn=pa();Object.defineProperty(Z,"Scope",{enumerable:!0,get:function(){return qn.Scope}});Object.defineProperty(Z,"ValueScope",{enumerable:!0,get:function(){return qn.ValueScope}});Object.defineProperty(Z,"ValueScopeName",{enumerable:!0,get:function(){return qn.ValueScopeName}});Object.defineProperty(Z,"varKinds",{enumerable:!0,get:function(){return qn.varKinds}});Z.operators={GT:new D._Code(">"),GTE:new D._Code(">="),LT:new D._Code("<"),LTE:new D._Code("<="),EQ:new D._Code("==="),NEQ:new D._Code("!=="),NOT:new D._Code("!"),OR:new D._Code("||"),AND:new D._Code("&&"),ADD:new D._Code("+")};var dt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},fa=class extends dt{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let o=t?Be.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=gr(this.rhs,t,r)),this}get names(){return this.rhs instanceof D._CodeOrName?this.rhs.names:{}}},jn=class extends dt{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof D.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=gr(this.rhs,t,r),this}get names(){let t=this.lhs instanceof D.Name?{}:{...this.lhs.names};return Mn(t,this.rhs)}},ma=class extends jn{constructor(t,r,o,n){super(t,o,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},ha=class extends dt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},ga=class extends dt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},_a=class extends dt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},ya=class extends dt{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=gr(this.code,t,r),this}get names(){return this.code instanceof D._CodeOrName?this.code.names:{}}},bo=class extends dt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(t,r)||(v$(t,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Jt(t,r.names),{})}},pt=class extends bo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},va=class extends bo{},hr=class extends pt{};hr.kind="else";var Vt=class e extends pt{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 o=r.optimizeNodes();r=this.else=Array.isArray(o)?new hr(o):o}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(cm(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=gr(this.condition,t,r),this}get names(){let t=super.names;return Mn(t,this.condition),this.else&&Jt(t,this.else.names),t}};Vt.kind="if";var Ht=class extends pt{};Ht.kind="for";var wa=class extends Ht{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=gr(this.iteration,t,r),this}get names(){return Jt(super.names,this.iteration.names)}},$a=class extends Ht{constructor(t,r,o,n){super(),this.varKind=t,this.name=r,this.from=o,this.to=n}render(t){let r=t.es5?Be.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(t)}get names(){let t=Mn(super.names,this.from);return Mn(t,this.to)}},Zn=class extends Ht{constructor(t,r,o,n){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=n}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=gr(this.iterable,t,r),this}get names(){return Jt(super.names,this.iterable.names)}},zo=class extends pt{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};zo.kind="func";var xo=class extends bo{render(t){return"return "+super.render(t)}};xo.kind="return";var ba=class extends pt{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 o,n;return super.optimizeNames(t,r),(o=this.catch)===null||o===void 0||o.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Jt(t,this.catch.names),this.finally&&Jt(t,this.finally.names),t}},So=class extends pt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};So.kind="catch";var ko=class extends pt{render(t){return"finally"+super.render(t)}};ko.kind="finally";var za=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
9
+ `:""},this._extScope=t,this._scope=new Be.Scope({parent:t}),this._nodes=[new va]}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 o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}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,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new fa(t,s,o)),s}const(t,r,o){return this._def(Be.varKinds.const,t,r,o)}let(t,r,o){return this._def(Be.varKinds.let,t,r,o)}var(t,r,o){return this._def(Be.varKinds.var,t,r,o)}assign(t,r,o){return this._leafNode(new jn(t,r,o))}add(t,r){return this._leafNode(new ma(t,Z.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==D.nil&&this._leafNode(new ya(t)),this}object(...t){let r=["{"];for(let[o,n]of t)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,D.addCodeArg)(r,n));return r.push("}"),new D._Code(r)}if(t,r,o){if(this._blockNode(new Vt(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Vt(t))}else(){return this._elseNode(new hr)}endIf(){return this._endBlockNode(Vt,hr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new wa(t),r)}forRange(t,r,o,n,s=this.opts.es5?Be.varKinds.var:Be.varKinds.let){let i=this._scope.toName(t);return this._for(new $a(s,i,r,o),()=>n(i))}forOf(t,r,o,n=Be.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof D.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,D._)`${i}.length`,a=>{this.var(s,(0,D._)`${i}[${a}]`),o(s)})}return this._for(new Zn("of",n,s,r),()=>o(s))}forIn(t,r,o,n=this.opts.es5?Be.varKinds.var:Be.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,D._)`Object.keys(${r})`,o);let s=this._scope.toName(t);return this._for(new Zn("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(Ht)}label(t){return this._leafNode(new ha(t))}break(t){return this._leafNode(new ga(t))}return(t){let r=new xo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(xo)}try(t,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new ba;if(this._blockNode(n),this.code(t),r){let s=this.name("e");this._currNode=n.catch=new So(s),r(s)}return o&&(this._currNode=n.finally=new ko,this.code(o)),this._endBlockNode(So,ko)}throw(t){return this._leafNode(new _a(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 o=this._nodes.length-r;if(o<0||t!==void 0&&o!==t)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=D.nil,o,n){return this._blockNode(new zo(t,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(zo)}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 o=this._currNode;if(o instanceof t||r&&o 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 Vt))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}};Z.CodeGen=za;function Jt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Mn(e,t){return t instanceof D._CodeOrName?Jt(e,t.names):e}function gr(e,t,r){if(e instanceof D.Name)return o(e);if(!n(e))return e;return new D._Code(e._items.reduce((s,i)=>(i instanceof D.Name&&(i=o(i)),i instanceof D._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function n(s){return s instanceof D._Code&&s._items.some(i=>i instanceof D.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function v$(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function cm(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,D._)`!${xa(e)}`}Z.not=cm;var w$=um(Z.operators.AND);function $$(...e){return e.reduce(w$)}Z.and=$$;var b$=um(Z.operators.OR);function z$(...e){return e.reduce(b$)}Z.or=z$;function um(e){return(t,r)=>t===D.nil?r:r===D.nil?t:(0,D._)`${xa(t)} ${e} ${xa(r)}`}function xa(e){return e instanceof D.Name?e:(0,D._)`(${e})`}});var U=S(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.checkStrictMode=M.getErrorPath=M.Type=M.useFunc=M.setEvaluated=M.evaluatedPropsToName=M.mergeEvaluated=M.eachItem=M.unescapeJsonPointer=M.escapeJsonPointer=M.escapeFragment=M.unescapeFragment=M.schemaRefOrVal=M.schemaHasRulesButRef=M.schemaHasRules=M.checkUnknownRules=M.alwaysValidSchema=M.toHash=void 0;var G=j(),x$=$o();function S$(e){let t={};for(let r of e)t[r]=!0;return t}M.toHash=S$;function k$(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(pm(e,t),!fm(t,e.self.RULES.all))}M.alwaysValidSchema=k$;function pm(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=o.RULES.keywords;for(let s in t)n[s]||gm(e,`unknown keyword: "${s}"`)}M.checkUnknownRules=pm;function fm(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}M.schemaHasRules=fm;function P$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}M.schemaHasRulesButRef=P$;function E$({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,G._)`${r}`}return(0,G._)`${e}${t}${(0,G.getProperty)(o)}`}M.schemaRefOrVal=E$;function T$(e){return mm(decodeURIComponent(e))}M.unescapeFragment=T$;function R$(e){return encodeURIComponent(ka(e))}M.escapeFragment=R$;function ka(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}M.escapeJsonPointer=ka;function mm(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}M.unescapeJsonPointer=mm;function O$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}M.eachItem=O$;function lm({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof G.Name?(s instanceof G.Name?e(n,s,i):t(n,s,i),i):s instanceof G.Name?(t(n,i,s),s):r(s,i);return a===G.Name&&!(c instanceof G.Name)?o(n,c):c}}M.mergeEvaluated={props:lm({mergeNames:(e,t,r)=>e.if((0,G._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,G._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,G._)`${r} || {}`).code((0,G._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,G._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,G._)`${r} || {}`),Pa(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:hm}),items:lm({mergeNames:(e,t,r)=>e.if((0,G._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,G._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,G._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,G._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function hm(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,G._)`{}`);return t!==void 0&&Pa(e,r,t),r}M.evaluatedPropsToName=hm;function Pa(e,t,r){Object.keys(r).forEach(o=>e.assign((0,G._)`${t}${(0,G.getProperty)(o)}`,!0))}M.setEvaluated=Pa;var dm={};function I$(e,t){return e.scopeValue("func",{ref:t,code:dm[t.code]||(dm[t.code]=new x$._Code(t.code))})}M.useFunc=I$;var Sa;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Sa||(M.Type=Sa={}));function C$(e,t,r){if(e instanceof G.Name){let o=t===Sa.Num;return r?o?(0,G._)`"[" + ${e} + "]"`:(0,G._)`"['" + ${e} + "']"`:o?(0,G._)`"/" + ${e}`:(0,G._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,G.getProperty)(e).toString():"/"+ka(e)}M.getErrorPath=C$;function gm(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}M.checkStrictMode=gm});var ft=S(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var ve=j(),A$={data:new ve.Name("data"),valCxt:new ve.Name("valCxt"),instancePath:new ve.Name("instancePath"),parentData:new ve.Name("parentData"),parentDataProperty:new ve.Name("parentDataProperty"),rootData:new ve.Name("rootData"),dynamicAnchors:new ve.Name("dynamicAnchors"),vErrors:new ve.Name("vErrors"),errors:new ve.Name("errors"),this:new ve.Name("this"),self:new ve.Name("self"),scope:new ve.Name("scope"),json:new ve.Name("json"),jsonPos:new ve.Name("jsonPos"),jsonLen:new ve.Name("jsonLen"),jsonPart:new ve.Name("jsonPart")};Ea.default=A$});var Po=S(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.extendErrors=we.resetErrorsCount=we.reportExtraError=we.reportError=we.keyword$DataError=we.keywordError=void 0;var L=j(),Dn=U(),Se=ft();we.keywordError={message:({keyword:e})=>(0,L.str)`must pass "${e}" keyword validation`};we.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,L.str)`"${e}" keyword must be ${t} ($data)`:(0,L.str)`"${e}" keyword is invalid ($data)`};function N$(e,t=we.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=vm(e,t,r);o??(i||a)?_m(s,c):ym(n,(0,L._)`[${c}]`)}we.reportError=N$;function j$(e,t=we.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=vm(e,t,r);_m(n,a),s||i||ym(o,Se.default.vErrors)}we.reportExtraError=j$;function Z$(e,t){e.assign(Se.default.errors,t),e.if((0,L._)`${Se.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,L._)`${Se.default.vErrors}.length`,t),()=>e.assign(Se.default.vErrors,null)))}we.resetErrorsCount=Z$;function M$({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,Se.default.errors,a=>{e.const(i,(0,L._)`${Se.default.vErrors}[${a}]`),e.if((0,L._)`${i}.instancePath === undefined`,()=>e.assign((0,L._)`${i}.instancePath`,(0,L.strConcat)(Se.default.instancePath,s.errorPath))),e.assign((0,L._)`${i}.schemaPath`,(0,L.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,L._)`${i}.schema`,r),e.assign((0,L._)`${i}.data`,o))})}we.extendErrors=M$;function _m(e,t){let r=e.const("err",t);e.if((0,L._)`${Se.default.vErrors} === null`,()=>e.assign(Se.default.vErrors,(0,L._)`[${r}]`),(0,L._)`${Se.default.vErrors}.push(${r})`),e.code((0,L._)`${Se.default.errors}++`)}function ym(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;n.$async?r.throw((0,L._)`new ${e.ValidationError}(${t})`):(r.assign((0,L._)`${o}.errors`,t),r.return(!1))}var Kt={keyword:new L.Name("keyword"),schemaPath:new L.Name("schemaPath"),params:new L.Name("params"),propertyName:new L.Name("propertyName"),message:new L.Name("message"),schema:new L.Name("schema"),parentSchema:new L.Name("parentSchema")};function vm(e,t,r){let{createErrors:o}=e.it;return o===!1?(0,L._)`{}`:q$(e,t,r)}function q$(e,t,r={}){let{gen:o,it:n}=e,s=[D$(n,r),U$(e,r)];return L$(e,t,s),o.object(...s)}function D$({errorPath:e},{instancePath:t}){let r=t?(0,L.str)`${e}${(0,Dn.getErrorPath)(t,Dn.Type.Str)}`:e;return[Se.default.instancePath,(0,L.strConcat)(Se.default.instancePath,r)]}function U$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:(0,L.str)`${t}/${e}`;return r&&(n=(0,L.str)`${n}${(0,Dn.getErrorPath)(r,Dn.Type.Str)}`),[Kt.schemaPath,n]}function L$(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([Kt.keyword,n],[Kt.params,typeof t=="function"?t(e):t||(0,L._)`{}`]),c.messages&&o.push([Kt.message,typeof r=="function"?r(e):r]),c.verbose&&o.push([Kt.schema,i],[Kt.parentSchema,(0,L._)`${l}${d}`],[Se.default.data,s]),u&&o.push([Kt.propertyName,u])}});var $m=S(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.boolOrEmptySchema=_r.topBoolOrEmptySchema=void 0;var F$=Po(),V$=j(),H$=ft(),J$={message:"boolean schema is false"};function K$(e){let{gen:t,schema:r,validateName:o}=e;r===!1?wm(e,!1):typeof r=="object"&&r.$async===!0?t.return(H$.default.data):(t.assign((0,V$._)`${o}.errors`,null),t.return(!0))}_r.topBoolOrEmptySchema=K$;function B$(e,t){let{gen:r,schema:o}=e;o===!1?(r.var(t,!1),wm(e)):r.var(t,!0)}_r.boolOrEmptySchema=B$;function wm(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,F$.reportError)(n,J$,void 0,t)}});var Ta=S(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.getRules=yr.isJSONType=void 0;var W$=["string","number","integer","boolean","null","object","array"],G$=new Set(W$);function Y$(e){return typeof e=="string"&&G$.has(e)}yr.isJSONType=Y$;function Q$(){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:{}}}yr.getRules=Q$});var Ra=S(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.shouldUseRule=Pt.shouldUseGroup=Pt.schemaHasRulesForType=void 0;function X$({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&bm(e,o)}Pt.schemaHasRulesForType=X$;function bm(e,t){return t.rules.some(r=>zm(e,r))}Pt.shouldUseGroup=bm;function zm(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(o=>e[o]!==void 0))}Pt.shouldUseRule=zm});var Eo=S($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.reportTypeError=$e.checkDataTypes=$e.checkDataType=$e.coerceAndCheckDataType=$e.getJSONTypes=$e.getSchemaTypes=$e.DataType=void 0;var eb=Ta(),tb=Ra(),rb=Po(),N=j(),xm=U(),vr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(vr||($e.DataType=vr={}));function ob(e){let t=Sm(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}$e.getSchemaTypes=ob;function Sm(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(eb.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}$e.getJSONTypes=Sm;function nb(e,t){let{gen:r,data:o,opts:n}=e,s=sb(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,tb.schemaHasRulesForType)(e,t[0]));if(i){let a=Ia(t,o,n.strictNumbers,vr.Wrong);r.if(a,()=>{s.length?ib(e,t,s):Ca(e)})}return i}$e.coerceAndCheckDataType=nb;var km=new Set(["string","number","integer","boolean","null"]);function sb(e,t){return t?e.filter(r=>km.has(r)||t==="array"&&r==="array"):[]}function ib(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",(0,N._)`typeof ${n}`),a=o.let("coerced",(0,N._)`undefined`);s.coerceTypes==="array"&&o.if((0,N._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,N._)`${n}[0]`).assign(i,(0,N._)`typeof ${n}`).if(Ia(t,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,N._)`${a} !== undefined`);for(let u of r)(km.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Ca(e),o.endIf(),o.if((0,N._)`${a} !== undefined`,()=>{o.assign(n,a),ab(e,a)});function c(u){switch(u){case"string":o.elseIf((0,N._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,N._)`"" + ${n}`).elseIf((0,N._)`${n} === null`).assign(a,(0,N._)`""`);return;case"number":o.elseIf((0,N._)`${i} == "boolean" || ${n} === null
10
10
  || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,N._)`+${n}`);return;case"integer":o.elseIf((0,N._)`${i} === "boolean" || ${n} === null
11
11
  || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,N._)`+${n}`);return;case"boolean":o.elseIf((0,N._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,N._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,N._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,N._)`${i} === "string" || ${i} === "number"
12
- || ${i} === "boolean" || ${n} === null`).assign(a,(0,N._)`[${n}]`)}}}function Rw({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,N._)`${t} !== undefined`,()=>e.assign((0,N._)`${t}[${r}]`,o))}function ya(e,t,r,o=vr.Correct){let n=o===vr.Correct?N.operators.EQ:N.operators.NEQ,s;switch(e){case"null":return(0,N._)`${t} ${n} null`;case"array":s=(0,N._)`Array.isArray(${t})`;break;case"object":s=(0,N._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,N._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,N._)`typeof ${t} ${n} ${e}`}return o===vr.Correct?s:(0,N.not)(s);function i(a=N.nil){return(0,N.and)((0,N._)`typeof ${t} == "number"`,a,r?(0,N._)`isFinite(${t})`:N.nil)}}be.checkDataType=ya;function va(e,t,r,o){if(e.length===1)return ya(e[0],t,r,o);let n,s=(0,am.toHash)(e);if(s.array&&s.object){let i=(0,N._)`typeof ${t} != "object"`;n=s.null?i:(0,N._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=N.nil;s.number&&delete s.integer;for(let i in s)n=(0,N.and)(n,ya(i,t,r,o));return n}be.checkDataTypes=va;var Ow={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,N._)`{type: ${e}}`:(0,N._)`{type: ${t}}`};function $a(e){let t=Iw(e);(0,Sw.reportError)(t,Ow)}be.reportTypeError=$a;function Iw(e){let{gen:t,data:r,schema:o}=e,n=(0,am.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var dm=S(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.assignDefaults=void 0;var $r=j(),Aw=U();function Cw(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)lm(e,n,r[n].default);else t==="array"&&Array.isArray(o)&&o.forEach((n,s)=>lm(e,s,n.default))}qn.assignDefaults=Cw;function lm(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=(0,$r._)`${s}${(0,$r.getProperty)(t)}`;if(n){(0,Aw.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,$r._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,$r._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,$r._)`${a} = ${(0,$r.stringify)(r)}`)}});var Le=S(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.validateUnion=J.validateArray=J.usePattern=J.callValidateCode=J.schemaProperties=J.allSchemaProperties=J.noPropertyInData=J.propertyInData=J.isOwnProperty=J.hasPropFunc=J.reportMissingProp=J.checkMissingProp=J.checkReportMissingProp=void 0;var ee=j(),wa=U(),Pt=dt(),Nw=U();function jw(e,t){let{gen:r,data:o,it:n}=e;r.if(za(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ee._)`${t}`},!0),e.error()})}J.checkReportMissingProp=jw;function Zw({gen:e,data:t,it:{opts:r}},o,n){return(0,ee.or)(...o.map(s=>(0,ee.and)(za(e,t,s,r.ownProperties),(0,ee._)`${n} = ${s}`)))}J.checkMissingProp=Zw;function qw(e,t){e.setParams({missingProperty:t},!0),e.error()}J.reportMissingProp=qw;function pm(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ee._)`Object.prototype.hasOwnProperty`})}J.hasPropFunc=pm;function ba(e,t,r){return(0,ee._)`${pm(e)}.call(${t}, ${r})`}J.isOwnProperty=ba;function Mw(e,t,r,o){let n=(0,ee._)`${t}${(0,ee.getProperty)(r)} !== undefined`;return o?(0,ee._)`${n} && ${ba(e,t,r)}`:n}J.propertyInData=Mw;function za(e,t,r,o){let n=(0,ee._)`${t}${(0,ee.getProperty)(r)} === undefined`;return o?(0,ee.or)(n,(0,ee.not)(ba(e,t,r))):n}J.noPropertyInData=za;function fm(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}J.allSchemaProperties=fm;function Dw(e,t){return fm(t).filter(r=>!(0,wa.alwaysValidSchema)(e,t[r]))}J.schemaProperties=Dw;function Uw({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,ee._)`${e}, ${t}, ${o}${n}`:t,d=[[Pt.default.instancePath,(0,ee.strConcat)(Pt.default.instancePath,s)],[Pt.default.parentData,i.parentData],[Pt.default.parentDataProperty,i.parentDataProperty],[Pt.default.rootData,Pt.default.rootData]];i.opts.dynamicRef&&d.push([Pt.default.dynamicAnchors,Pt.default.dynamicAnchors]);let f=(0,ee._)`${l}, ${r.object(...d)}`;return c!==ee.nil?(0,ee._)`${a}.call(${c}, ${f})`:(0,ee._)`${a}(${f})`}J.callValidateCode=Uw;var Lw=(0,ee._)`new RegExp`;function Fw({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ee._)`${n.code==="new RegExp"?Lw:(0,Nw.useFunc)(e,n)}(${r}, ${o})`})}J.usePattern=Fw;function Vw(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,ee._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:wa.Type.Num},s),t.if((0,ee.not)(s),a)})}}J.validateArray=Vw;function Hw(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,wa.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,ee._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,ee.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}J.validateUnion=Hw});var gm=S(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.validateKeywordUsage=Xe.validSchemaType=Xe.funcKeywordCode=Xe.macroKeywordCode=void 0;var ke=j(),Vt=dt(),Kw=Le(),Jw=fo();function Bw(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=hm(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:ke.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Xe.macroKeywordCode=Bw;function Ww(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;Yw(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=hm(o,n,u),d=o.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)_(),t.modifying&&mm(e),v(()=>e.error());else{let $=t.async?m():h();t.modifying&&mm(e),v(()=>Gw(e,$))}}function m(){let $=o.let("ruleErrs",null);return o.try(()=>_((0,ke._)`await `),k=>o.assign(d,!1).if((0,ke._)`${k} instanceof ${c.ValidationError}`,()=>o.assign($,(0,ke._)`${k}.errors`),()=>o.throw(k))),$}function h(){let $=(0,ke._)`${l}.errors`;return o.assign($,null),_(ke.nil),$}function _($=t.async?(0,ke._)`await `:ke.nil){let k=c.opts.passContext?Vt.default.this:Vt.default.self,z=!("compile"in t&&!a||t.schema===!1);o.assign(d,(0,ke._)`${$}${(0,Kw.callValidateCode)(e,l,k,z)}`,t.modifying)}function v($){var k;o.if((0,ke.not)((k=t.valid)!==null&&k!==void 0?k:d),$)}}Xe.funcKeywordCode=Ww;function mm(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,ke._)`${o.parentData}[${o.parentDataProperty}]`))}function Gw(e,t){let{gen:r}=e;r.if((0,ke._)`Array.isArray(${t})`,()=>{r.assign(Vt.default.vErrors,(0,ke._)`${Vt.default.vErrors} === null ? ${t} : ${Vt.default.vErrors}.concat(${t})`).assign(Vt.default.errors,(0,ke._)`${Vt.default.vErrors}.length`),(0,Jw.extendErrors)(e)},()=>e.error())}function Yw({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function hm(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,ke.stringify)(r)})}function Qw(e,t,r=!1){return!t.length||t.some(o=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}Xe.validSchemaType=Qw;function Xw({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Xe.validateKeywordUsage=Xw});var ym=S(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.extendSubschemaMode=Et.extendSubschemaData=Et.getSubschema=void 0;var et=j(),_m=U();function eb(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,et._)`${e.schemaPath}${(0,et.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,et._)`${e.schemaPath}${(0,et.getProperty)(t)}${(0,et.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,_m.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Et.getSubschema=eb;function tb(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=a.let("data",(0,et._)`${t.data}${(0,et.getProperty)(r)}`,!0);c(f),e.errorPath=(0,et.str)`${u}${(0,_m.getErrorPath)(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=(0,et._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof et.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);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]}}Et.extendSubschemaData=tb;function rb(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(e.compositeRule=o),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Et.extendSubschemaMode=rb});var xa=S((JI,vm)=>{"use strict";vm.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 o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var wm=S((BI,$m)=>{"use strict";var Tt=$m.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Mn(t,o,n,e,"",e)};Tt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Tt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Tt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Tt.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 Mn(e,t,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Tt.arrayKeywords)for(var f=0;f<d.length;f++)Mn(e,t,r,d[f],n+"/"+l+"/"+f,s,n,l,o,f)}else if(l in Tt.propsKeywords){if(d&&typeof d=="object")for(var m in d)Mn(e,t,r,d[m],n+"/"+l+"/"+ob(m),s,n,l,o,m)}else(l in Tt.keywords||e.allKeys&&!(l in Tt.skipKeywords))&&Mn(e,t,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function ob(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ho=S(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.getSchemaRefs=Ae.resolveUrl=Ae.normalizeId=Ae._getFullPath=Ae.getFullPath=Ae.inlineRef=void 0;var nb=U(),sb=xa(),ib=wm(),ab=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function cb(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Sa(e):t?bm(e)<=t:!1}Ae.inlineRef=cb;var ub=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Sa(e){for(let t in e){if(ub.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Sa)||typeof r=="object"&&Sa(r))return!0}return!1}function bm(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!ab.has(r)&&(typeof e[r]=="object"&&(0,nb.eachItem)(e[r],o=>t+=bm(o)),t===1/0))return 1/0}return t}function zm(e,t="",r){r!==!1&&(t=wr(t));let o=e.parse(t);return xm(e,o)}Ae.getFullPath=zm;function xm(e,t){return e.serialize(t).split("#")[0]+"#"}Ae._getFullPath=xm;var lb=/#\/?$/;function wr(e){return e?e.replace(lb,""):""}Ae.normalizeId=wr;function db(e,t,r){return r=wr(r),e.resolve(t,r)}Ae.resolveUrl=db;var pb=/^[a-z_][-a-z0-9._]*$/i;function fb(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=wr(e[r]||t),s={"":n},i=zm(o,n,!1),a={},c=new Set;return ib(e,{allKeys:!0},(d,f,m,h)=>{if(h===void 0)return;let _=i+f,v=s[h];typeof d[r]=="string"&&(v=$.call(this,d[r])),k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),s[f]=v;function $(z){let P=this.opts.uriResolver.resolve;if(z=wr(v?P(v,z):z),c.has(z))throw l(z);c.add(z);let y=this.refs[z];return typeof y=="string"&&(y=this.refs[y]),typeof y=="object"?u(d,y.schema,z):z!==wr(_)&&(z[0]==="#"?(u(d,a[z],z),a[z]=d):this.refs[z]=_),z}function k(z){if(typeof z=="string"){if(!pb.test(z))throw new Error(`invalid anchor "${z}"`);$.call(this,`#${z}`)}}}),a;function u(d,f,m){if(f!==void 0&&!sb(d,f))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ae.getSchemaRefs=fb});var yo=S(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.getData=Rt.KeywordCxt=Rt.validateFunctionCode=void 0;var Tm=nm(),Sm=mo(),Pa=_a(),Dn=mo(),mb=dm(),_o=gm(),ka=ym(),T=j(),C=dt(),hb=ho(),pt=U(),go=fo();function gb(e){if(Im(e)&&(Am(e),Om(e))){vb(e);return}Rm(e,()=>(0,Tm.topBoolOrEmptySchema)(e))}Rt.validateFunctionCode=gb;function Rm({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){n.code.es5?e.func(t,(0,T._)`${C.default.data}, ${C.default.valCxt}`,o.$async,()=>{e.code((0,T._)`"use strict"; ${km(r,n)}`),yb(e,n),e.code(s)}):e.func(t,(0,T._)`${C.default.data}, ${_b(n)}`,o.$async,()=>e.code(km(r,n)).code(s))}function _b(e){return(0,T._)`{${C.default.instancePath}="", ${C.default.parentData}, ${C.default.parentDataProperty}, ${C.default.rootData}=${C.default.data}${e.dynamicRef?(0,T._)`, ${C.default.dynamicAnchors}={}`:T.nil}}={}`}function yb(e,t){e.if(C.default.valCxt,()=>{e.var(C.default.instancePath,(0,T._)`${C.default.valCxt}.${C.default.instancePath}`),e.var(C.default.parentData,(0,T._)`${C.default.valCxt}.${C.default.parentData}`),e.var(C.default.parentDataProperty,(0,T._)`${C.default.valCxt}.${C.default.parentDataProperty}`),e.var(C.default.rootData,(0,T._)`${C.default.valCxt}.${C.default.rootData}`),t.dynamicRef&&e.var(C.default.dynamicAnchors,(0,T._)`${C.default.valCxt}.${C.default.dynamicAnchors}`)},()=>{e.var(C.default.instancePath,(0,T._)`""`),e.var(C.default.parentData,(0,T._)`undefined`),e.var(C.default.parentDataProperty,(0,T._)`undefined`),e.var(C.default.rootData,C.default.data),t.dynamicRef&&e.var(C.default.dynamicAnchors,(0,T._)`{}`)})}function vb(e){let{schema:t,opts:r,gen:o}=e;Rm(e,()=>{r.$comment&&t.$comment&&Nm(e),xb(e),o.let(C.default.vErrors,null),o.let(C.default.errors,0),r.unevaluated&&$b(e),Cm(e),Pb(e)})}function $b(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,T._)`${r}.evaluated`),t.if((0,T._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,T._)`${e.evaluated}.props`,(0,T._)`undefined`)),t.if((0,T._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,T._)`${e.evaluated}.items`,(0,T._)`undefined`))}function km(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,T._)`/*# sourceURL=${r} */`:T.nil}function wb(e,t){if(Im(e)&&(Am(e),Om(e))){bb(e,t);return}(0,Tm.boolOrEmptySchema)(e,t)}function Om({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 Im(e){return typeof e.schema!="boolean"}function bb(e,t){let{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&Nm(e),Sb(e),kb(e);let s=o.const("_errs",C.default.errors);Cm(e,s),o.var(t,(0,T._)`${s} === ${C.default.errors}`)}function Am(e){(0,pt.checkUnknownRules)(e),zb(e)}function Cm(e,t){if(e.opts.jtd)return Pm(e,[],!1,t);let r=(0,Sm.getSchemaTypes)(e.schema),o=(0,Sm.coerceAndCheckDataType)(e,r);Pm(e,r,!o,t)}function zb(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,pt.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function xb(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,pt.checkStrictMode)(e,"default is ignored in the schema root")}function Sb(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,hb.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function kb(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Nm({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,T._)`${C.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,T.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,T._)`${C.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Pb(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;r.$async?t.if((0,T._)`${C.default.errors} === 0`,()=>t.return(C.default.data),()=>t.throw((0,T._)`new ${n}(${C.default.vErrors})`)):(t.assign((0,T._)`${o}.errors`,C.default.vErrors),s.unevaluated&&Eb(e),t.return((0,T._)`${C.default.errors} === 0`))}function Eb({gen:e,evaluated:t,props:r,items:o}){r instanceof T.Name&&e.assign((0,T._)`${t}.props`,r),o instanceof T.Name&&e.assign((0,T._)`${t}.items`,o)}function Pm(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,pt.schemaHasRulesButRef)(s,l))){n.block(()=>Zm(e,"$ref",l.all.$ref.definition));return}c.jtd||Tb(e,t),n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,Pa.shouldUseGroup)(s,f)&&(f.type?(n.if((0,Dn.checkDataType)(f.type,i,c.strictNumbers)),Em(e,f),t.length===1&&t[0]===f.type&&r&&(n.else(),(0,Dn.reportTypeError)(e)),n.endIf()):Em(e,f),a||n.if((0,T._)`${C.default.errors} === ${o||0}`))}}function Em(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;n&&(0,mb.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Pa.shouldUseRule)(o,s)&&Zm(e,s.keyword,s.definition,t.type)})}function Tb(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Rb(e,t),e.opts.allowUnionTypes||Ob(e,t),Ib(e,e.dataTypes))}function Rb(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{jm(e.dataTypes,r)||Ea(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Cb(e,t)}}function Ob(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Ea(e,"use allowUnionTypes to allow union type keyword")}function Ib(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Pa.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Ab(t,i))&&Ea(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Ab(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function jm(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Cb(e,t){let r=[];for(let o of e.dataTypes)jm(t,o)?r.push(o):t.includes("integer")&&o==="number"&&r.push("integer");e.dataTypes=r}function Ea(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,pt.checkStrictMode)(e,t,e.opts.strictTypes)}var Un=class{constructor(t,r,o){if((0,_o.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,pt.schemaRefOrVal)(t,this.schema,o,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",qm(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,_o.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",C.default.errors))}result(t,r,o){this.failResult((0,T.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():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,T.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,T._)`${r} !== undefined && (${(0,T.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?go.reportExtraError:go.reportError)(this,this.def.error,r)}$dataError(){(0,go.reportError)(this,this.def.$dataError||go.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,go.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,o=T.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=T.nil,r=T.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,T.or)((0,T._)`${n} === undefined`,r)),t!==T.nil&&o.assign(t,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==T.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,T.or)(i(),a());function i(){if(o.length){if(!(r instanceof T.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,T._)`${(0,Dn.checkDataTypes)(c,r,s.opts.strictNumbers,Dn.DataType.Wrong)}`}return T.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,T._)`!${c}(${r})`}return T.nil}}subschema(t,r){let o=(0,ka.getSubschema)(this.it,t);(0,ka.extendSubschemaData)(o,this.it,t),(0,ka.extendSubschemaMode)(o,t);let n={...this.it,...o,items:void 0,props:void 0};return wb(n,r),n}mergeEvaluated(t,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&t.props!==void 0&&(o.props=pt.mergeEvaluated.props(n,t.props,o.props,r)),o.items!==!0&&t.items!==void 0&&(o.items=pt.mergeEvaluated.items(n,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,T.Name)),!0}};Rt.KeywordCxt=Un;function Zm(e,t,r,o){let n=new Un(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,_o.funcKeywordCode)(n,r):"macro"in r?(0,_o.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,_o.funcKeywordCode)(n,r)}var Nb=/^\/(?:[^~]|~0|~1)*$/,jb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qm(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return C.default.rootData;if(e[0]==="/"){if(!Nb.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,s=C.default.rootData}else{let u=jb.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=t)throw new Error(c("property/index",l));return o[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,T._)`${s}${(0,T.getProperty)((0,pt.unescapeJsonPointer)(u))}`,i=(0,T._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Rt.getData=qm});var Ln=S(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var Ta=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Ra.default=Ta});var vo=S(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var Oa=ho(),Ia=class extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Oa.resolveUrl)(t,r,o),this.missingSchema=(0,Oa.normalizeId)((0,Oa.getFullPath)(t,this.missingRef))}};Aa.default=Ia});var Vn=S(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.resolveSchema=Fe.getCompilingSchema=Fe.resolveRef=Fe.compileSchema=Fe.SchemaEnv=void 0;var Be=j(),Zb=Ln(),Ht=dt(),We=ho(),Mm=U(),qb=yo(),br=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let o;typeof t.schema=="object"&&(o=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,We.normalizeId)(o?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=o?.$async,this.refs={}}};Fe.SchemaEnv=br;function Na(e){let t=Dm.call(this,e);if(t)return t;let r=(0,We.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Be.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:Zb.default,code:(0,Be._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ht.default.data,parentData:Ht.default.parentData,parentDataProperty:Ht.default.parentDataProperty,dataNames:[Ht.default.data],dataPathArr:[Be.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Be.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Be.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Be._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,qb.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Ht.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let m=new Function(`${Ht.default.self}`,`${Ht.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:_}=u;m.evaluated={props:h instanceof Be.Name?void 0:h,items:_ instanceof Be.Name?void 0:_,dynamicProps:h instanceof Be.Name,dynamicItems:_ instanceof Be.Name},m.source&&(m.source.evaluated=(0,Be.stringify)(m.evaluated))}return e.validate=m,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)}}Fe.compileSchema=Na;function Mb(e,t,r){var o;r=(0,We.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=Lb.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new br({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=Db.call(this,s)}Fe.resolveRef=Mb;function Db(e){return(0,We.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Na.call(this,e)}function Dm(e){for(let t of this._compilations)if(Ub(t,e))return t}Fe.getCompilingSchema=Dm;function Ub(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Lb(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Fn.call(this,e,t)}function Fn(e,t){let r=this.opts.uriResolver.parse(t),o=(0,We._getFullPath)(this.opts.uriResolver,r),n=(0,We.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return Ca.call(this,r,e);let s=(0,We.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Fn.call(this,e,i);return typeof a?.schema!="object"?void 0:Ca.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Na.call(this,i),s===(0,We.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,We.resolveUrl)(this.opts.uriResolver,n,u)),new br({schema:a,schemaId:c,root:e,baseId:n})}return Ca.call(this,r,i)}}Fe.resolveSchema=Fn;var Fb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ca(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Mm.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Fb.has(a)&&u&&(t=(0,We.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Mm.schemaHasRulesButRef)(r,this.RULES)){let a=(0,We.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=Fn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new br({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s}});var Um=S((e1,Vb)=>{Vb.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 qa=S((t1,Jm)=>{"use strict";var Hb=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Fm=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),ja=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Vm=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Kb=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Za(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(r=e[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Jb=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Lm(e){return e.length=0,!0}function Bb(e,t,r){if(e.length){let o=Za(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function Wb(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Bb;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=Lm}else{n.push(u);continue}}return n.length&&(a===Lm?r.zone=n.join(""):i?o.push(n.join("")):o.push(Za(n))),r.address=o.join(""),r}function Hm(e){if(Gb(e,":")<2)return{host:e,isIPV6:!1};let t=Wb(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,o=t.address;return t.zone&&(r+="%"+t.zone,o+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:o}}}function Gb(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}function Yb(e){let t=e,r=[],o=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===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(n===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((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var Qb={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Xb=/[@/?#:]/g,e0=/[@/?#]/g;function Km(e,t){let r=t?e0:Xb;return r.lastIndex=0,e.replace(r,o=>Qb[o])}function t0(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(ja(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&Vm(i)?r+=i:r+="%"+s,o+=2;continue}}r+=e[o]}return r}function r0(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(ja(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&Vm(s)?t+=s:t+="%"+n,r+=2;continue}}Kb(e[r])?t+=e[r]:t+=escape(e[r])}return t}function o0(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(ja(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function n0(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Fm(r)){let o=Hm(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=Km(r,!1)}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}Jm.exports={nonSimpleDomain:Jb,recomposeAuthority:n0,reescapeHostDelimiters:Km,normalizePercentEncoding:t0,normalizePathEncoding:r0,escapePreservingEscapes:o0,removeDotSegments:Yb,isIPv4:Fm,isUUID:Hb,normalizeIPv6:Hm,stringArrayToHexStripped:Za}});var Qm=S((r1,Ym)=>{"use strict";var{isUUID:s0}=qa(),i0=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,a0=["http","https","ws","wss","urn","urn:uuid"];function c0(e){return a0.indexOf(e)!==-1}function Ma(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 Bm(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Wm(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 u0(e){return e.secure=Ma(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function l0(e){if((e.port===(Ma(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 d0(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(i0);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=Da(n);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function p0(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=Da(n);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function f0(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!s0(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function m0(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Gm={scheme:"http",domainHost:!0,parse:Bm,serialize:Wm},h0={scheme:"https",domainHost:Gm.domainHost,parse:Bm,serialize:Wm},Hn={scheme:"ws",domainHost:!0,parse:u0,serialize:l0},g0={scheme:"wss",domainHost:Hn.domainHost,parse:Hn.parse,serialize:Hn.serialize},_0={scheme:"urn",parse:d0,serialize:p0,skipNormalize:!0},y0={scheme:"urn:uuid",parse:f0,serialize:m0,skipNormalize:!0},Kn={http:Gm,https:h0,ws:Hn,wss:g0,urn:_0,"urn:uuid":y0};Object.setPrototypeOf(Kn,null);function Da(e){return e&&(Kn[e]||Kn[e.toLowerCase()])||void 0}Ym.exports={wsIsSecure:Ma,SCHEMES:Kn,isValidSchemeName:c0,getSchemeHandler:Da}});var nh=S((o1,Jn)=>{"use strict";var{normalizeIPv6:v0,removeDotSegments:$o,recomposeAuthority:$0,normalizePercentEncoding:w0,normalizePathEncoding:b0,escapePreservingEscapes:z0,reescapeHostDelimiters:x0,isIPv4:S0,nonSimpleDomain:k0}=qa(),{SCHEMES:P0,getSchemeHandler:eh}=Qm();function E0(e,t){return typeof e=="string"?e=C0(e,t):typeof e=="object"&&(e=zr(Kt(e,t),t)),e}function T0(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=th(zr(e,o),zr(t,o),o,!0);return o.skipEscape=!0,Kt(n,o)}function th(e,t,r,o){let n={};return o||(e=zr(Kt(e,r),r),t=zr(Kt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=$o(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=$o(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=$o(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=$o(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function R0(e,t,r){let o=Xm(e,r),n=Xm(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Kt(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:""},o=Object.assign({},t),n=[],s=eh(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=w0(r.path):(r.path=z0(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=$0(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=$o(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var O0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,I0=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/;function A0(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function rh(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(I0);i!==null&&i[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let a=e.match(O0);if(a){o.scheme=a[1],o.userinfo=a[3],o.host=a[4],o.port=parseInt(a[5],10),o.path=a[6]||"",o.query=a[7],o.fragment=a[8],isNaN(o.port)&&(o.port=a[5]);let c=A0(o,a);if(c!==void 0&&(o.error=o.error||c,n=!0),o.host)if(S0(o.host)===!1){let d=v0(o.host);o.host=d.host.toLowerCase(),s=d.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let u=eh(r.scheme||o.scheme);if(!r.unicodeSupport&&(!u||!u.unicodeSupport)&&o.host&&(r.domainHost||u&&u.domainHost)&&s===!1&&k0(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(l){o.error=o.error||"Host's domain name can not be converted to ASCII: "+l}if((!u||u&&!u.skipNormalize)&&(e.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=x0(unescape(o.host),s))),o.path&&(o.path=b0(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}u&&u.parse&&u.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function zr(e,t){return rh(e,t).parsed}function C0(e,t){return oh(e,t).normalized}function oh(e,t){let{parsed:r,malformedAuthorityOrPort:o}=rh(e,t);return{normalized:o?e:Kt(r,t),malformedAuthorityOrPort:o}}function Xm(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:o}=oh(e,t);return o?void 0:r}if(typeof e=="object")return Kt(e,t)}var Ua={SCHEMES:P0,normalize:E0,resolve:T0,resolveComponent:th,equal:R0,serialize:Kt,parse:zr};Jn.exports=Ua;Jn.exports.default=Ua;Jn.exports.fastUri=Ua});var ih=S(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var sh=nh();sh.code='require("ajv/dist/runtime/uri").default';La.default=sh});var mh=S(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=void 0;var N0=yo();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return N0.KeywordCxt}});var xr=j();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return xr._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return xr.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return xr.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return xr.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return xr.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return xr.CodeGen}});var j0=Ln(),dh=vo(),Z0=ga(),wo=Vn(),q0=j(),bo=ho(),Bn=mo(),Va=U(),ah=Um(),M0=ih(),ph=(e,t)=>new RegExp(e,t);ph.code="new RegExp";var D0=["removeAdditional","useDefaults","coerceTypes"],U0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),L0={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."},F0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},ch=200;function V0(e){var t,r,o,n,s,i,a,c,u,l,d,f,m,h,_,v,$,k,z,P,y,w,A,se,ie;let Ee=e.strict,Cr=(t=e.code)===null||t===void 0?void 0:t.optimize,Bo=Cr===!0||Cr===void 0?1:Cr||0,Wo=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:ph,_t=(n=e.uriResolver)!==null&&n!==void 0?n:M0.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:Ee)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Ee)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ee)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:Ee)!==null&&f!==void 0?f:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:Ee)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:Bo,regExp:Wo}:{optimize:Bo,regExp:Wo},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:ch,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:ch,meta:($=e.meta)!==null&&$!==void 0?$:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(z=e.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(P=e.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(y=e.addUsedSchema)!==null&&y!==void 0?y:!0,validateSchema:(w=e.validateSchema)!==null&&w!==void 0?w:!0,validateFormats:(A=e.validateFormats)!==null&&A!==void 0?A:!0,unicodeRegExp:(se=e.unicodeRegExp)!==null&&se!==void 0?se:!0,int32range:(ie=e.int32range)!==null&&ie!==void 0?ie:!0,uriResolver:_t}}var zo=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...V0(t)};let{es5:r,lines:o}=this.opts.code;this.scope=new q0.ValueScope({scope:{},prefixes:U0,es5:r,lines:o}),this.logger=G0(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Z0.getRules)(),uh.call(this,L0,t,"NOT SUPPORTED"),uh.call(this,F0,t,"DEPRECATED","warn"),this._metaOpts=B0.call(this),t.formats&&K0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&J0.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),H0.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,n=ah;o==="id"&&(n={...ah},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[o],!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 o;if(typeof t=="string"){if(o=this.getSchema(t),!o)throw new Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,t,r);async function n(l,d){await s.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||i.call(this,f)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof dh.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({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 s.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]=o(l))}finally{delete this._loading[l]}}}addSchema(t,r,o,n=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,o,n);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,bo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,n,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let o;if(o=t.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,t);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(t){let r;for(;typeof(r=lh.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:o}=this.opts,n=new wo.SchemaEnv({schema:{},schemaId:o});if(r=wo.resolveSchema.call(this,n,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=lh.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 o=t[this.opts.schemaId];return o&&(o=(0,bo.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),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 o;if(typeof t=="string")o=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof t=="object"&&r===void 0){if(r=t,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Q0.call(this,o,r),!r)return(0,Va.eachItem)(o,s=>Fa.call(this,s)),this;ez.call(this,r);let n={...r,type:(0,Bn.getJSONTypes)(r.type),schemaType:(0,Bn.getJSONTypes)(r.schemaType)};return(0,Va.eachItem)(o,n.type.length===0?s=>Fa.call(this,s,n):s=>n.type.forEach(i=>Fa.call(this,s,n,i))),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 o of r.rules){let n=o.rules.findIndex(s=>s.keyword===t);n>=0&&o.rules.splice(n,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:o="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(t,r){let o=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let s=n.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=fh(l))}}return t}_removeAllSchemas(t,r){for(let o in t){let n=t[o];(!r||r.test(o))&&(typeof n=="string"?delete t[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[o]))}}_addSchema(t,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];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;o=(0,bo.normalizeId)(i||o);let u=bo.getSchemaRefs.call(this,t,o);return c=new wo.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&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):wo.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{wo.compileSchema.call(this,t)}finally{this.opts=r}}};zo.ValidationError=j0.default;zo.MissingRefError=dh.default;ge.default=zo;function uh(e,t,r,o="error"){for(let n in e){let s=n;s in t&&this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function lh(e){return e=(0,bo.normalizeId)(e),this.schemas[e]||this.refs[e]}function H0(){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 K0(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function J0(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 B0(){let e={...this.opts};for(let t of D0)delete e[t];return e}var W0={log(){},warn(){},error(){}};function G0(e){if(e===!1)return W0;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 Y0=/^[a-z_$][a-z0-9_$:-]*$/i;function Q0(e,t){let{RULES:r}=this;if((0,Va.eachItem)(e,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Y0.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Fa(e,t,r){var o;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Bn.getJSONTypes)(t.type),schemaType:(0,Bn.getJSONTypes)(t.schemaType)}};t.before?X0.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function X0(e,t,r){let o=e.rules.findIndex(n=>n.keyword===r);o>=0?e.rules.splice(o,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=fh(t)),e.validateSchema=this.compile(t,!0))}var tz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function fh(e){return{anyOf:[e,tz]}}});var hh=S(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});var rz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ha.default=rz});var vh=S(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.callRef=Jt.getValidate=void 0;var oz=vo(),gh=Le(),Ce=j(),Sr=dt(),_h=Vn(),Wn=U(),nz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=_h.resolveRef.call(c,u,n,r);if(l===void 0)throw new oz.default(o.opts.uriResolver,n,r);if(l instanceof _h.SchemaEnv)return f(l);return m(l);function d(){if(s===u)return Gn(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return Gn(e,(0,Ce._)`${h}.validate`,u,u.$async)}function f(h){let _=yh(e,h);Gn(e,_,h,h.$async)}function m(h){let _=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Ce.stringify)(h)}:{ref:h}),v=t.name("valid"),$=e.subschema({schema:h,dataTypes:[],schemaPath:Ce.nil,topSchemaRef:_,errSchemaPath:r},v);e.mergeEvaluated($),e.ok(v)}}};function yh(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ce._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Jt.getValidate=yh;function Gn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Sr.default.this:Ce.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{n.code((0,Ce._)`await ${(0,gh.callValidateCode)(e,t,u)}`),m(t),i||n.assign(h,!0)},_=>{n.if((0,Ce._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),f(_),i||n.assign(h,!1)}),e.ok(h)}function d(){e.result((0,gh.callValidateCode)(e,t,u),()=>m(t),()=>f(t))}function f(h){let _=(0,Ce._)`${h}.errors`;n.assign(Sr.default.vErrors,(0,Ce._)`${Sr.default.vErrors} === null ? ${_} : ${Sr.default.vErrors}.concat(${_})`),n.assign(Sr.default.errors,(0,Ce._)`${Sr.default.vErrors}.length`)}function m(h){var _;if(!s.opts.unevaluated)return;let v=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(s.props=Wn.mergeEvaluated.props(n,v.props,s.props));else{let $=n.var("props",(0,Ce._)`${h}.evaluated.props`);s.props=Wn.mergeEvaluated.props(n,$,s.props,Ce.Name)}if(s.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(s.items=Wn.mergeEvaluated.items(n,v.items,s.items));else{let $=n.var("items",(0,Ce._)`${h}.evaluated.items`);s.items=Wn.mergeEvaluated.items(n,$,s.items,Ce.Name)}}}Jt.callRef=Gn;Jt.default=nz});var $h=S(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var sz=hh(),iz=vh(),az=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",sz.default,iz.default];Ka.default=az});var wh=S(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var Yn=j(),Ot=Yn.operators,Qn={maximum:{okStr:"<=",ok:Ot.LTE,fail:Ot.GT},minimum:{okStr:">=",ok:Ot.GTE,fail:Ot.LT},exclusiveMaximum:{okStr:"<",ok:Ot.LT,fail:Ot.GTE},exclusiveMinimum:{okStr:">",ok:Ot.GT,fail:Ot.LTE}},cz={message:({keyword:e,schemaCode:t})=>(0,Yn.str)`must be ${Qn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Yn._)`{comparison: ${Qn[e].okStr}, limit: ${t}}`},uz={keyword:Object.keys(Qn),type:"number",schemaType:"number",$data:!0,error:cz,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,Yn._)`${r} ${Qn[t].fail} ${o} || isNaN(${r})`)}};Ja.default=uz});var bh=S(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var xo=j(),lz={message:({schemaCode:e})=>(0,xo.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,xo._)`{multipleOf: ${e}}`},dz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:lz,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,xo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,xo._)`${i} !== parseInt(${i})`;e.fail$data((0,xo._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Ba.default=dz});var xh=S(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});function zh(e){let t=e.length,r=0,o=0,n;for(;o<t;)r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t&&(n=e.charCodeAt(o),(n&64512)===56320&&o++);return r}Wa.default=zh;zh.code='require("ajv/dist/runtime/ucs2length").default'});var Sh=S(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var Bt=j(),pz=U(),fz=xh(),mz={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Bt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Bt._)`{limit: ${e}}`},hz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:mz,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Bt.operators.GT:Bt.operators.LT,i=n.opts.unicode===!1?(0,Bt._)`${r}.length`:(0,Bt._)`${(0,pz.useFunc)(e.gen,fz.default)}(${r})`;e.fail$data((0,Bt._)`${i} ${s} ${o}`)}};Ga.default=hz});var kh=S(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});var gz=Le(),_z=U(),kr=j(),yz={message:({schemaCode:e})=>(0,kr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,kr._)`{pattern: ${e}}`},vz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:yz,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,kr._)`new RegExp`:(0,_z.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,kr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,kr._)`!${l}`)}else{let c=(0,gz.usePattern)(e,n);e.fail$data((0,kr._)`!${c}.test(${r})`)}}};Ya.default=vz});var Ph=S(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});var So=j(),$z={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,So.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,So._)`{limit: ${e}}`},wz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:$z,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?So.operators.GT:So.operators.LT;e.fail$data((0,So._)`Object.keys(${r}).length ${n} ${o}`)}};Qa.default=wz});var Eh=S(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});var ko=Le(),Po=j(),bz=U(),zz={message:({params:{missingProperty:e}})=>(0,Po.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Po._)`{missingProperty: ${e}}`},xz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:zz,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=e.parentSchema.properties,{definedProperties:h}=e.it;for(let _ of r)if(m?.[_]===void 0&&!h.has(_)){let v=i.schemaEnv.baseId+i.errSchemaPath,$=`required property "${_}" is not defined at "${v}" (strictRequired)`;(0,bz.checkStrictMode)(i,$,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Po.nil,d);else for(let m of r)(0,ko.checkReportMissingProp)(e,m)}function l(){let m=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>f(m,h)),e.ok(h)}else t.if((0,ko.checkMissingProp)(e,r,m)),(0,ko.reportMissingProp)(e,m),t.else()}function d(){t.forOf("prop",o,m=>{e.setParams({missingProperty:m}),t.if((0,ko.noPropertyInData)(t,n,m,a.ownProperties),()=>e.error())})}function f(m,h){e.setParams({missingProperty:m}),t.forOf(m,o,()=>{t.assign(h,(0,ko.propertyInData)(t,n,m,a.ownProperties)),t.if((0,Po.not)(h),()=>{e.error(),t.break()})},Po.nil)}}};Xa.default=xz});var Th=S(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});var Eo=j(),Sz={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Eo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Eo._)`{limit: ${e}}`},kz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Sz,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Eo.operators.GT:Eo.operators.LT;e.fail$data((0,Eo._)`${r}.length ${n} ${o}`)}};ec.default=kz});var Xn=S(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});var Rh=xa();Rh.code='require("ajv/dist/runtime/equal").default';tc.default=Rh});var Oh=S(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});var rc=mo(),_e=j(),Pz=U(),Ez=Xn(),Tz={message:({params:{i:e,j:t}})=>(0,_e.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,_e._)`{i: ${e}, j: ${t}}`},Rz={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Tz,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=s.items?(0,rc.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,_e._)`${i} === false`),e.ok(c);function l(){let h=t.let("i",(0,_e._)`${r}.length`),_=t.let("j");e.setParams({i:h,j:_}),t.assign(c,!0),t.if((0,_e._)`${h} > 1`,()=>(d()?f:m)(h,_))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function f(h,_){let v=t.name("item"),$=(0,rc.checkDataTypes)(u,v,a.opts.strictNumbers,rc.DataType.Wrong),k=t.const("indices",(0,_e._)`{}`);t.for((0,_e._)`;${h}--;`,()=>{t.let(v,(0,_e._)`${r}[${h}]`),t.if($,(0,_e._)`continue`),u.length>1&&t.if((0,_e._)`typeof ${v} == "string"`,(0,_e._)`${v} += "_"`),t.if((0,_e._)`typeof ${k}[${v}] == "number"`,()=>{t.assign(_,(0,_e._)`${k}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,_e._)`${k}[${v}] = ${h}`)})}function m(h,_){let v=(0,Pz.useFunc)(t,Ez.default),$=t.name("outer");t.label($).for((0,_e._)`;${h}--;`,()=>t.for((0,_e._)`${_} = ${h}; ${_}--;`,()=>t.if((0,_e._)`${v}(${r}[${h}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break($)})))}}};oc.default=Rz});var Ih=S(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var nc=j(),Oz=U(),Iz=Xn(),Az={message:"must be equal to constant",params:({schemaCode:e})=>(0,nc._)`{allowedValue: ${e}}`},Cz={keyword:"const",$data:!0,error:Az,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;o||s&&typeof s=="object"?e.fail$data((0,nc._)`!${(0,Oz.useFunc)(t,Iz.default)}(${r}, ${n})`):e.fail((0,nc._)`${s} !== ${r}`)}};sc.default=Cz});var Ah=S(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});var To=j(),Nz=U(),jz=Xn(),Zz={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,To._)`{allowedValues: ${e}}`},qz={keyword:"enum",schemaType:"array",$data:!0,error:Zz,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Nz.useFunc)(t,jz.default)),l;if(a||o)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let m=t.const("vSchema",s);l=(0,To.or)(...n.map((h,_)=>f(m,_)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,m=>t.if((0,To._)`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function f(m,h){let _=n[h];return typeof _=="object"&&_!==null?(0,To._)`${u()}(${r}, ${m}[${h}])`:(0,To._)`${r} === ${_}`}}};ic.default=qz});var Ch=S(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});var Mz=wh(),Dz=bh(),Uz=Sh(),Lz=kh(),Fz=Ph(),Vz=Eh(),Hz=Th(),Kz=Oh(),Jz=Ih(),Bz=Ah(),Wz=[Mz.default,Dz.default,Uz.default,Lz.default,Fz.default,Vz.default,Hz.default,Kz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Jz.default,Bz.default];ac.default=Wz});var uc=S(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.validateAdditionalItems=void 0;var Wt=j(),cc=U(),Gz={message:({params:{len:e}})=>(0,Wt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Wt._)`{limit: ${e}}`},Yz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Gz,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,cc.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Nh(e,o)}};function Nh(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,Wt._)`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass((0,Wt._)`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,cc.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,Wt._)`${a} <= ${t.length}`);r.if((0,Wt.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:cc.Type.Num},u),i.allErrors||r.if((0,Wt.not)(u),()=>r.break())})}}Ro.validateAdditionalItems=Nh;Ro.default=Yz});var lc=S(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.validateTuple=void 0;var jh=j(),es=U(),Qz=Le(),Xz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Zh(e,"additionalItems",t);r.items=!0,!(0,es.alwaysValidSchema)(r,t)&&e.ok((0,Qz.validateArray)(e))}};function Zh(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=es.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,jh._)`${s}.length`);r.forEach((d,f)=>{(0,es.alwaysValidSchema)(a,d)||(o.if((0,jh._)`${u} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:m}=a,h=r.length,_=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!_){let v=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,es.checkStrictMode)(a,v,f.strictTuples)}}}Oo.validateTuple=Zh;Oo.default=Xz});var qh=S(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});var ex=lc(),tx={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,ex.validateTuple)(e,"items")};dc.default=tx});var Dh=S(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var Mh=j(),rx=U(),ox=Le(),nx=uc(),sx={message:({params:{len:e}})=>(0,Mh.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Mh._)`{limit: ${e}}`},ix={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:sx,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;o.items=!0,!(0,rx.alwaysValidSchema)(o,t)&&(n?(0,nx.validateAdditionalItems)(e,n):e.ok((0,ox.validateArray)(e)))}};pc.default=ix});var Uh=S(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var Ve=j(),ts=U(),ax={message:({params:{min:e,max:t}})=>t===void 0?(0,Ve.str)`must contain at least ${e} valid item(s)`:(0,Ve.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ve._)`{minContains: ${e}}`:(0,Ve._)`{minContains: ${e}, maxContains: ${t}}`},cx={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ax,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,Ve._)`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,ts.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,ts.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ts.alwaysValidSchema)(s,r)){let _=(0,Ve._)`${l} >= ${i}`;a!==void 0&&(_=(0,Ve._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?m(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,Ve._)`${n}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let _=t.name("_valid"),v=t.let("count",0);m(_,()=>t.if(_,()=>h(v)))}function m(_,v){t.forRange("i",0,l,$=>{e.subschema({keyword:"contains",dataProp:$,dataPropType:ts.Type.Num,compositeRule:!0},_),v()})}function h(_){t.code((0,Ve._)`${_}++`),a===void 0?t.if((0,Ve._)`${_} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,Ve._)`${_} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,Ve._)`${_} >= ${i}`,()=>t.assign(d,!0)))}}};fc.default=cx});var Vh=S(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.validateSchemaDeps=tt.validatePropertyDeps=tt.error=void 0;var mc=j(),ux=U(),Io=Le();tt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return(0,mc.str)`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,mc._)`{property: ${e},
12
+ || ${i} === "boolean" || ${n} === null`).assign(a,(0,N._)`[${n}]`)}}}function ab({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,N._)`${t} !== undefined`,()=>e.assign((0,N._)`${t}[${r}]`,o))}function Oa(e,t,r,o=vr.Correct){let n=o===vr.Correct?N.operators.EQ:N.operators.NEQ,s;switch(e){case"null":return(0,N._)`${t} ${n} null`;case"array":s=(0,N._)`Array.isArray(${t})`;break;case"object":s=(0,N._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,N._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,N._)`typeof ${t} ${n} ${e}`}return o===vr.Correct?s:(0,N.not)(s);function i(a=N.nil){return(0,N.and)((0,N._)`typeof ${t} == "number"`,a,r?(0,N._)`isFinite(${t})`:N.nil)}}$e.checkDataType=Oa;function Ia(e,t,r,o){if(e.length===1)return Oa(e[0],t,r,o);let n,s=(0,xm.toHash)(e);if(s.array&&s.object){let i=(0,N._)`typeof ${t} != "object"`;n=s.null?i:(0,N._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=N.nil;s.number&&delete s.integer;for(let i in s)n=(0,N.and)(n,Oa(i,t,r,o));return n}$e.checkDataTypes=Ia;var cb={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,N._)`{type: ${e}}`:(0,N._)`{type: ${t}}`};function Ca(e){let t=ub(e);(0,rb.reportError)(t,cb)}$e.reportTypeError=Ca;function ub(e){let{gen:t,data:r,schema:o}=e,n=(0,xm.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var Em=S(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.assignDefaults=void 0;var wr=j(),lb=U();function db(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)Pm(e,n,r[n].default);else t==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Pm(e,s,n.default))}Un.assignDefaults=db;function Pm(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=(0,wr._)`${s}${(0,wr.getProperty)(t)}`;if(n){(0,lb.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,wr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,wr._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,wr._)`${a} = ${(0,wr.stringify)(r)}`)}});var Fe=S(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.validateUnion=K.validateArray=K.usePattern=K.callValidateCode=K.schemaProperties=K.allSchemaProperties=K.noPropertyInData=K.propertyInData=K.isOwnProperty=K.hasPropFunc=K.reportMissingProp=K.checkMissingProp=K.checkReportMissingProp=void 0;var ee=j(),Aa=U(),Et=ft(),pb=U();function fb(e,t){let{gen:r,data:o,it:n}=e;r.if(ja(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ee._)`${t}`},!0),e.error()})}K.checkReportMissingProp=fb;function mb({gen:e,data:t,it:{opts:r}},o,n){return(0,ee.or)(...o.map(s=>(0,ee.and)(ja(e,t,s,r.ownProperties),(0,ee._)`${n} = ${s}`)))}K.checkMissingProp=mb;function hb(e,t){e.setParams({missingProperty:t},!0),e.error()}K.reportMissingProp=hb;function Tm(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ee._)`Object.prototype.hasOwnProperty`})}K.hasPropFunc=Tm;function Na(e,t,r){return(0,ee._)`${Tm(e)}.call(${t}, ${r})`}K.isOwnProperty=Na;function gb(e,t,r,o){let n=(0,ee._)`${t}${(0,ee.getProperty)(r)} !== undefined`;return o?(0,ee._)`${n} && ${Na(e,t,r)}`:n}K.propertyInData=gb;function ja(e,t,r,o){let n=(0,ee._)`${t}${(0,ee.getProperty)(r)} === undefined`;return o?(0,ee.or)(n,(0,ee.not)(Na(e,t,r))):n}K.noPropertyInData=ja;function Rm(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}K.allSchemaProperties=Rm;function _b(e,t){return Rm(t).filter(r=>!(0,Aa.alwaysValidSchema)(e,t[r]))}K.schemaProperties=_b;function yb({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,ee._)`${e}, ${t}, ${o}${n}`:t,d=[[Et.default.instancePath,(0,ee.strConcat)(Et.default.instancePath,s)],[Et.default.parentData,i.parentData],[Et.default.parentDataProperty,i.parentDataProperty],[Et.default.rootData,Et.default.rootData]];i.opts.dynamicRef&&d.push([Et.default.dynamicAnchors,Et.default.dynamicAnchors]);let f=(0,ee._)`${l}, ${r.object(...d)}`;return c!==ee.nil?(0,ee._)`${a}.call(${c}, ${f})`:(0,ee._)`${a}(${f})`}K.callValidateCode=yb;var vb=(0,ee._)`new RegExp`;function wb({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ee._)`${n.code==="new RegExp"?vb:(0,pb.useFunc)(e,n)}(${r}, ${o})`})}K.usePattern=wb;function $b(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,ee._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:Aa.Type.Num},s),t.if((0,ee.not)(s),a)})}}K.validateArray=$b;function bb(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Aa.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,ee._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,ee.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}K.validateUnion=bb});var Cm=S(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.validateKeywordUsage=et.validSchemaType=et.funcKeywordCode=et.macroKeywordCode=void 0;var ke=j(),Bt=ft(),zb=Fe(),xb=Po();function Sb(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=Im(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:ke.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}et.macroKeywordCode=Sb;function kb(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;Eb(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Im(o,n,u),d=o.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)_(),t.modifying&&Om(e),v(()=>e.error());else{let w=t.async?m():h();t.modifying&&Om(e),v(()=>Pb(e,w))}}function m(){let w=o.let("ruleErrs",null);return o.try(()=>_((0,ke._)`await `),k=>o.assign(d,!1).if((0,ke._)`${k} instanceof ${c.ValidationError}`,()=>o.assign(w,(0,ke._)`${k}.errors`),()=>o.throw(k))),w}function h(){let w=(0,ke._)`${l}.errors`;return o.assign(w,null),_(ke.nil),w}function _(w=t.async?(0,ke._)`await `:ke.nil){let k=c.opts.passContext?Bt.default.this:Bt.default.self,z=!("compile"in t&&!a||t.schema===!1);o.assign(d,(0,ke._)`${w}${(0,zb.callValidateCode)(e,l,k,z)}`,t.modifying)}function v(w){var k;o.if((0,ke.not)((k=t.valid)!==null&&k!==void 0?k:d),w)}}et.funcKeywordCode=kb;function Om(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,ke._)`${o.parentData}[${o.parentDataProperty}]`))}function Pb(e,t){let{gen:r}=e;r.if((0,ke._)`Array.isArray(${t})`,()=>{r.assign(Bt.default.vErrors,(0,ke._)`${Bt.default.vErrors} === null ? ${t} : ${Bt.default.vErrors}.concat(${t})`).assign(Bt.default.errors,(0,ke._)`${Bt.default.vErrors}.length`),(0,xb.extendErrors)(e)},()=>e.error())}function Eb({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Im(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,ke.stringify)(r)})}function Tb(e,t,r=!1){return!t.length||t.some(o=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}et.validSchemaType=Tb;function Rb({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}et.validateKeywordUsage=Rb});var Nm=S(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.extendSubschemaMode=Tt.extendSubschemaData=Tt.getSubschema=void 0;var tt=j(),Am=U();function Ob(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,tt._)`${e.schemaPath}${(0,tt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,tt._)`${e.schemaPath}${(0,tt.getProperty)(t)}${(0,tt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Am.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Tt.getSubschema=Ob;function Ib(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=a.let("data",(0,tt._)`${t.data}${(0,tt.getProperty)(r)}`,!0);c(f),e.errorPath=(0,tt.str)`${u}${(0,Am.getErrorPath)(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=(0,tt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof tt.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);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]}}Tt.extendSubschemaData=Ib;function Cb(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(e.compositeRule=o),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Tt.extendSubschemaMode=Cb});var Za=S((m1,jm)=>{"use strict";jm.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 o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Mm=S((h1,Zm)=>{"use strict";var Rt=Zm.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Ln(t,o,n,e,"",e)};Rt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Rt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Rt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Rt.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 Ln(e,t,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in Rt.arrayKeywords)for(var f=0;f<d.length;f++)Ln(e,t,r,d[f],n+"/"+l+"/"+f,s,n,l,o,f)}else if(l in Rt.propsKeywords){if(d&&typeof d=="object")for(var m in d)Ln(e,t,r,d[m],n+"/"+l+"/"+Ab(m),s,n,l,o,m)}else(l in Rt.keywords||e.allKeys&&!(l in Rt.skipKeywords))&&Ln(e,t,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function Ab(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var To=S(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.getSchemaRefs=Ce.resolveUrl=Ce.normalizeId=Ce._getFullPath=Ce.getFullPath=Ce.inlineRef=void 0;var Nb=U(),jb=Za(),Zb=Mm(),Mb=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function qb(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Ma(e):t?qm(e)<=t:!1}Ce.inlineRef=qb;var Db=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ma(e){for(let t in e){if(Db.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ma)||typeof r=="object"&&Ma(r))return!0}return!1}function qm(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Mb.has(r)&&(typeof e[r]=="object"&&(0,Nb.eachItem)(e[r],o=>t+=qm(o)),t===1/0))return 1/0}return t}function Dm(e,t="",r){r!==!1&&(t=$r(t));let o=e.parse(t);return Um(e,o)}Ce.getFullPath=Dm;function Um(e,t){return e.serialize(t).split("#")[0]+"#"}Ce._getFullPath=Um;var Ub=/#\/?$/;function $r(e){return e?e.replace(Ub,""):""}Ce.normalizeId=$r;function Lb(e,t,r){return r=$r(r),e.resolve(t,r)}Ce.resolveUrl=Lb;var Fb=/^[a-z_][-a-z0-9._]*$/i;function Vb(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=$r(e[r]||t),s={"":n},i=Dm(o,n,!1),a={},c=new Set;return Zb(e,{allKeys:!0},(d,f,m,h)=>{if(h===void 0)return;let _=i+f,v=s[h];typeof d[r]=="string"&&(v=w.call(this,d[r])),k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),s[f]=v;function w(z){let P=this.opts.uriResolver.resolve;if(z=$r(v?P(v,z):z),c.has(z))throw l(z);c.add(z);let y=this.refs[z];return typeof y=="string"&&(y=this.refs[y]),typeof y=="object"?u(d,y.schema,z):z!==$r(_)&&(z[0]==="#"?(u(d,a[z],z),a[z]=d):this.refs[z]=_),z}function k(z){if(typeof z=="string"){if(!Fb.test(z))throw new Error(`invalid anchor "${z}"`);w.call(this,`#${z}`)}}}),a;function u(d,f,m){if(f!==void 0&&!jb(d,f))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ce.getSchemaRefs=Vb});var Io=S(Ot=>{"use strict";Object.defineProperty(Ot,"__esModule",{value:!0});Ot.getData=Ot.KeywordCxt=Ot.validateFunctionCode=void 0;var Jm=$m(),Lm=Eo(),Da=Ra(),Fn=Eo(),Hb=Em(),Oo=Cm(),qa=Nm(),T=j(),A=ft(),Jb=To(),mt=U(),Ro=Po();function Kb(e){if(Wm(e)&&(Gm(e),Bm(e))){Gb(e);return}Km(e,()=>(0,Jm.topBoolOrEmptySchema)(e))}Ot.validateFunctionCode=Kb;function Km({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){n.code.es5?e.func(t,(0,T._)`${A.default.data}, ${A.default.valCxt}`,o.$async,()=>{e.code((0,T._)`"use strict"; ${Fm(r,n)}`),Wb(e,n),e.code(s)}):e.func(t,(0,T._)`${A.default.data}, ${Bb(n)}`,o.$async,()=>e.code(Fm(r,n)).code(s))}function Bb(e){return(0,T._)`{${A.default.instancePath}="", ${A.default.parentData}, ${A.default.parentDataProperty}, ${A.default.rootData}=${A.default.data}${e.dynamicRef?(0,T._)`, ${A.default.dynamicAnchors}={}`:T.nil}}={}`}function Wb(e,t){e.if(A.default.valCxt,()=>{e.var(A.default.instancePath,(0,T._)`${A.default.valCxt}.${A.default.instancePath}`),e.var(A.default.parentData,(0,T._)`${A.default.valCxt}.${A.default.parentData}`),e.var(A.default.parentDataProperty,(0,T._)`${A.default.valCxt}.${A.default.parentDataProperty}`),e.var(A.default.rootData,(0,T._)`${A.default.valCxt}.${A.default.rootData}`),t.dynamicRef&&e.var(A.default.dynamicAnchors,(0,T._)`${A.default.valCxt}.${A.default.dynamicAnchors}`)},()=>{e.var(A.default.instancePath,(0,T._)`""`),e.var(A.default.parentData,(0,T._)`undefined`),e.var(A.default.parentDataProperty,(0,T._)`undefined`),e.var(A.default.rootData,A.default.data),t.dynamicRef&&e.var(A.default.dynamicAnchors,(0,T._)`{}`)})}function Gb(e){let{schema:t,opts:r,gen:o}=e;Km(e,()=>{r.$comment&&t.$comment&&Qm(e),t0(e),o.let(A.default.vErrors,null),o.let(A.default.errors,0),r.unevaluated&&Yb(e),Ym(e),n0(e)})}function Yb(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,T._)`${r}.evaluated`),t.if((0,T._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,T._)`${e.evaluated}.props`,(0,T._)`undefined`)),t.if((0,T._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,T._)`${e.evaluated}.items`,(0,T._)`undefined`))}function Fm(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,T._)`/*# sourceURL=${r} */`:T.nil}function Qb(e,t){if(Wm(e)&&(Gm(e),Bm(e))){Xb(e,t);return}(0,Jm.boolOrEmptySchema)(e,t)}function Bm({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 Wm(e){return typeof e.schema!="boolean"}function Xb(e,t){let{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&Qm(e),r0(e),o0(e);let s=o.const("_errs",A.default.errors);Ym(e,s),o.var(t,(0,T._)`${s} === ${A.default.errors}`)}function Gm(e){(0,mt.checkUnknownRules)(e),e0(e)}function Ym(e,t){if(e.opts.jtd)return Vm(e,[],!1,t);let r=(0,Lm.getSchemaTypes)(e.schema),o=(0,Lm.coerceAndCheckDataType)(e,r);Vm(e,r,!o,t)}function e0(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,mt.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function t0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mt.checkStrictMode)(e,"default is ignored in the schema root")}function r0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Jb.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function o0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Qm({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,T._)`${A.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,T.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,T._)`${A.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function n0(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;r.$async?t.if((0,T._)`${A.default.errors} === 0`,()=>t.return(A.default.data),()=>t.throw((0,T._)`new ${n}(${A.default.vErrors})`)):(t.assign((0,T._)`${o}.errors`,A.default.vErrors),s.unevaluated&&s0(e),t.return((0,T._)`${A.default.errors} === 0`))}function s0({gen:e,evaluated:t,props:r,items:o}){r instanceof T.Name&&e.assign((0,T._)`${t}.props`,r),o instanceof T.Name&&e.assign((0,T._)`${t}.items`,o)}function Vm(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,mt.schemaHasRulesButRef)(s,l))){n.block(()=>eh(e,"$ref",l.all.$ref.definition));return}c.jtd||i0(e,t),n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,Da.shouldUseGroup)(s,f)&&(f.type?(n.if((0,Fn.checkDataType)(f.type,i,c.strictNumbers)),Hm(e,f),t.length===1&&t[0]===f.type&&r&&(n.else(),(0,Fn.reportTypeError)(e)),n.endIf()):Hm(e,f),a||n.if((0,T._)`${A.default.errors} === ${o||0}`))}}function Hm(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;n&&(0,Hb.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Da.shouldUseRule)(o,s)&&eh(e,s.keyword,s.definition,t.type)})}function i0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(a0(e,t),e.opts.allowUnionTypes||c0(e,t),u0(e,e.dataTypes))}function a0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Xm(e.dataTypes,r)||Ua(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),d0(e,t)}}function c0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Ua(e,"use allowUnionTypes to allow union type keyword")}function u0(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Da.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>l0(t,i))&&Ua(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function l0(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Xm(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function d0(e,t){let r=[];for(let o of e.dataTypes)Xm(t,o)?r.push(o):t.includes("integer")&&o==="number"&&r.push("integer");e.dataTypes=r}function Ua(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,mt.checkStrictMode)(e,t,e.opts.strictTypes)}var Vn=class{constructor(t,r,o){if((0,Oo.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,mt.schemaRefOrVal)(t,this.schema,o,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",th(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Oo.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",A.default.errors))}result(t,r,o){this.failResult((0,T.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():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,T.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,T._)`${r} !== undefined && (${(0,T.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?Ro.reportExtraError:Ro.reportError)(this,this.def.error,r)}$dataError(){(0,Ro.reportError)(this,this.def.$dataError||Ro.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ro.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,o=T.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=T.nil,r=T.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,T.or)((0,T._)`${n} === undefined`,r)),t!==T.nil&&o.assign(t,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==T.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,T.or)(i(),a());function i(){if(o.length){if(!(r instanceof T.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,T._)`${(0,Fn.checkDataTypes)(c,r,s.opts.strictNumbers,Fn.DataType.Wrong)}`}return T.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,T._)`!${c}(${r})`}return T.nil}}subschema(t,r){let o=(0,qa.getSubschema)(this.it,t);(0,qa.extendSubschemaData)(o,this.it,t),(0,qa.extendSubschemaMode)(o,t);let n={...this.it,...o,items:void 0,props:void 0};return Qb(n,r),n}mergeEvaluated(t,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&t.props!==void 0&&(o.props=mt.mergeEvaluated.props(n,t.props,o.props,r)),o.items!==!0&&t.items!==void 0&&(o.items=mt.mergeEvaluated.items(n,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,T.Name)),!0}};Ot.KeywordCxt=Vn;function eh(e,t,r,o){let n=new Vn(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Oo.funcKeywordCode)(n,r):"macro"in r?(0,Oo.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Oo.funcKeywordCode)(n,r)}var p0=/^\/(?:[^~]|~0|~1)*$/,f0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function th(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return A.default.rootData;if(e[0]==="/"){if(!p0.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,s=A.default.rootData}else{let u=f0.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=t)throw new Error(c("property/index",l));return o[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,T._)`${s}${(0,T.getProperty)((0,mt.unescapeJsonPointer)(u))}`,i=(0,T._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Ot.getData=th});var Hn=S(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var La=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Fa.default=La});var Co=S(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var Va=To(),Ha=class extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Va.resolveUrl)(t,r,o),this.missingSchema=(0,Va.normalizeId)((0,Va.getFullPath)(t,this.missingRef))}};Ja.default=Ha});var Kn=S(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.resolveSchema=Ve.getCompilingSchema=Ve.resolveRef=Ve.compileSchema=Ve.SchemaEnv=void 0;var We=j(),m0=Hn(),Wt=ft(),Ge=To(),rh=U(),h0=Io(),br=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let o;typeof t.schema=="object"&&(o=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,Ge.normalizeId)(o?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=o?.$async,this.refs={}}};Ve.SchemaEnv=br;function Ba(e){let t=oh.call(this,e);if(t)return t;let r=(0,Ge.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new We.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:m0.default,code:(0,We._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Wt.default.data,parentData:Wt.default.parentData,parentDataProperty:Wt.default.parentDataProperty,dataNames:[Wt.default.data],dataPathArr:[We.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,We.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:We.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,We._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,h0.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Wt.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let m=new Function(`${Wt.default.self}`,`${Wt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:_}=u;m.evaluated={props:h instanceof We.Name?void 0:h,items:_ instanceof We.Name?void 0:_,dynamicProps:h instanceof We.Name,dynamicItems:_ instanceof We.Name},m.source&&(m.source.evaluated=(0,We.stringify)(m.evaluated))}return e.validate=m,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)}}Ve.compileSchema=Ba;function g0(e,t,r){var o;r=(0,Ge.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=v0.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new br({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=_0.call(this,s)}Ve.resolveRef=g0;function _0(e){return(0,Ge.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Ba.call(this,e)}function oh(e){for(let t of this._compilations)if(y0(t,e))return t}Ve.getCompilingSchema=oh;function y0(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function v0(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Jn.call(this,e,t)}function Jn(e,t){let r=this.opts.uriResolver.parse(t),o=(0,Ge._getFullPath)(this.opts.uriResolver,r),n=(0,Ge.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return Ka.call(this,r,e);let s=(0,Ge.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Jn.call(this,e,i);return typeof a?.schema!="object"?void 0:Ka.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Ba.call(this,i),s===(0,Ge.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Ge.resolveUrl)(this.opts.uriResolver,n,u)),new br({schema:a,schemaId:c,root:e,baseId:n})}return Ka.call(this,r,i)}}Ve.resolveSchema=Jn;var w0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ka(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,rh.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!w0.has(a)&&u&&(t=(0,Ge.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,rh.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Ge.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=Jn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new br({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s}});var nh=S(($1,$0)=>{$0.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 Ya=S((b1,lh)=>{"use strict";var b0=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ih=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),Wa=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),ah=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),z0=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Ga(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(r=e[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var x0=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function sh(e){return e.length=0,!0}function S0(e,t,r){if(e.length){let o=Ga(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function k0(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=S0;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=sh}else{n.push(u);continue}}return n.length&&(a===sh?r.zone=n.join(""):i?o.push(n.join("")):o.push(Ga(n))),r.address=o.join(""),r}function ch(e){if(P0(e,":")<2)return{host:e,isIPV6:!1};let t=k0(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,o=t.address;return t.zone&&(r+="%"+t.zone,o+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:o}}}function P0(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}function E0(e){let t=e,r=[],o=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===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(n===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((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var T0={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},R0=/[@/?#:]/g,O0=/[@/?#]/g;function uh(e,t){let r=t?O0:R0;return r.lastIndex=0,e.replace(r,o=>T0[o])}function I0(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(Wa(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&ah(i)?r+=i:r+="%"+s,o+=2;continue}}r+=e[o]}return r}function C0(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Wa(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&ah(s)?t+=s:t+="%"+n,r+=2;continue}}z0(e[r])?t+=e[r]:t+=escape(e[r])}return t}function A0(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Wa(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function N0(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!ih(r)){let o=ch(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=uh(r,!1)}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}lh.exports={nonSimpleDomain:x0,recomposeAuthority:N0,reescapeHostDelimiters:uh,normalizePercentEncoding:I0,normalizePathEncoding:C0,escapePreservingEscapes:A0,removeDotSegments:E0,isIPv4:ih,isUUID:b0,normalizeIPv6:ch,stringArrayToHexStripped:Ga}});var hh=S((z1,mh)=>{"use strict";var{isUUID:j0}=Ya(),Z0=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,M0=["http","https","ws","wss","urn","urn:uuid"];function q0(e){return M0.indexOf(e)!==-1}function Qa(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 dh(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function ph(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 D0(e){return e.secure=Qa(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function U0(e){if((e.port===(Qa(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 L0(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Z0);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=Xa(n);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function F0(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=Xa(n);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function V0(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!j0(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function H0(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var fh={scheme:"http",domainHost:!0,parse:dh,serialize:ph},J0={scheme:"https",domainHost:fh.domainHost,parse:dh,serialize:ph},Bn={scheme:"ws",domainHost:!0,parse:D0,serialize:U0},K0={scheme:"wss",domainHost:Bn.domainHost,parse:Bn.parse,serialize:Bn.serialize},B0={scheme:"urn",parse:L0,serialize:F0,skipNormalize:!0},W0={scheme:"urn:uuid",parse:V0,serialize:H0,skipNormalize:!0},Wn={http:fh,https:J0,ws:Bn,wss:K0,urn:B0,"urn:uuid":W0};Object.setPrototypeOf(Wn,null);function Xa(e){return e&&(Wn[e]||Wn[e.toLowerCase()])||void 0}mh.exports={wsIsSecure:Qa,SCHEMES:Wn,isValidSchemeName:q0,getSchemeHandler:Xa}});var $h=S((x1,Gn)=>{"use strict";var{normalizeIPv6:G0,removeDotSegments:Ao,recomposeAuthority:Y0,normalizePercentEncoding:Q0,normalizePathEncoding:X0,escapePreservingEscapes:ez,reescapeHostDelimiters:tz,isIPv4:rz,nonSimpleDomain:oz}=Ya(),{SCHEMES:nz,getSchemeHandler:_h}=hh();function sz(e,t){return typeof e=="string"?e=dz(e,t):typeof e=="object"&&(e=zr(Gt(e,t),t)),e}function iz(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=yh(zr(e,o),zr(t,o),o,!0);return o.skipEscape=!0,Gt(n,o)}function yh(e,t,r,o){let n={};return o||(e=zr(Gt(e,r),r),t=zr(Gt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=Ao(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=Ao(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=Ao(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=Ao(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function az(e,t,r){let o=gh(e,r),n=gh(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Gt(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:""},o=Object.assign({},t),n=[],s=_h(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=Q0(r.path):(r.path=ez(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=Y0(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=Ao(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var cz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,uz=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/;function lz(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function vh(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(uz);i!==null&&i[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let a=e.match(cz);if(a){o.scheme=a[1],o.userinfo=a[3],o.host=a[4],o.port=parseInt(a[5],10),o.path=a[6]||"",o.query=a[7],o.fragment=a[8],isNaN(o.port)&&(o.port=a[5]);let c=lz(o,a);if(c!==void 0&&(o.error=o.error||c,n=!0),o.host)if(rz(o.host)===!1){let d=G0(o.host);o.host=d.host.toLowerCase(),s=d.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let u=_h(r.scheme||o.scheme);if(!r.unicodeSupport&&(!u||!u.unicodeSupport)&&o.host&&(r.domainHost||u&&u.domainHost)&&s===!1&&oz(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(l){o.error=o.error||"Host's domain name can not be converted to ASCII: "+l}if((!u||u&&!u.skipNormalize)&&(e.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=tz(unescape(o.host),s))),o.path&&(o.path=X0(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}u&&u.parse&&u.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function zr(e,t){return vh(e,t).parsed}function dz(e,t){return wh(e,t).normalized}function wh(e,t){let{parsed:r,malformedAuthorityOrPort:o}=vh(e,t);return{normalized:o?e:Gt(r,t),malformedAuthorityOrPort:o}}function gh(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:o}=wh(e,t);return o?void 0:r}if(typeof e=="object")return Gt(e,t)}var ec={SCHEMES:nz,normalize:sz,resolve:iz,resolveComponent:yh,equal:az,serialize:Gt,parse:zr};Gn.exports=ec;Gn.exports.default=ec;Gn.exports.fastUri=ec});var zh=S(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});var bh=$h();bh.code='require("ajv/dist/runtime/uri").default';tc.default=bh});var Oh=S(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.CodeGen=_e.Name=_e.nil=_e.stringify=_e.str=_e._=_e.KeywordCxt=void 0;var pz=Io();Object.defineProperty(_e,"KeywordCxt",{enumerable:!0,get:function(){return pz.KeywordCxt}});var xr=j();Object.defineProperty(_e,"_",{enumerable:!0,get:function(){return xr._}});Object.defineProperty(_e,"str",{enumerable:!0,get:function(){return xr.str}});Object.defineProperty(_e,"stringify",{enumerable:!0,get:function(){return xr.stringify}});Object.defineProperty(_e,"nil",{enumerable:!0,get:function(){return xr.nil}});Object.defineProperty(_e,"Name",{enumerable:!0,get:function(){return xr.Name}});Object.defineProperty(_e,"CodeGen",{enumerable:!0,get:function(){return xr.CodeGen}});var fz=Hn(),Eh=Co(),mz=Ta(),No=Kn(),hz=j(),jo=To(),Yn=Eo(),oc=U(),xh=nh(),gz=zh(),Th=(e,t)=>new RegExp(e,t);Th.code="new RegExp";var _z=["removeAdditional","useDefaults","coerceTypes"],yz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),vz={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."},wz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Sh=200;function $z(e){var t,r,o,n,s,i,a,c,u,l,d,f,m,h,_,v,w,k,z,P,y,$,C,se,ie;let Ee=e.strict,Nr=(t=e.code)===null||t===void 0?void 0:t.optimize,Yo=Nr===!0||Nr===void 0?1:Nr||0,Qo=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Th,yt=(n=e.uriResolver)!==null&&n!==void 0?n:gz.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:Ee)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Ee)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ee)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:Ee)!==null&&f!==void 0?f:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:Ee)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:Yo,regExp:Qo}:{optimize:Yo,regExp:Qo},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:Sh,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:Sh,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(z=e.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(P=e.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(y=e.addUsedSchema)!==null&&y!==void 0?y:!0,validateSchema:($=e.validateSchema)!==null&&$!==void 0?$:!0,validateFormats:(C=e.validateFormats)!==null&&C!==void 0?C:!0,unicodeRegExp:(se=e.unicodeRegExp)!==null&&se!==void 0?se:!0,int32range:(ie=e.int32range)!==null&&ie!==void 0?ie:!0,uriResolver:yt}}var Zo=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...$z(t)};let{es5:r,lines:o}=this.opts.code;this.scope=new hz.ValueScope({scope:{},prefixes:yz,es5:r,lines:o}),this.logger=Pz(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,mz.getRules)(),kh.call(this,vz,t,"NOT SUPPORTED"),kh.call(this,wz,t,"DEPRECATED","warn"),this._metaOpts=Sz.call(this),t.formats&&zz.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&xz.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),bz.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,n=xh;o==="id"&&(n={...xh},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[o],!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 o;if(typeof t=="string"){if(o=this.getSchema(t),!o)throw new Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,t,r);async function n(l,d){await s.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||i.call(this,f)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Eh.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({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 s.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]=o(l))}finally{delete this._loading[l]}}}addSchema(t,r,o,n=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,o,n);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,jo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,n,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let o;if(o=t.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,t);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(t){let r;for(;typeof(r=Ph.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:o}=this.opts,n=new No.SchemaEnv({schema:{},schemaId:o});if(r=No.resolveSchema.call(this,n,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=Ph.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 o=t[this.opts.schemaId];return o&&(o=(0,jo.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),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 o;if(typeof t=="string")o=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof t=="object"&&r===void 0){if(r=t,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Tz.call(this,o,r),!r)return(0,oc.eachItem)(o,s=>rc.call(this,s)),this;Oz.call(this,r);let n={...r,type:(0,Yn.getJSONTypes)(r.type),schemaType:(0,Yn.getJSONTypes)(r.schemaType)};return(0,oc.eachItem)(o,n.type.length===0?s=>rc.call(this,s,n):s=>n.type.forEach(i=>rc.call(this,s,n,i))),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 o of r.rules){let n=o.rules.findIndex(s=>s.keyword===t);n>=0&&o.rules.splice(n,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:o="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(t,r){let o=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let s=n.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Rh(l))}}return t}_removeAllSchemas(t,r){for(let o in t){let n=t[o];(!r||r.test(o))&&(typeof n=="string"?delete t[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[o]))}}_addSchema(t,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];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;o=(0,jo.normalizeId)(i||o);let u=jo.getSchemaRefs.call(this,t,o);return c=new No.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&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):No.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{No.compileSchema.call(this,t)}finally{this.opts=r}}};Zo.ValidationError=fz.default;Zo.MissingRefError=Eh.default;_e.default=Zo;function kh(e,t,r,o="error"){for(let n in e){let s=n;s in t&&this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function Ph(e){return e=(0,jo.normalizeId)(e),this.schemas[e]||this.refs[e]}function bz(){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 zz(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function xz(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 _z)delete e[t];return e}var kz={log(){},warn(){},error(){}};function Pz(e){if(e===!1)return kz;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 Ez=/^[a-z_$][a-z0-9_$:-]*$/i;function Tz(e,t){let{RULES:r}=this;if((0,oc.eachItem)(e,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Ez.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function rc(e,t,r){var o;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Yn.getJSONTypes)(t.type),schemaType:(0,Yn.getJSONTypes)(t.schemaType)}};t.before?Rz.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function Rz(e,t,r){let o=e.rules.findIndex(n=>n.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function Oz(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Rh(t)),e.validateSchema=this.compile(t,!0))}var Iz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Rh(e){return{anyOf:[e,Iz]}}});var Ih=S(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});var Cz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};nc.default=Cz});var jh=S(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.callRef=Yt.getValidate=void 0;var Az=Co(),Ch=Fe(),Ae=j(),Sr=ft(),Ah=Kn(),Qn=U(),Nz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=Ah.resolveRef.call(c,u,n,r);if(l===void 0)throw new Az.default(o.opts.uriResolver,n,r);if(l instanceof Ah.SchemaEnv)return f(l);return m(l);function d(){if(s===u)return Xn(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return Xn(e,(0,Ae._)`${h}.validate`,u,u.$async)}function f(h){let _=Nh(e,h);Xn(e,_,h,h.$async)}function m(h){let _=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Ae.stringify)(h)}:{ref:h}),v=t.name("valid"),w=e.subschema({schema:h,dataTypes:[],schemaPath:Ae.nil,topSchemaRef:_,errSchemaPath:r},v);e.mergeEvaluated(w),e.ok(v)}}};function Nh(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ae._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Yt.getValidate=Nh;function Xn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Sr.default.this:Ae.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{n.code((0,Ae._)`await ${(0,Ch.callValidateCode)(e,t,u)}`),m(t),i||n.assign(h,!0)},_=>{n.if((0,Ae._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),f(_),i||n.assign(h,!1)}),e.ok(h)}function d(){e.result((0,Ch.callValidateCode)(e,t,u),()=>m(t),()=>f(t))}function f(h){let _=(0,Ae._)`${h}.errors`;n.assign(Sr.default.vErrors,(0,Ae._)`${Sr.default.vErrors} === null ? ${_} : ${Sr.default.vErrors}.concat(${_})`),n.assign(Sr.default.errors,(0,Ae._)`${Sr.default.vErrors}.length`)}function m(h){var _;if(!s.opts.unevaluated)return;let v=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(s.props=Qn.mergeEvaluated.props(n,v.props,s.props));else{let w=n.var("props",(0,Ae._)`${h}.evaluated.props`);s.props=Qn.mergeEvaluated.props(n,w,s.props,Ae.Name)}if(s.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(s.items=Qn.mergeEvaluated.items(n,v.items,s.items));else{let w=n.var("items",(0,Ae._)`${h}.evaluated.items`);s.items=Qn.mergeEvaluated.items(n,w,s.items,Ae.Name)}}}Yt.callRef=Xn;Yt.default=Nz});var Zh=S(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var jz=Ih(),Zz=jh(),Mz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",jz.default,Zz.default];sc.default=Mz});var Mh=S(ic=>{"use strict";Object.defineProperty(ic,"__esModule",{value:!0});var es=j(),It=es.operators,ts={maximum:{okStr:"<=",ok:It.LTE,fail:It.GT},minimum:{okStr:">=",ok:It.GTE,fail:It.LT},exclusiveMaximum:{okStr:"<",ok:It.LT,fail:It.GTE},exclusiveMinimum:{okStr:">",ok:It.GT,fail:It.LTE}},qz={message:({keyword:e,schemaCode:t})=>(0,es.str)`must be ${ts[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,es._)`{comparison: ${ts[e].okStr}, limit: ${t}}`},Dz={keyword:Object.keys(ts),type:"number",schemaType:"number",$data:!0,error:qz,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,es._)`${r} ${ts[t].fail} ${o} || isNaN(${r})`)}};ic.default=Dz});var qh=S(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});var Mo=j(),Uz={message:({schemaCode:e})=>(0,Mo.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Mo._)`{multipleOf: ${e}}`},Lz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Uz,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,Mo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Mo._)`${i} !== parseInt(${i})`;e.fail$data((0,Mo._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};ac.default=Lz});var Uh=S(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});function Dh(e){let t=e.length,r=0,o=0,n;for(;o<t;)r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t&&(n=e.charCodeAt(o),(n&64512)===56320&&o++);return r}cc.default=Dh;Dh.code='require("ajv/dist/runtime/ucs2length").default'});var Lh=S(uc=>{"use strict";Object.defineProperty(uc,"__esModule",{value:!0});var Qt=j(),Fz=U(),Vz=Uh(),Hz={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Qt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Qt._)`{limit: ${e}}`},Jz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Hz,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Qt.operators.GT:Qt.operators.LT,i=n.opts.unicode===!1?(0,Qt._)`${r}.length`:(0,Qt._)`${(0,Fz.useFunc)(e.gen,Vz.default)}(${r})`;e.fail$data((0,Qt._)`${i} ${s} ${o}`)}};uc.default=Jz});var Fh=S(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});var Kz=Fe(),Bz=U(),kr=j(),Wz={message:({schemaCode:e})=>(0,kr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,kr._)`{pattern: ${e}}`},Gz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Wz,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,kr._)`new RegExp`:(0,Bz.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,kr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,kr._)`!${l}`)}else{let c=(0,Kz.usePattern)(e,n);e.fail$data((0,kr._)`!${c}.test(${r})`)}}};lc.default=Gz});var Vh=S(dc=>{"use strict";Object.defineProperty(dc,"__esModule",{value:!0});var qo=j(),Yz={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,qo.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,qo._)`{limit: ${e}}`},Qz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Yz,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?qo.operators.GT:qo.operators.LT;e.fail$data((0,qo._)`Object.keys(${r}).length ${n} ${o}`)}};dc.default=Qz});var Hh=S(pc=>{"use strict";Object.defineProperty(pc,"__esModule",{value:!0});var Do=Fe(),Uo=j(),Xz=U(),ex={message:({params:{missingProperty:e}})=>(0,Uo.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Uo._)`{missingProperty: ${e}}`},tx={keyword:"required",type:"object",schemaType:"array",$data:!0,error:ex,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=e.parentSchema.properties,{definedProperties:h}=e.it;for(let _ of r)if(m?.[_]===void 0&&!h.has(_)){let v=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${_}" is not defined at "${v}" (strictRequired)`;(0,Xz.checkStrictMode)(i,w,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Uo.nil,d);else for(let m of r)(0,Do.checkReportMissingProp)(e,m)}function l(){let m=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>f(m,h)),e.ok(h)}else t.if((0,Do.checkMissingProp)(e,r,m)),(0,Do.reportMissingProp)(e,m),t.else()}function d(){t.forOf("prop",o,m=>{e.setParams({missingProperty:m}),t.if((0,Do.noPropertyInData)(t,n,m,a.ownProperties),()=>e.error())})}function f(m,h){e.setParams({missingProperty:m}),t.forOf(m,o,()=>{t.assign(h,(0,Do.propertyInData)(t,n,m,a.ownProperties)),t.if((0,Uo.not)(h),()=>{e.error(),t.break()})},Uo.nil)}}};pc.default=tx});var Jh=S(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var Lo=j(),rx={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Lo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Lo._)`{limit: ${e}}`},ox={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:rx,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Lo.operators.GT:Lo.operators.LT;e.fail$data((0,Lo._)`${r}.length ${n} ${o}`)}};fc.default=ox});var rs=S(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});var Kh=Za();Kh.code='require("ajv/dist/runtime/equal").default';mc.default=Kh});var Bh=S(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});var hc=Eo(),ye=j(),nx=U(),sx=rs(),ix={message:({params:{i:e,j:t}})=>(0,ye.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,ye._)`{i: ${e}, j: ${t}}`},ax={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:ix,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=s.items?(0,hc.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,ye._)`${i} === false`),e.ok(c);function l(){let h=t.let("i",(0,ye._)`${r}.length`),_=t.let("j");e.setParams({i:h,j:_}),t.assign(c,!0),t.if((0,ye._)`${h} > 1`,()=>(d()?f:m)(h,_))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function f(h,_){let v=t.name("item"),w=(0,hc.checkDataTypes)(u,v,a.opts.strictNumbers,hc.DataType.Wrong),k=t.const("indices",(0,ye._)`{}`);t.for((0,ye._)`;${h}--;`,()=>{t.let(v,(0,ye._)`${r}[${h}]`),t.if(w,(0,ye._)`continue`),u.length>1&&t.if((0,ye._)`typeof ${v} == "string"`,(0,ye._)`${v} += "_"`),t.if((0,ye._)`typeof ${k}[${v}] == "number"`,()=>{t.assign(_,(0,ye._)`${k}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,ye._)`${k}[${v}] = ${h}`)})}function m(h,_){let v=(0,nx.useFunc)(t,sx.default),w=t.name("outer");t.label(w).for((0,ye._)`;${h}--;`,()=>t.for((0,ye._)`${_} = ${h}; ${_}--;`,()=>t.if((0,ye._)`${v}(${r}[${h}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break(w)})))}}};gc.default=ax});var Wh=S(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});var _c=j(),cx=U(),ux=rs(),lx={message:"must be equal to constant",params:({schemaCode:e})=>(0,_c._)`{allowedValue: ${e}}`},dx={keyword:"const",$data:!0,error:lx,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;o||s&&typeof s=="object"?e.fail$data((0,_c._)`!${(0,cx.useFunc)(t,ux.default)}(${r}, ${n})`):e.fail((0,_c._)`${s} !== ${r}`)}};yc.default=dx});var Gh=S(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});var Fo=j(),px=U(),fx=rs(),mx={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Fo._)`{allowedValues: ${e}}`},hx={keyword:"enum",schemaType:"array",$data:!0,error:mx,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,px.useFunc)(t,fx.default)),l;if(a||o)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let m=t.const("vSchema",s);l=(0,Fo.or)(...n.map((h,_)=>f(m,_)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,m=>t.if((0,Fo._)`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function f(m,h){let _=n[h];return typeof _=="object"&&_!==null?(0,Fo._)`${u()}(${r}, ${m}[${h}])`:(0,Fo._)`${r} === ${_}`}}};vc.default=hx});var Yh=S(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});var gx=Mh(),_x=qh(),yx=Lh(),vx=Fh(),wx=Vh(),$x=Hh(),bx=Jh(),zx=Bh(),xx=Wh(),Sx=Gh(),kx=[gx.default,_x.default,yx.default,vx.default,wx.default,$x.default,bx.default,zx.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},xx.default,Sx.default];wc.default=kx});var bc=S(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.validateAdditionalItems=void 0;var Xt=j(),$c=U(),Px={message:({params:{len:e}})=>(0,Xt.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Xt._)`{limit: ${e}}`},Ex={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Px,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,$c.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Qh(e,o)}};function Qh(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,Xt._)`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass((0,Xt._)`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,$c.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,Xt._)`${a} <= ${t.length}`);r.if((0,Xt.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:$c.Type.Num},u),i.allErrors||r.if((0,Xt.not)(u),()=>r.break())})}}Vo.validateAdditionalItems=Qh;Vo.default=Ex});var zc=S(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.validateTuple=void 0;var Xh=j(),os=U(),Tx=Fe(),Rx={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return eg(e,"additionalItems",t);r.items=!0,!(0,os.alwaysValidSchema)(r,t)&&e.ok((0,Tx.validateArray)(e))}};function eg(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=os.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Xh._)`${s}.length`);r.forEach((d,f)=>{(0,os.alwaysValidSchema)(a,d)||(o.if((0,Xh._)`${u} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:m}=a,h=r.length,_=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!_){let v=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,os.checkStrictMode)(a,v,f.strictTuples)}}}Ho.validateTuple=eg;Ho.default=Rx});var tg=S(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var Ox=zc(),Ix={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Ox.validateTuple)(e,"items")};xc.default=Ix});var og=S(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});var rg=j(),Cx=U(),Ax=Fe(),Nx=bc(),jx={message:({params:{len:e}})=>(0,rg.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,rg._)`{limit: ${e}}`},Zx={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:jx,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;o.items=!0,!(0,Cx.alwaysValidSchema)(o,t)&&(n?(0,Nx.validateAdditionalItems)(e,n):e.ok((0,Ax.validateArray)(e)))}};Sc.default=Zx});var ng=S(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});var He=j(),ns=U(),Mx={message:({params:{min:e,max:t}})=>t===void 0?(0,He.str)`must contain at least ${e} valid item(s)`:(0,He.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,He._)`{minContains: ${e}}`:(0,He._)`{minContains: ${e}, maxContains: ${t}}`},qx={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Mx,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,He._)`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,ns.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,ns.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ns.alwaysValidSchema)(s,r)){let _=(0,He._)`${l} >= ${i}`;a!==void 0&&(_=(0,He._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?m(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,He._)`${n}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let _=t.name("_valid"),v=t.let("count",0);m(_,()=>t.if(_,()=>h(v)))}function m(_,v){t.forRange("i",0,l,w=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:ns.Type.Num,compositeRule:!0},_),v()})}function h(_){t.code((0,He._)`${_}++`),a===void 0?t.if((0,He._)`${_} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,He._)`${_} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,He._)`${_} >= ${i}`,()=>t.assign(d,!0)))}}};kc.default=qx});var ag=S(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.validateSchemaDeps=rt.validatePropertyDeps=rt.error=void 0;var Pc=j(),Dx=U(),Jo=Fe();rt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return(0,Pc.str)`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,Pc._)`{property: ${e},
13
13
  missingProperty: ${o},
14
14
  depsCount: ${t},
15
- deps: ${r}}`};var lx={keyword:"dependencies",type:"object",schemaType:"object",error:tt.error,code(e){let[t,r]=dx(e);Lh(e,t),Fh(e,r)}};function dx({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Lh(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,Io.propertyInData)(r,o,i,n.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,Io.checkReportMissingProp)(e,u)}):(r.if((0,mc._)`${c} && (${(0,Io.checkMissingProp)(e,a,s)})`),(0,Io.reportMissingProp)(e,s),r.else())}}tt.validatePropertyDeps=Lh;function Fh(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t)(0,ux.alwaysValidSchema)(s,t[a])||(r.if((0,Io.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}tt.validateSchemaDeps=Fh;tt.default=lx});var Kh=S(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});var Hh=j(),px=U(),fx={message:"property name must be valid",params:({params:e})=>(0,Hh._)`{propertyName: ${e.propertyName}}`},mx={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:fx,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,px.alwaysValidSchema)(n,r))return;let s=t.name("valid");t.forIn("key",o,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,Hh.not)(s),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(s)}};hc.default=mx});var _c=S(gc=>{"use strict";Object.defineProperty(gc,"__esModule",{value:!0});var rs=Le(),Ge=j(),hx=dt(),os=U(),gx={message:"must NOT have additional properties",params:({params:e})=>(0,Ge._)`{additionalProperty: ${e.additionalProperty}}`},_x={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:gx,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,os.alwaysValidSchema)(i,r))return;let u=(0,rs.allSchemaProperties)(o.properties),l=(0,rs.allSchemaProperties)(o.patternProperties);d(),e.ok((0,Ge._)`${s} === ${hx.default.errors}`);function d(){t.forIn("key",n,v=>{!u.length&&!l.length?h(v):t.if(f(v),()=>h(v))})}function f(v){let $;if(u.length>8){let k=(0,os.schemaRefOrVal)(i,o.properties,"properties");$=(0,rs.isOwnProperty)(t,k,v)}else u.length?$=(0,Ge.or)(...u.map(k=>(0,Ge._)`${v} === ${k}`)):$=Ge.nil;return l.length&&($=(0,Ge.or)($,...l.map(k=>(0,Ge._)`${(0,rs.usePattern)(e,k)}.test(${v})`))),(0,Ge.not)($)}function m(v){t.code((0,Ge._)`delete ${n}[${v}]`)}function h(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,os.alwaysValidSchema)(i,r)){let $=t.name("valid");c.removeAdditional==="failing"?(_(v,$,!1),t.if((0,Ge.not)($),()=>{e.reset(),m(v)})):(_(v,$),a||t.if((0,Ge.not)($),()=>t.break()))}}function _(v,$,k){let z={keyword:"additionalProperties",dataProp:v,dataPropType:os.Type.Str};k===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(z,$)}}};gc.default=_x});var Wh=S(vc=>{"use strict";Object.defineProperty(vc,"__esModule",{value:!0});var yx=yo(),Jh=Le(),yc=U(),Bh=_c(),vx={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Bh.default.code(new yx.KeywordCxt(s,Bh.default,"additionalProperties"));let i=(0,Jh.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=yc.mergeEvaluated.props(t,(0,yc.toHash)(i),s.props));let a=i.filter(d=>!(0,yc.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,Jh.propertyInData)(t,n,d,s.opts.ownProperties)),l(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};vc.default=vx});var Xh=S($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});var Gh=Le(),ns=j(),Yh=U(),Qh=U(),$x={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=(0,Gh.allSchemaProperties)(r),c=a.filter(_=>(0,Yh.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof ns.Name)&&(s.props=(0,Qh.evaluatedPropsToName)(t,s.props));let{props:d}=s;f();function f(){for(let _ of a)u&&m(_),s.allErrors?h(_):(t.var(l,!0),h(_),t.if(l))}function m(_){for(let v in u)new RegExp(_).test(v)&&(0,Yh.checkStrictMode)(s,`property ${v} matches pattern ${_} (use allowMatchingProperties)`)}function h(_){t.forIn("key",o,v=>{t.if((0,ns._)`${(0,Gh.usePattern)(e,_)}.test(${v})`,()=>{let $=c.includes(_);$||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:v,dataPropType:Qh.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,ns._)`${d}[${v}]`,!0):!$&&!s.allErrors&&t.if((0,ns.not)(l),()=>t.break())})})}}};$c.default=$x});var eg=S(wc=>{"use strict";Object.defineProperty(wc,"__esModule",{value:!0});var wx=U(),bx={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,wx.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};wc.default=bx});var tg=S(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});var zx=Le(),xx={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:zx.validateUnion,error:{message:"must match a schema in anyOf"}};bc.default=xx});var rg=S(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});var ss=j(),Sx=U(),kx={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,ss._)`{passingSchemas: ${e.passing}}`},Px={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:kx,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let f;(0,Sx.alwaysValidSchema)(n,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,ss._)`${c} && ${i}`).assign(i,!1).assign(a,(0,ss._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),f&&e.mergeEvaluated(f,ss.Name)})})}}};zc.default=Px});var og=S(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var Ex=U(),Tx={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if((0,Ex.alwaysValidSchema)(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};xc.default=Tx});var ig=S(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});var is=j(),sg=U(),Rx={message:({params:e})=>(0,is.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,is._)`{failingKeyword: ${e.ifClause}}`},Ox={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Rx,code(e){let{gen:t,parentSchema:r,it:o}=e;r.then===void 0&&r.else===void 0&&(0,sg.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=ng(o,"then"),s=ng(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else n?t.if(a,u("then")):t.if((0,is.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(f,i),d?t.assign(d,(0,is._)`${l}`):e.setParams({ifClause:l})}}}};function ng(e,t){let r=e.schema[t];return r!==void 0&&!(0,sg.alwaysValidSchema)(e,r)}Sc.default=Ox});var ag=S(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});var Ix=U(),Ax={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Ix.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};kc.default=Ax});var cg=S(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});var Cx=uc(),Nx=qh(),jx=lc(),Zx=Dh(),qx=Uh(),Mx=Vh(),Dx=Kh(),Ux=_c(),Lx=Wh(),Fx=Xh(),Vx=eg(),Hx=tg(),Kx=rg(),Jx=og(),Bx=ig(),Wx=ag();function Gx(e=!1){let t=[Vx.default,Hx.default,Kx.default,Jx.default,Bx.default,Wx.default,Dx.default,Ux.default,Mx.default,Lx.default,Fx.default];return e?t.push(Nx.default,Zx.default):t.push(Cx.default,jx.default),t.push(qx.default),t}Pc.default=Gx});var ug=S(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});var ce=j(),Yx={message:({schemaCode:e})=>(0,ce.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ce._)`{format: ${e}}`},Qx={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Yx,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?f():m();function f(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),_=r.const("fDef",(0,ce._)`${h}[${i}]`),v=r.let("fType"),$=r.let("format");r.if((0,ce._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(v,(0,ce._)`${_}.type || "string"`).assign($,(0,ce._)`${_}.validate`),()=>r.assign(v,(0,ce._)`"string"`).assign($,_)),e.fail$data((0,ce.or)(k(),z()));function k(){return c.strictSchema===!1?ce.nil:(0,ce._)`${i} && !${$}`}function z(){let P=l.$async?(0,ce._)`(${_}.async ? await ${$}(${o}) : ${$}(${o}))`:(0,ce._)`${$}(${o})`,y=(0,ce._)`(typeof ${$} == "function" ? ${P} : ${$}.test(${o}))`;return(0,ce._)`${$} && ${$} !== true && ${v} === ${t} && !${y}`}}function m(){let h=d.formats[s];if(!h){k();return}if(h===!0)return;let[_,v,$]=z(h);_===t&&e.pass(P());function k(){if(c.strictSchema===!1){d.logger.warn(y());return}throw new Error(y());function y(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function z(y){let w=y instanceof RegExp?(0,ce.regexpCode)(y):c.code.formats?(0,ce._)`${c.code.formats}${(0,ce.getProperty)(s)}`:void 0,A=r.scopeValue("formats",{key:s,ref:y,code:w});return typeof y=="object"&&!(y instanceof RegExp)?[y.type||"string",y.validate,(0,ce._)`${A}.validate`]:["string",y,A]}function P(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ce._)`await ${$}(${o})`}return typeof v=="function"?(0,ce._)`${$}(${o})`:(0,ce._)`${$}.test(${o})`}}}};Ec.default=Qx});var lg=S(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});var Xx=ug(),eS=[Xx.default];Tc.default=eS});var dg=S(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.contentVocabulary=Pr.metadataVocabulary=void 0;Pr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Pr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var fg=S(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});var tS=$h(),rS=Ch(),oS=cg(),nS=lg(),pg=dg(),sS=[tS.default,rS.default,(0,oS.default)(),nS.default,pg.metadataVocabulary,pg.contentVocabulary];Rc.default=sS});var hg=S(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});as.DiscrError=void 0;var mg;(function(e){e.Tag="tag",e.Mapping="mapping"})(mg||(as.DiscrError=mg={}))});var _g=S(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});var Er=j(),Oc=hg(),gg=Vn(),iS=vo(),aS=U(),cS={message:({params:{discrError:e,tagName:t}})=>e===Oc.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Er._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},uS={keyword:"discriminator",type:"object",schemaType:"object",error:cS,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Er._)`${r}${(0,Er.getProperty)(a)}`);t.if((0,Er._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Oc.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let m=f();t.if(!1);for(let h in m)t.elseIf((0,Er._)`${u} === ${h}`),t.assign(c,d(m[h]));t.else(),e.error(!1,{discrError:Oc.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(m){let h=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(_,Er.Name),h}function f(){var m;let h={},_=$(n),v=!0;for(let P=0;P<i.length;P++){let y=i[P];if(y?.$ref&&!(0,aS.schemaHasRulesButRef)(y,s.self.RULES)){let A=y.$ref;if(y=gg.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,A),y instanceof gg.SchemaEnv&&(y=y.schema),y===void 0)throw new iS.default(s.opts.uriResolver,s.baseId,A)}let w=(m=y?.properties)===null||m===void 0?void 0:m[a];if(typeof w!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(_||$(y)),k(w,P)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return h;function $({required:P}){return Array.isArray(P)&&P.includes(a)}function k(P,y){if(P.const)z(P.const,y);else if(P.enum)for(let w of P.enum)z(w,y);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(P,y){if(typeof P!="string"||P in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[P]=y}}}};Ic.default=uS});var yg=S((H1,lS)=>{lS.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 Cc=S((te,Ac)=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.MissingRefError=te.ValidationError=te.CodeGen=te.Name=te.nil=te.stringify=te.str=te._=te.KeywordCxt=te.Ajv=void 0;var dS=mh(),pS=fg(),fS=_g(),vg=yg(),mS=["/properties"],cs="http://json-schema.org/draft-07/schema",Tr=class extends dS.default{_addVocabularies(){super._addVocabularies(),pS.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(fS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(vg,mS):vg;this.addMetaSchema(t,cs,!1),this.refs["http://json-schema.org/schema"]=cs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(cs)?cs:void 0)}};te.Ajv=Tr;Ac.exports=te=Tr;Ac.exports.Ajv=Tr;Object.defineProperty(te,"__esModule",{value:!0});te.default=Tr;var hS=yo();Object.defineProperty(te,"KeywordCxt",{enumerable:!0,get:function(){return hS.KeywordCxt}});var Rr=j();Object.defineProperty(te,"_",{enumerable:!0,get:function(){return Rr._}});Object.defineProperty(te,"str",{enumerable:!0,get:function(){return Rr.str}});Object.defineProperty(te,"stringify",{enumerable:!0,get:function(){return Rr.stringify}});Object.defineProperty(te,"nil",{enumerable:!0,get:function(){return Rr.nil}});Object.defineProperty(te,"Name",{enumerable:!0,get:function(){return Rr.Name}});Object.defineProperty(te,"CodeGen",{enumerable:!0,get:function(){return Rr.CodeGen}});var gS=Ln();Object.defineProperty(te,"ValidationError",{enumerable:!0,get:function(){return gS.default}});var _S=vo();Object.defineProperty(te,"MissingRefError",{enumerable:!0,get:function(){return _S.default}})});var Pg=S(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.formatNames=ot.fastFormats=ot.fullFormats=void 0;function rt(e,t){return{validate:e,compare:t}}ot.fullFormats={date:rt(zg,qc),time:rt(jc(!0),Mc),"date-time":rt($g(!0),Sg),"iso-time":rt(jc(),xg),"iso-date-time":rt($g(),kg),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:zS,"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:RS,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:xS,int32:{type:"number",validate:PS},int64:{type:"number",validate:ES},float:{type:"number",validate:bg},double:{type:"number",validate:bg},password:!0,binary:!0};ot.fastFormats={...ot.fullFormats,date:rt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,qc),time:rt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Mc),"date-time":rt(/^\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,Sg),"iso-time":rt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,xg),"iso-date-time":rt(/^\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,kg),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};ot.formatNames=Object.keys(ot.fullFormats);function yS(e){return e%4===0&&(e%100!==0||e%400===0)}var vS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,$S=[0,31,28,31,30,31,30,31,31,30,31,30,31];function zg(e){let t=vS.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&yS(r)?29:$S[o])}function qc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Nc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function jc(e){return function(r){let o=Nc.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,f=n-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&i<61}}function Mc(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function xg(e,t){if(!(e&&t))return;let r=Nc.exec(e),o=Nc.exec(t);if(r&&o)return e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t?1:e<t?-1:0}var Zc=/t|\s/i;function $g(e){let t=jc(e);return function(o){let n=o.split(Zc);return n.length===2&&zg(n[0])&&t(n[1])}}function Sg(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function kg(e,t){if(!(e&&t))return;let[r,o]=e.split(Zc),[n,s]=t.split(Zc),i=qc(r,n);if(i!==void 0)return i||Mc(o,s)}var wS=/\/|:/,bS=/^(?:[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 zS(e){return wS.test(e)&&bS.test(e)}var wg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function xS(e){return wg.lastIndex=0,wg.test(e)}var SS=-(2**31),kS=2**31-1;function PS(e){return Number.isInteger(e)&&e<=kS&&e>=SS}function ES(e){return Number.isInteger(e)}function bg(){return!0}var TS=/[^\\]\\Z/;function RS(e){if(TS.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Eg=S(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.formatLimitDefinition=void 0;var OS=Cc(),Ye=j(),It=Ye.operators,us={formatMaximum:{okStr:"<=",ok:It.LTE,fail:It.GT},formatMinimum:{okStr:">=",ok:It.GTE,fail:It.LT},formatExclusiveMaximum:{okStr:"<",ok:It.LT,fail:It.GTE},formatExclusiveMinimum:{okStr:">",ok:It.GT,fail:It.LTE}},IS={message:({keyword:e,schemaCode:t})=>(0,Ye.str)`should be ${us[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ye._)`{comparison: ${us[e].okStr}, limit: ${t}}`};Or.formatLimitDefinition={keyword:Object.keys(us),type:"string",schemaType:"string",$data:!0,error:IS,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new OS.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",(0,Ye._)`${f}[${c.schemaCode}]`);e.fail$data((0,Ye.or)((0,Ye._)`typeof ${m} != "object"`,(0,Ye._)`${m} instanceof RegExp`,(0,Ye._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let f=c.schema,m=a.formats[f];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${n}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:m,code:i.code.formats?(0,Ye._)`${i.code.formats}${(0,Ye.getProperty)(f)}`:void 0});e.fail$data(d(h))}function d(f){return(0,Ye._)`${f}.compare(${r}, ${o}) ${us[n].fail} 0`}},dependencies:["format"]};var AS=e=>(e.addKeyword(Or.formatLimitDefinition),e);Or.default=AS});var Ig=S((Ao,Og)=>{"use strict";Object.defineProperty(Ao,"__esModule",{value:!0});var Ir=Pg(),CS=Eg(),Dc=j(),Tg=new Dc.Name("fullFormats"),NS=new Dc.Name("fastFormats"),Uc=(e,t={keywords:!0})=>{if(Array.isArray(t))return Rg(e,t,Ir.fullFormats,Tg),e;let[r,o]=t.mode==="fast"?[Ir.fastFormats,NS]:[Ir.fullFormats,Tg],n=t.formats||Ir.formatNames;return Rg(e,n,r,o),t.keywords&&(0,CS.default)(e),e};Uc.get=(e,t="full")=>{let o=(t==="fast"?Ir.fastFormats:Ir.fullFormats)[e];if(!o)throw new Error(`Unknown format "${e}"`);return o};function Rg(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Dc._)`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}Og.exports=Ao=Uc;Object.defineProperty(Ao,"__esModule",{value:!0});Ao.default=Uc});import{existsSync as Xc,mkdirSync as dk,readFileSync as pk,rmSync as fk,writeFileSync as mk}from"node:fs";import{homedir as hk}from"node:os";import{join as r_}from"node:path";var iu,xs=Object.freeze({status:"aborted"});function g(e,t,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let f=l[d];f in a||(a[f]=u[f].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var h_=Symbol("zod_brand"),Qe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},tr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(iu=globalThis).__zod_globalConfig??(iu.__zod_globalConfig={});var rr=globalThis.__zod_globalConfig;function Te(e){return e&&Object.assign(rr,e),rr}var M={};zs(M,{BIGINT_FORMAT_RANGES:()=>lu,Class:()=>ks,NUMBER_FORMAT_RANGES:()=>Is,aborted:()=>$t,allowsEval:()=>Ts,assert:()=>$_,assertEqual:()=>g_,assertIs:()=>y_,assertNever:()=>v_,assertNotEqual:()=>__,assignProp:()=>yt,base64ToUint8Array:()=>pu,base64urlToUint8Array:()=>Z_,cached:()=>nr,captureStackTrace:()=>Qo,cleanEnum:()=>j_,cleanRegex:()=>qr,clone:()=>Ze,cloneDef:()=>b_,createTransparentProxy:()=>E_,defineLazy:()=>H,esc:()=>Yo,escapeRegex:()=>st,explicitlyAborted:()=>As,extend:()=>O_,finalizeIssue:()=>qe,floatSafeRemainder:()=>Ps,getElementAtPath:()=>z_,getEnumValues:()=>jr,getLengthableOrigin:()=>Mr,getParsedType:()=>P_,getSizableOrigin:()=>du,hexToUint8Array:()=>M_,isObject:()=>Nt,isPlainObject:()=>vt,issue:()=>sr,joinValues:()=>Go,jsonStringifyReplacer:()=>or,merge:()=>A_,mergeDefs:()=>nt,normalizeParams:()=>R,nullish:()=>Zr,numKeys:()=>k_,objectClone:()=>w_,omit:()=>R_,optionalKeys:()=>Os,parsedType:()=>Cs,partial:()=>C_,pick:()=>T_,prefixIssues:()=>it,primitiveTypes:()=>uu,promiseAllObject:()=>x_,propertyKeyTypes:()=>Rs,randomString:()=>S_,required:()=>N_,safeExtend:()=>I_,shallowClone:()=>cu,slugify:()=>Es,stringifyPrimitive:()=>Xo,uint8ArrayToBase64:()=>fu,uint8ArrayToBase64url:()=>q_,uint8ArrayToHex:()=>D_,unwrapMessage:()=>Nr});function g_(e){return e}function __(e){return e}function y_(e){}function v_(e){throw new Error("Unexpected value in exhaustive check")}function $_(e){}function jr(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Go(e,t="|"){return e.map(r=>Xo(r)).join(t)}function or(e,t){return typeof t=="bigint"?t.toString():t}function nr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Zr(e){return e==null}function qr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ps(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var au=Symbol("evaluating");function H(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==au)return o===void 0&&(o=au,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function w_(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function yt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function nt(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function b_(e){return nt(e._zod.def)}function z_(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function x_(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function S_(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Yo(e){return JSON.stringify(e)}function Es(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Qo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Nt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ts=nr(()=>{if(rr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function vt(e){if(Nt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Nt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cu(e){return vt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function k_(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var P_=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}`)}},Rs=new Set(["string","number","symbol"]),uu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function R(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 E_(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function Xo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Os(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Is={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]},lu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function T_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=nt(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return yt(this,"shape",i),i},checks:[]});return Ze(e,s)}function R_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=nt(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return yt(this,"shape",i),i},checks:[]});return Ze(e,s)}function O_(e,t){if(!vt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=nt(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return yt(this,"shape",s),s}});return Ze(e,n)}function I_(e,t){if(!vt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=nt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return yt(this,"shape",o),o}});return Ze(e,r)}function A_(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=nt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return yt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ze(e,r)}function C_(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=nt(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return yt(this,"shape",c),c},checks:[]});return Ze(t,i)}function N_(e,t,r){let o=nt(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return yt(this,"shape",s),s}});return Ze(t,o)}function $t(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 As(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function it(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Nr(e){return typeof e=="string"?e:e?.message}function qe(e,t,r){let o=e.message?e.message:Nr(e.inst?._zod.def?.error?.(e))??Nr(t?.error?.(e))??Nr(r.customError?.(e))??Nr(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=i),a}function du(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Mr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Cs(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 sr(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function j_(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function pu(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function fu(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Z_(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return pu(t+r)}function q_(e){return fu(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function M_(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 o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function D_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ks=class{constructor(...t){}};var mu=(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,or,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},en=g("$ZodError",mu),Ns=g("$ZodError",mu,{Parent:Error});function js(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Zs(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(e),r}var tn=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Qe;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>qe(c,s,Te())));throw Qo(a,n?.callee),a}return i.value};var rn=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>qe(c,s,Te())));throw Qo(a,n?.callee),a}return i.value};var Dr=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Qe;return s.issues.length?{success:!1,error:new(e??en)(s.issues.map(i=>qe(i,n,Te())))}:{success:!0,data:s.value}},Ur=Dr(Ns),Lr=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>qe(i,n,Te())))}:{success:!0,data:s.value}},on=Lr(Ns),hu=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return tn(e)(t,r,n)};var gu=e=>(t,r,o)=>tn(e)(t,r,o);var _u=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return rn(e)(t,r,n)};var yu=e=>async(t,r,o)=>rn(e)(t,r,o);var vu=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Dr(e)(t,r,n)};var $u=e=>(t,r,o)=>Dr(e)(t,r,o);var wu=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Lr(e)(t,r,n)};var bu=e=>async(t,r,o)=>Lr(e)(t,r,o);var zu=/^[cC][0-9a-z]{6,}$/,xu=/^[0-9a-z]+$/,Su=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ku=/^[0-9a-vA-V]{20}$/,Pu=/^[A-Za-z0-9]{27}$/,Eu=/^[a-zA-Z0-9_-]{21}$/,Tu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Ru=/^([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})$/,qs=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)$/;var Ou=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var L_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Iu(){return new RegExp(L_,"u")}var Au=/^(?:(?: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])$/,Cu=/^(([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}|:))$/;var Nu=/^((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])$/,ju=/^(([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])$/,Zu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ms=/^[A-Za-z0-9_-]*$/;var qu=/^https?$/,Mu=/^\+[1-9]\d{6,14}$/,Du="(?:(?:\\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])))",Uu=new RegExp(`^${Du}$`);function Lu(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 Fu(e){return new RegExp(`^${Lu(e)}$`)}function Vu(e){let t=Lu({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Du}T(?:${o})$`)}var Hu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ku=/^-?\d+n?$/,Ju=/^-?\d+$/,Ds=/^-?\d+(?:\.\d+)?$/,Bu=/^(?:true|false)$/i,Wu=/^null$/i;var Gu=/^[^A-Z]*$/,Yu=/^[^a-z]*$/;var pe=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Qu={number:"number",bigint:"bigint",object:"date"},Us=g("$ZodCheckLessThan",(e,t)=>{pe.init(e,t);let r=Qu[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ls=g("$ZodCheckGreaterThan",(e,t)=>{pe.init(e,t);let r=Qu[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xu=g("$ZodCheckMultipleOf",(e,t)=>{pe.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.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):Ps(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})}}),el=g("$ZodCheckNumberFormat",(e,t)=>{pe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Is[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Ju)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var tl=g("$ZodCheckMaxLength",(e,t)=>{var r;pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=Mr(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),rl=g("$ZodCheckMinLength",(e,t)=>{var r;pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=Mr(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ol=g("$ZodCheckLengthEquals",(e,t)=>{var r;pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Zr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=Mr(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Vr=g("$ZodCheckStringFormat",(e,t)=>{var r,o;pe.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),nl=g("$ZodCheckRegex",(e,t)=>{Vr.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})}}),sl=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Gu),Vr.init(e,t)}),il=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Yu),Vr.init(e,t)}),al=g("$ZodCheckIncludes",(e,t)=>{pe.init(e,t);let r=st(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),cl=g("$ZodCheckStartsWith",(e,t)=>{pe.init(e,t);let r=new RegExp(`^${st(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),ul=g("$ZodCheckEndsWith",(e,t)=>{pe.init(e,t);let r=new RegExp(`.*${st(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var ll=g("$ZodCheckOverwrite",(e,t)=>{pe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var nn=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 o=t.split(`
15
+ deps: ${r}}`};var Ux={keyword:"dependencies",type:"object",schemaType:"object",error:rt.error,code(e){let[t,r]=Lx(e);sg(e,t),ig(e,r)}};function Lx({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function sg(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,Jo.propertyInData)(r,o,i,n.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,Jo.checkReportMissingProp)(e,u)}):(r.if((0,Pc._)`${c} && (${(0,Jo.checkMissingProp)(e,a,s)})`),(0,Jo.reportMissingProp)(e,s),r.else())}}rt.validatePropertyDeps=sg;function ig(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t)(0,Dx.alwaysValidSchema)(s,t[a])||(r.if((0,Jo.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}rt.validateSchemaDeps=ig;rt.default=Ux});var ug=S(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});var cg=j(),Fx=U(),Vx={message:"property name must be valid",params:({params:e})=>(0,cg._)`{propertyName: ${e.propertyName}}`},Hx={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Vx,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,Fx.alwaysValidSchema)(n,r))return;let s=t.name("valid");t.forIn("key",o,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,cg.not)(s),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(s)}};Ec.default=Hx});var Rc=S(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});var ss=Fe(),Ye=j(),Jx=ft(),is=U(),Kx={message:"must NOT have additional properties",params:({params:e})=>(0,Ye._)`{additionalProperty: ${e.additionalProperty}}`},Bx={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Kx,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,is.alwaysValidSchema)(i,r))return;let u=(0,ss.allSchemaProperties)(o.properties),l=(0,ss.allSchemaProperties)(o.patternProperties);d(),e.ok((0,Ye._)`${s} === ${Jx.default.errors}`);function d(){t.forIn("key",n,v=>{!u.length&&!l.length?h(v):t.if(f(v),()=>h(v))})}function f(v){let w;if(u.length>8){let k=(0,is.schemaRefOrVal)(i,o.properties,"properties");w=(0,ss.isOwnProperty)(t,k,v)}else u.length?w=(0,Ye.or)(...u.map(k=>(0,Ye._)`${v} === ${k}`)):w=Ye.nil;return l.length&&(w=(0,Ye.or)(w,...l.map(k=>(0,Ye._)`${(0,ss.usePattern)(e,k)}.test(${v})`))),(0,Ye.not)(w)}function m(v){t.code((0,Ye._)`delete ${n}[${v}]`)}function h(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,is.alwaysValidSchema)(i,r)){let w=t.name("valid");c.removeAdditional==="failing"?(_(v,w,!1),t.if((0,Ye.not)(w),()=>{e.reset(),m(v)})):(_(v,w),a||t.if((0,Ye.not)(w),()=>t.break()))}}function _(v,w,k){let z={keyword:"additionalProperties",dataProp:v,dataPropType:is.Type.Str};k===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(z,w)}}};Tc.default=Bx});var pg=S(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});var Wx=Io(),lg=Fe(),Oc=U(),dg=Rc(),Gx={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&dg.default.code(new Wx.KeywordCxt(s,dg.default,"additionalProperties"));let i=(0,lg.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Oc.mergeEvaluated.props(t,(0,Oc.toHash)(i),s.props));let a=i.filter(d=>!(0,Oc.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,lg.propertyInData)(t,n,d,s.opts.ownProperties)),l(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Ic.default=Gx});var gg=S(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});var fg=Fe(),as=j(),mg=U(),hg=U(),Yx={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=(0,fg.allSchemaProperties)(r),c=a.filter(_=>(0,mg.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof as.Name)&&(s.props=(0,hg.evaluatedPropsToName)(t,s.props));let{props:d}=s;f();function f(){for(let _ of a)u&&m(_),s.allErrors?h(_):(t.var(l,!0),h(_),t.if(l))}function m(_){for(let v in u)new RegExp(_).test(v)&&(0,mg.checkStrictMode)(s,`property ${v} matches pattern ${_} (use allowMatchingProperties)`)}function h(_){t.forIn("key",o,v=>{t.if((0,as._)`${(0,fg.usePattern)(e,_)}.test(${v})`,()=>{let w=c.includes(_);w||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:v,dataPropType:hg.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,as._)`${d}[${v}]`,!0):!w&&!s.allErrors&&t.if((0,as.not)(l),()=>t.break())})})}}};Cc.default=Yx});var _g=S(Ac=>{"use strict";Object.defineProperty(Ac,"__esModule",{value:!0});var Qx=U(),Xx={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,Qx.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Ac.default=Xx});var yg=S(Nc=>{"use strict";Object.defineProperty(Nc,"__esModule",{value:!0});var eS=Fe(),tS={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:eS.validateUnion,error:{message:"must match a schema in anyOf"}};Nc.default=tS});var vg=S(jc=>{"use strict";Object.defineProperty(jc,"__esModule",{value:!0});var cs=j(),rS=U(),oS={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,cs._)`{passingSchemas: ${e.passing}}`},nS={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:oS,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let f;(0,rS.alwaysValidSchema)(n,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,cs._)`${c} && ${i}`).assign(i,!1).assign(a,(0,cs._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),f&&e.mergeEvaluated(f,cs.Name)})})}}};jc.default=nS});var wg=S(Zc=>{"use strict";Object.defineProperty(Zc,"__esModule",{value:!0});var sS=U(),iS={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if((0,sS.alwaysValidSchema)(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};Zc.default=iS});var zg=S(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});var us=j(),bg=U(),aS={message:({params:e})=>(0,us.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,us._)`{failingKeyword: ${e.ifClause}}`},cS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:aS,code(e){let{gen:t,parentSchema:r,it:o}=e;r.then===void 0&&r.else===void 0&&(0,bg.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=$g(o,"then"),s=$g(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else n?t.if(a,u("then")):t.if((0,us.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(f,i),d?t.assign(d,(0,us._)`${l}`):e.setParams({ifClause:l})}}}};function $g(e,t){let r=e.schema[t];return r!==void 0&&!(0,bg.alwaysValidSchema)(e,r)}Mc.default=cS});var xg=S(qc=>{"use strict";Object.defineProperty(qc,"__esModule",{value:!0});var uS=U(),lS={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,uS.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};qc.default=lS});var Sg=S(Dc=>{"use strict";Object.defineProperty(Dc,"__esModule",{value:!0});var dS=bc(),pS=tg(),fS=zc(),mS=og(),hS=ng(),gS=ag(),_S=ug(),yS=Rc(),vS=pg(),wS=gg(),$S=_g(),bS=yg(),zS=vg(),xS=wg(),SS=zg(),kS=xg();function PS(e=!1){let t=[$S.default,bS.default,zS.default,xS.default,SS.default,kS.default,_S.default,yS.default,gS.default,vS.default,wS.default];return e?t.push(pS.default,mS.default):t.push(dS.default,fS.default),t.push(hS.default),t}Dc.default=PS});var kg=S(Uc=>{"use strict";Object.defineProperty(Uc,"__esModule",{value:!0});var ue=j(),ES={message:({schemaCode:e})=>(0,ue.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ue._)`{format: ${e}}`},TS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:ES,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?f():m();function f(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),_=r.const("fDef",(0,ue._)`${h}[${i}]`),v=r.let("fType"),w=r.let("format");r.if((0,ue._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(v,(0,ue._)`${_}.type || "string"`).assign(w,(0,ue._)`${_}.validate`),()=>r.assign(v,(0,ue._)`"string"`).assign(w,_)),e.fail$data((0,ue.or)(k(),z()));function k(){return c.strictSchema===!1?ue.nil:(0,ue._)`${i} && !${w}`}function z(){let P=l.$async?(0,ue._)`(${_}.async ? await ${w}(${o}) : ${w}(${o}))`:(0,ue._)`${w}(${o})`,y=(0,ue._)`(typeof ${w} == "function" ? ${P} : ${w}.test(${o}))`;return(0,ue._)`${w} && ${w} !== true && ${v} === ${t} && !${y}`}}function m(){let h=d.formats[s];if(!h){k();return}if(h===!0)return;let[_,v,w]=z(h);_===t&&e.pass(P());function k(){if(c.strictSchema===!1){d.logger.warn(y());return}throw new Error(y());function y(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function z(y){let $=y instanceof RegExp?(0,ue.regexpCode)(y):c.code.formats?(0,ue._)`${c.code.formats}${(0,ue.getProperty)(s)}`:void 0,C=r.scopeValue("formats",{key:s,ref:y,code:$});return typeof y=="object"&&!(y instanceof RegExp)?[y.type||"string",y.validate,(0,ue._)`${C}.validate`]:["string",y,C]}function P(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ue._)`await ${w}(${o})`}return typeof v=="function"?(0,ue._)`${w}(${o})`:(0,ue._)`${w}.test(${o})`}}}};Uc.default=TS});var Pg=S(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});var RS=kg(),OS=[RS.default];Lc.default=OS});var Eg=S(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.contentVocabulary=Pr.metadataVocabulary=void 0;Pr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Pr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Rg=S(Fc=>{"use strict";Object.defineProperty(Fc,"__esModule",{value:!0});var IS=Zh(),CS=Yh(),AS=Sg(),NS=Pg(),Tg=Eg(),jS=[IS.default,CS.default,(0,AS.default)(),NS.default,Tg.metadataVocabulary,Tg.contentVocabulary];Fc.default=jS});var Ig=S(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.DiscrError=void 0;var Og;(function(e){e.Tag="tag",e.Mapping="mapping"})(Og||(ls.DiscrError=Og={}))});var Ag=S(Hc=>{"use strict";Object.defineProperty(Hc,"__esModule",{value:!0});var Er=j(),Vc=Ig(),Cg=Kn(),ZS=Co(),MS=U(),qS={message:({params:{discrError:e,tagName:t}})=>e===Vc.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Er._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},DS={keyword:"discriminator",type:"object",schemaType:"object",error:qS,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Er._)`${r}${(0,Er.getProperty)(a)}`);t.if((0,Er._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Vc.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let m=f();t.if(!1);for(let h in m)t.elseIf((0,Er._)`${u} === ${h}`),t.assign(c,d(m[h]));t.else(),e.error(!1,{discrError:Vc.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(m){let h=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(_,Er.Name),h}function f(){var m;let h={},_=w(n),v=!0;for(let P=0;P<i.length;P++){let y=i[P];if(y?.$ref&&!(0,MS.schemaHasRulesButRef)(y,s.self.RULES)){let C=y.$ref;if(y=Cg.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,C),y instanceof Cg.SchemaEnv&&(y=y.schema),y===void 0)throw new ZS.default(s.opts.uriResolver,s.baseId,C)}let $=(m=y?.properties)===null||m===void 0?void 0:m[a];if(typeof $!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(_||w(y)),k($,P)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return h;function w({required:P}){return Array.isArray(P)&&P.includes(a)}function k(P,y){if(P.const)z(P.const,y);else if(P.enum)for(let $ of P.enum)z($,y);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(P,y){if(typeof P!="string"||P in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[P]=y}}}};Hc.default=DS});var Ng=S((pC,US)=>{US.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 Kc=S((te,Jc)=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.MissingRefError=te.ValidationError=te.CodeGen=te.Name=te.nil=te.stringify=te.str=te._=te.KeywordCxt=te.Ajv=void 0;var LS=Oh(),FS=Rg(),VS=Ag(),jg=Ng(),HS=["/properties"],ds="http://json-schema.org/draft-07/schema",Tr=class extends LS.default{_addVocabularies(){super._addVocabularies(),FS.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(VS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(jg,HS):jg;this.addMetaSchema(t,ds,!1),this.refs["http://json-schema.org/schema"]=ds}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ds)?ds:void 0)}};te.Ajv=Tr;Jc.exports=te=Tr;Jc.exports.Ajv=Tr;Object.defineProperty(te,"__esModule",{value:!0});te.default=Tr;var JS=Io();Object.defineProperty(te,"KeywordCxt",{enumerable:!0,get:function(){return JS.KeywordCxt}});var Rr=j();Object.defineProperty(te,"_",{enumerable:!0,get:function(){return Rr._}});Object.defineProperty(te,"str",{enumerable:!0,get:function(){return Rr.str}});Object.defineProperty(te,"stringify",{enumerable:!0,get:function(){return Rr.stringify}});Object.defineProperty(te,"nil",{enumerable:!0,get:function(){return Rr.nil}});Object.defineProperty(te,"Name",{enumerable:!0,get:function(){return Rr.Name}});Object.defineProperty(te,"CodeGen",{enumerable:!0,get:function(){return Rr.CodeGen}});var KS=Hn();Object.defineProperty(te,"ValidationError",{enumerable:!0,get:function(){return KS.default}});var BS=Co();Object.defineProperty(te,"MissingRefError",{enumerable:!0,get:function(){return BS.default}})});var Vg=S(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.formatNames=nt.fastFormats=nt.fullFormats=void 0;function ot(e,t){return{validate:e,compare:t}}nt.fullFormats={date:ot(Dg,Yc),time:ot(Wc(!0),Qc),"date-time":ot(Zg(!0),Lg),"iso-time":ot(Wc(),Ug),"iso-date-time":ot(Zg(),Fg),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:ek,"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:ak,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:tk,int32:{type:"number",validate:nk},int64:{type:"number",validate:sk},float:{type:"number",validate:qg},double:{type:"number",validate:qg},password:!0,binary:!0};nt.fastFormats={...nt.fullFormats,date:ot(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Yc),time:ot(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Qc),"date-time":ot(/^\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,Lg),"iso-time":ot(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Ug),"iso-date-time":ot(/^\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,Fg),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};nt.formatNames=Object.keys(nt.fullFormats);function WS(e){return e%4===0&&(e%100!==0||e%400===0)}var GS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,YS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Dg(e){let t=GS.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&WS(r)?29:YS[o])}function Yc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Bc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Wc(e){return function(r){let o=Bc.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,f=n-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&i<61}}function Qc(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function Ug(e,t){if(!(e&&t))return;let r=Bc.exec(e),o=Bc.exec(t);if(r&&o)return e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t?1:e<t?-1:0}var Gc=/t|\s/i;function Zg(e){let t=Wc(e);return function(o){let n=o.split(Gc);return n.length===2&&Dg(n[0])&&t(n[1])}}function Lg(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function Fg(e,t){if(!(e&&t))return;let[r,o]=e.split(Gc),[n,s]=t.split(Gc),i=Yc(r,n);if(i!==void 0)return i||Qc(o,s)}var QS=/\/|:/,XS=/^(?:[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 ek(e){return QS.test(e)&&XS.test(e)}var Mg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function tk(e){return Mg.lastIndex=0,Mg.test(e)}var rk=-(2**31),ok=2**31-1;function nk(e){return Number.isInteger(e)&&e<=ok&&e>=rk}function sk(e){return Number.isInteger(e)}function qg(){return!0}var ik=/[^\\]\\Z/;function ak(e){if(ik.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Hg=S(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.formatLimitDefinition=void 0;var ck=Kc(),Qe=j(),Ct=Qe.operators,ps={formatMaximum:{okStr:"<=",ok:Ct.LTE,fail:Ct.GT},formatMinimum:{okStr:">=",ok:Ct.GTE,fail:Ct.LT},formatExclusiveMaximum:{okStr:"<",ok:Ct.LT,fail:Ct.GTE},formatExclusiveMinimum:{okStr:">",ok:Ct.GT,fail:Ct.LTE}},uk={message:({keyword:e,schemaCode:t})=>(0,Qe.str)`should be ${ps[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Qe._)`{comparison: ${ps[e].okStr}, limit: ${t}}`};Or.formatLimitDefinition={keyword:Object.keys(ps),type:"string",schemaType:"string",$data:!0,error:uk,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new ck.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",(0,Qe._)`${f}[${c.schemaCode}]`);e.fail$data((0,Qe.or)((0,Qe._)`typeof ${m} != "object"`,(0,Qe._)`${m} instanceof RegExp`,(0,Qe._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let f=c.schema,m=a.formats[f];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${n}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:m,code:i.code.formats?(0,Qe._)`${i.code.formats}${(0,Qe.getProperty)(f)}`:void 0});e.fail$data(d(h))}function d(f){return(0,Qe._)`${f}.compare(${r}, ${o}) ${ps[n].fail} 0`}},dependencies:["format"]};var lk=e=>(e.addKeyword(Or.formatLimitDefinition),e);Or.default=lk});var Wg=S((Ko,Bg)=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});var Ir=Vg(),dk=Hg(),Xc=j(),Jg=new Xc.Name("fullFormats"),pk=new Xc.Name("fastFormats"),eu=(e,t={keywords:!0})=>{if(Array.isArray(t))return Kg(e,t,Ir.fullFormats,Jg),e;let[r,o]=t.mode==="fast"?[Ir.fastFormats,pk]:[Ir.fullFormats,Jg],n=t.formats||Ir.formatNames;return Kg(e,n,r,o),t.keywords&&(0,dk.default)(e),e};eu.get=(e,t="full")=>{let o=(t==="fast"?Ir.fastFormats:Ir.fullFormats)[e];if(!o)throw new Error(`Unknown format "${e}"`);return o};function Kg(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Xc._)`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}Bg.exports=Ko=eu;Object.defineProperty(Ko,"__esModule",{value:!0});Ko.default=eu});import{existsSync as su,mkdirSync as _k,readFileSync as yk,rmSync as vk,writeFileSync as wk}from"node:fs";import{createServer as $k}from"node:http";import{homedir as bk}from"node:os";import{join as c_}from"node:path";var Es;Es=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function $_(e){return(await Es).getRandomValues(new Uint8Array(e))}async function b_(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,o="";for(;o.length<e;){let n=await $_(e-o.length);for(let s of n)s<r&&(o+=t[s%t.length])}return o}async function z_(e){return await b_(e)}async function x_(e){let t=await(await Es).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Ts(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await z_(e),r=await x_(t);return{code_verifier:t,code_challenge:r}}var uu,Rs=Object.freeze({status:"aborted"});function g(e,t,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let f=l[d];f in a||(a[f]=u[f].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var S_=Symbol("zod_brand"),Xe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},tr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(uu=globalThis).__zod_globalConfig??(uu.__zod_globalConfig={});var rr=globalThis.__zod_globalConfig;function Te(e){return e&&Object.assign(rr,e),rr}var q={};Ps(q,{BIGINT_FORMAT_RANGES:()=>fu,Class:()=>Is,NUMBER_FORMAT_RANGES:()=>Ms,aborted:()=>$t,allowsEval:()=>Ns,assert:()=>R_,assertEqual:()=>k_,assertIs:()=>E_,assertNever:()=>T_,assertNotEqual:()=>P_,assignProp:()=>vt,base64ToUint8Array:()=>hu,base64urlToUint8Array:()=>K_,cached:()=>nr,captureStackTrace:()=>tn,cleanEnum:()=>J_,cleanRegex:()=>qr,clone:()=>Ze,cloneDef:()=>I_,createTransparentProxy:()=>M_,defineLazy:()=>H,esc:()=>en,escapeRegex:()=>it,explicitlyAborted:()=>qs,extend:()=>U_,finalizeIssue:()=>Me,floatSafeRemainder:()=>Cs,getElementAtPath:()=>C_,getEnumValues:()=>Zr,getLengthableOrigin:()=>Dr,getParsedType:()=>Z_,getSizableOrigin:()=>mu,hexToUint8Array:()=>W_,isObject:()=>Nt,isPlainObject:()=>wt,issue:()=>sr,joinValues:()=>Xo,jsonStringifyReplacer:()=>or,merge:()=>F_,mergeDefs:()=>st,normalizeParams:()=>R,nullish:()=>Mr,numKeys:()=>j_,objectClone:()=>O_,omit:()=>D_,optionalKeys:()=>Zs,parsedType:()=>Ds,partial:()=>V_,pick:()=>q_,prefixIssues:()=>at,primitiveTypes:()=>pu,promiseAllObject:()=>A_,propertyKeyTypes:()=>js,randomString:()=>N_,required:()=>H_,safeExtend:()=>L_,shallowClone:()=>du,slugify:()=>As,stringifyPrimitive:()=>rn,uint8ArrayToBase64:()=>gu,uint8ArrayToBase64url:()=>B_,uint8ArrayToHex:()=>G_,unwrapMessage:()=>jr});function k_(e){return e}function P_(e){return e}function E_(e){}function T_(e){throw new Error("Unexpected value in exhaustive check")}function R_(e){}function Zr(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function Xo(e,t="|"){return e.map(r=>rn(r)).join(t)}function or(e,t){return typeof t=="bigint"?t.toString():t}function nr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Mr(e){return e==null}function qr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Cs(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var lu=Symbol("evaluating");function H(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==lu)return o===void 0&&(o=lu,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function O_(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function vt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function st(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function I_(e){return st(e._zod.def)}function C_(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function A_(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function N_(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function en(e){return JSON.stringify(e)}function As(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var tn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Nt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ns=nr(()=>{if(rr.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function wt(e){if(Nt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Nt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function du(e){return wt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function j_(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Z_=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}`)}},js=new Set(["string","number","symbol"]),pu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function it(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function R(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 M_(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function rn(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Zs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ms={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]},fu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function q_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=st(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return vt(this,"shape",i),i},checks:[]});return Ze(e,s)}function D_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=st(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return vt(this,"shape",i),i},checks:[]});return Ze(e,s)}function U_(e,t){if(!wt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=st(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return vt(this,"shape",s),s}});return Ze(e,n)}function L_(e,t){if(!wt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=st(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return vt(this,"shape",o),o}});return Ze(e,r)}function F_(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=st(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return vt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ze(e,r)}function V_(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=st(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return vt(this,"shape",c),c},checks:[]});return Ze(t,i)}function H_(e,t,r){let o=st(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return vt(this,"shape",s),s}});return Ze(t,o)}function $t(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 qs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function at(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function jr(e){return typeof e=="string"?e:e?.message}function Me(e,t,r){let o=e.message?e.message:jr(e.inst?._zod.def?.error?.(e))??jr(t?.error?.(e))??jr(r.customError?.(e))??jr(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=i),a}function mu(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Dr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ds(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 sr(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function J_(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function hu(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function gu(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function K_(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return hu(t+r)}function B_(e){return gu(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function W_(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 o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function G_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Is=class{constructor(...t){}};var _u=(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,or,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},on=g("$ZodError",_u),Us=g("$ZodError",_u,{Parent:Error});function Ls(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Fs(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(e),r}var nn=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Xe;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Me(c,s,Te())));throw tn(a,n?.callee),a}return i.value};var sn=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Me(c,s,Te())));throw tn(a,n?.callee),a}return i.value};var Ur=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Xe;return s.issues.length?{success:!1,error:new(e??on)(s.issues.map(i=>Me(i,n,Te())))}:{success:!0,data:s.value}},Lr=Ur(Us),Fr=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Me(i,n,Te())))}:{success:!0,data:s.value}},an=Fr(Us),yu=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return nn(e)(t,r,n)};var vu=e=>(t,r,o)=>nn(e)(t,r,o);var wu=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return sn(e)(t,r,n)};var $u=e=>async(t,r,o)=>sn(e)(t,r,o);var bu=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ur(e)(t,r,n)};var zu=e=>(t,r,o)=>Ur(e)(t,r,o);var xu=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Fr(e)(t,r,n)};var Su=e=>async(t,r,o)=>Fr(e)(t,r,o);var ku=/^[cC][0-9a-z]{6,}$/,Pu=/^[0-9a-z]+$/,Eu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Tu=/^[0-9a-vA-V]{20}$/,Ru=/^[A-Za-z0-9]{27}$/,Ou=/^[a-zA-Z0-9_-]{21}$/,Iu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Cu=/^([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})$/,Vs=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)$/;var Au=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Q_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Nu(){return new RegExp(Q_,"u")}var ju=/^(?:(?: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])$/,Zu=/^(([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}|:))$/;var Mu=/^((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])$/,qu=/^(([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])$/,Du=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hs=/^[A-Za-z0-9_-]*$/;var Uu=/^https?$/,Lu=/^\+[1-9]\d{6,14}$/,Fu="(?:(?:\\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])))",Vu=new RegExp(`^${Fu}$`);function Hu(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 Ju(e){return new RegExp(`^${Hu(e)}$`)}function Ku(e){let t=Hu({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Fu}T(?:${o})$`)}var Bu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Wu=/^-?\d+n?$/,Gu=/^-?\d+$/,Js=/^-?\d+(?:\.\d+)?$/,Yu=/^(?:true|false)$/i,Qu=/^null$/i;var Xu=/^[^A-Z]*$/,el=/^[^a-z]*$/;var pe=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),tl={number:"number",bigint:"bigint",object:"date"},Ks=g("$ZodCheckLessThan",(e,t)=>{pe.init(e,t);let r=tl[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bs=g("$ZodCheckGreaterThan",(e,t)=>{pe.init(e,t);let r=tl[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rl=g("$ZodCheckMultipleOf",(e,t)=>{pe.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.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):Cs(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})}}),ol=g("$ZodCheckNumberFormat",(e,t)=>{pe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Ms[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Gu)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var nl=g("$ZodCheckMaxLength",(e,t)=>{var r;pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Mr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=Dr(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),sl=g("$ZodCheckMinLength",(e,t)=>{var r;pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Mr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=Dr(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),il=g("$ZodCheckLengthEquals",(e,t)=>{var r;pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!Mr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=Dr(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Hr=g("$ZodCheckStringFormat",(e,t)=>{var r,o;pe.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),al=g("$ZodCheckRegex",(e,t)=>{Hr.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})}}),cl=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Xu),Hr.init(e,t)}),ul=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=el),Hr.init(e,t)}),ll=g("$ZodCheckIncludes",(e,t)=>{pe.init(e,t);let r=it(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),dl=g("$ZodCheckStartsWith",(e,t)=>{pe.init(e,t);let r=new RegExp(`^${it(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),pl=g("$ZodCheckEndsWith",(e,t)=>{pe.init(e,t);let r=new RegExp(`.*${it(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var fl=g("$ZodCheckOverwrite",(e,t)=>{pe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var cn=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 o=t.split(`
16
16
  `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,n.join(`
17
- `))}};var pl={major:4,minor:4,patch:3};var K=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pl;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,c)=>{let u=$t(i),l;for(let d of a){if(d._zod.def.when){if(As(i)||!d._zod.def.when(i))continue}else if(u)continue;let f=i.issues.length,m=d._zod.check(i);if(m instanceof Promise&&c?.async===!1)throw new Qe;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,i.issues.length!==f&&(u||(u=$t(i,f)))});else{if(i.issues.length===f)continue;u||(u=$t(i,f))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if($t(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Qe;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Qe;return c.then(u=>n(u,o,a))}return n(c,o,a)}}H(e,"~standard",()=>({validate:n=>{try{let s=Ur(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return on(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),cn=g("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Hu(e._zod.bag),e._zod.parse=(r,o)=>{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}}),Q=g("$ZodStringFormat",(e,t)=>{Vr.init(e,t),cn.init(e,t)}),wl=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ru),Q.init(e,t)}),bl=g("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=qs(o))}else t.pattern??(t.pattern=qs());Q.init(e,t)}),zl=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ou),Q.init(e,t)}),xl=g("$ZodURL",(e,t)=>{Q.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===qu.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.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(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.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=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Sl=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Iu()),Q.init(e,t)}),kl=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Eu),Q.init(e,t)}),Pl=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zu),Q.init(e,t)}),El=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=xu),Q.init(e,t)}),Tl=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Su),Q.init(e,t)}),Rl=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ku),Q.init(e,t)}),Ol=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pu),Q.init(e,t)}),Il=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Vu(t)),Q.init(e,t)}),Al=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Uu),Q.init(e,t)}),Cl=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Fu(t)),Q.init(e,t)}),Nl=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Tu),Q.init(e,t)}),jl=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Au),Q.init(e,t),e._zod.bag.format="ipv4"}),Zl=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Cu),Q.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})}}});var ql=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Nu),Q.init(e,t)}),Ml=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ju),Q.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Dl(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ul=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Zu),Q.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Dl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function H_(e){if(!Ms.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Dl(r)}var Ll=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ms),Q.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{H_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Fl=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Mu),Q.init(e,t)});function K_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Vl=g("$ZodJWT",(e,t)=>{Q.init(e,t),e._zod.check=r=>{K_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Vs=g("$ZodNumber",(e,t)=>{K.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ds,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Hl=g("$ZodNumberFormat",(e,t)=>{el.init(e,t),Vs.init(e,t)}),Kl=g("$ZodBoolean",(e,t)=>{K.init(e,t),e._zod.pattern=Bu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Jl=g("$ZodBigInt",(e,t)=>{K.init(e,t),e._zod.pattern=Ku,e._zod.parse=(r,o)=>{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}});var Bl=g("$ZodNull",(e,t)=>{K.init(e,t),e._zod.pattern=Wu,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Wl=g("$ZodAny",(e,t)=>{K.init(e,t),e._zod.parse=r=>r}),Gl=g("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=r=>r}),Yl=g("$ZodNever",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Ql=g("$ZodDate",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function fl(e,t,r){e.issues.length&&t.issues.push(...it(r,e.issues)),t.value[r]=e.value}var Xl=g("$ZodArray",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>fl(u,r,i))):fl(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function an(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...it(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function ed(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Os(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function td(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let f in t){if(f==="__proto__"||a.has(f))continue;if(u==="never"){i.push(f);continue}let m=c.run({value:t[f],issues:[]},o);m instanceof Promise?e.push(m.then(h=>an(h,r,f,t,l,d))):an(m,r,f,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var J_=g("$ZodObject",(e,t)=>{if(K.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=nr(()=>ed(t));H(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let n=Nt,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],d=i.shape;for(let f of i.keys){let m=d[f],h=m._zod.optin==="optional",_=m._zod.optout==="optional",v=m._zod.run({value:u[f],issues:[]},c);v instanceof Promise?l.push(v.then($=>an($,a,f,u,h,_))):an(v,a,f,u,h,_)}return s?td(l,u,a,c,o.value,e):l.length?Promise.all(l).then(()=>a):a}}),rd=g("$ZodObjectJIT",(e,t)=>{J_.init(e,t);let r=e._zod.parse,o=nr(()=>ed(t)),n=f=>{let m=new nn(["shape","payload","ctx"]),h=o.value,_=z=>{let P=Yo(z);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};m.write("const input = payload.value;");let v=Object.create(null),$=0;for(let z of h.keys)v[z]=`key_${$++}`;m.write("const newResult = {};");for(let z of h.keys){let P=v[z],y=Yo(z),w=f[z],A=w?._zod?.optin==="optional",se=w?._zod?.optout==="optional";m.write(`const ${P} = ${_(z)};`),A&&se?m.write(`
17
+ `))}};var hl={major:4,minor:4,patch:3};var J=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=hl;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,c)=>{let u=$t(i),l;for(let d of a){if(d._zod.def.when){if(qs(i)||!d._zod.def.when(i))continue}else if(u)continue;let f=i.issues.length,m=d._zod.check(i);if(m instanceof Promise&&c?.async===!1)throw new Xe;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,i.issues.length!==f&&(u||(u=$t(i,f)))});else{if(i.issues.length===f)continue;u||(u=$t(i,f))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if($t(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Xe;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Xe;return c.then(u=>n(u,o,a))}return n(c,o,a)}}H(e,"~standard",()=>({validate:n=>{try{let s=Lr(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return an(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),dn=g("$ZodString",(e,t)=>{J.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Bu(e._zod.bag),e._zod.parse=(r,o)=>{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}}),Q=g("$ZodStringFormat",(e,t)=>{Hr.init(e,t),dn.init(e,t)}),xl=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Cu),Q.init(e,t)}),Sl=g("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Vs(o))}else t.pattern??(t.pattern=Vs());Q.init(e,t)}),kl=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Au),Q.init(e,t)}),Pl=g("$ZodURL",(e,t)=>{Q.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===Uu.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.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(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.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=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),El=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Nu()),Q.init(e,t)}),Tl=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ou),Q.init(e,t)}),Rl=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ku),Q.init(e,t)}),Ol=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Pu),Q.init(e,t)}),Il=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Eu),Q.init(e,t)}),Cl=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Tu),Q.init(e,t)}),Al=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ru),Q.init(e,t)}),Nl=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ku(t)),Q.init(e,t)}),jl=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Vu),Q.init(e,t)}),Zl=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ju(t)),Q.init(e,t)}),Ml=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Iu),Q.init(e,t)}),ql=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ju),Q.init(e,t),e._zod.bag.format="ipv4"}),Dl=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zu),Q.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})}}});var Ul=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Mu),Q.init(e,t)}),Ll=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=qu),Q.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Fl(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Vl=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Du),Q.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Fl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function ty(e){if(!Hs.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fl(r)}var Hl=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Hs),Q.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{ty(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Jl=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Lu),Q.init(e,t)});function ry(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Kl=g("$ZodJWT",(e,t)=>{Q.init(e,t),e._zod.check=r=>{ry(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Gs=g("$ZodNumber",(e,t)=>{J.init(e,t),e._zod.pattern=e._zod.bag.pattern??Js,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Bl=g("$ZodNumberFormat",(e,t)=>{ol.init(e,t),Gs.init(e,t)}),Wl=g("$ZodBoolean",(e,t)=>{J.init(e,t),e._zod.pattern=Yu,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Gl=g("$ZodBigInt",(e,t)=>{J.init(e,t),e._zod.pattern=Wu,e._zod.parse=(r,o)=>{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}});var Yl=g("$ZodNull",(e,t)=>{J.init(e,t),e._zod.pattern=Qu,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Ql=g("$ZodAny",(e,t)=>{J.init(e,t),e._zod.parse=r=>r}),Xl=g("$ZodUnknown",(e,t)=>{J.init(e,t),e._zod.parse=r=>r}),ed=g("$ZodNever",(e,t)=>{J.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var td=g("$ZodDate",(e,t)=>{J.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function gl(e,t,r){e.issues.length&&t.issues.push(...at(r,e.issues)),t.value[r]=e.value}var rd=g("$ZodArray",(e,t)=>{J.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>gl(u,r,i))):gl(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function ln(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...at(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function od(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Zs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function nd(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let f in t){if(f==="__proto__"||a.has(f))continue;if(u==="never"){i.push(f);continue}let m=c.run({value:t[f],issues:[]},o);m instanceof Promise?e.push(m.then(h=>ln(h,r,f,t,l,d))):ln(m,r,f,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var oy=g("$ZodObject",(e,t)=>{if(J.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=nr(()=>od(t));H(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let n=Nt,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],d=i.shape;for(let f of i.keys){let m=d[f],h=m._zod.optin==="optional",_=m._zod.optout==="optional",v=m._zod.run({value:u[f],issues:[]},c);v instanceof Promise?l.push(v.then(w=>ln(w,a,f,u,h,_))):ln(v,a,f,u,h,_)}return s?nd(l,u,a,c,o.value,e):l.length?Promise.all(l).then(()=>a):a}}),sd=g("$ZodObjectJIT",(e,t)=>{oy.init(e,t);let r=e._zod.parse,o=nr(()=>od(t)),n=f=>{let m=new cn(["shape","payload","ctx"]),h=o.value,_=z=>{let P=en(z);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};m.write("const input = payload.value;");let v=Object.create(null),w=0;for(let z of h.keys)v[z]=`key_${w++}`;m.write("const newResult = {};");for(let z of h.keys){let P=v[z],y=en(z),$=f[z],C=$?._zod?.optin==="optional",se=$?._zod?.optout==="optional";m.write(`const ${P} = ${_(z)};`),C&&se?m.write(`
18
18
  if (${P}.issues.length) {
19
19
  if (${y} in input) {
20
20
  payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
@@ -32,7 +32,7 @@ var u_=Object.create;var bs=Object.defineProperty;var l_=Object.getOwnPropertyDe
32
32
  newResult[${y}] = ${P}.value;
33
33
  }
34
34
 
35
- `):A?m.write(`
35
+ `):C?m.write(`
36
36
  if (${P}.issues.length) {
37
37
  payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
38
38
  ...iss,
@@ -73,32 +73,36 @@ var u_=Object.create;var bs=Object.defineProperty;var l_=Object.getOwnPropertyDe
73
73
  }
74
74
  }
75
75
 
76
- `)}m.write("payload.value = newResult;"),m.write("return payload;");let k=m.compile();return(z,P)=>k(f,z,P)},s,i=Nt,a=!rr.jitless,u=a&&Ts.value,l=t.catchall,d;e._zod.parse=(f,m)=>{d??(d=o.value);let h=f.value;return i(h)?a&&u&&m?.async===!1&&m.jitless!==!0?(s||(s=n(t.shape)),f=s(f,m),l?td([],h,f,m,d,e):f):r(f,m):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function ml(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!$t(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>qe(i,o,Te())))}),t)}var Hs=g("$ZodUnion",(e,t)=>{K.init(e,t),H(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),H(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),H(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),H(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>qr(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>ml(a,o,e,n)):ml(i,o,e,n)}});var od=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Hs.init(e,t);let r=e._zod.parse;H(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=nr(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!Nt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),nd=g("$ZodIntersection",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>hl(r,c,u)):hl(r,s,i)}});function Fs(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(vt(e)&&vt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=Fs(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Fs(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function hl(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&e.issues.push({...n,keys:s}),$t(e))return e;let i=Fs(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var sd=g("$ZodRecord",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!vt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>qe(m,o,Te())),input:u,path:[u],inst:e});continue}let d=l.value,f=t.valueType._zod.run({value:n[u],issues:[]},o);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&r.issues.push(...it(u,m.issues)),r.value[d]=m.value})):(f.issues.length&&r.issues.push(...it(u,f.issues)),r.value[d]=f.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Ds.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},o);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[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>qe(d,o,Te())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...it(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...it(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var id=g("$ZodEnum",(e,t)=>{K.init(e,t);let r=jr(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Rs.has(typeof n)).map(n=>typeof n=="string"?st(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),ad=g("$ZodLiteral",(e,t)=>{if(K.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(o=>typeof o=="string"?st(o):o?st(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var cd=g("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new tr(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Qe;return r.value=n,r.fallback=!0,r}});function gl(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Ks=g("$ZodOptional",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.optout="optional",H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),H(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${qr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>gl(i,n)):gl(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),ud=g("$ZodExactOptional",(e,t)=>{Ks.init(e,t),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),ld=g("$ZodNullable",(e,t)=>{K.init(e,t),H(e._zod,"optin",()=>t.innerType._zod.optin),H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${qr(r.source)}|null)$`):void 0}),H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),dd=g("$ZodDefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>_l(s,t)):_l(n,t)}});function _l(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var pd=g("$ZodPrefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),fd=g("$ZodNonOptional",(e,t)=>{K.init(e,t),H(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>yl(s,e)):yl(n,e)}});function yl(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 md=g("$ZodCatch",(e,t)=>{K.init(e,t),e._zod.optin="optional",H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>qe(i,o,Te()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>qe(s,o,Te()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var Js=g("$ZodPipe",(e,t)=>{K.init(e,t),H(e._zod,"values",()=>t.in._zod.values),H(e._zod,"optin",()=>t.in._zod.optin),H(e._zod,"optout",()=>t.out._zod.optout),H(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>sn(i,t.in,o)):sn(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>sn(s,t.out,o)):sn(n,t.out,o)}});function sn(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var hd=g("$ZodPreprocess",(e,t)=>{Js.init(e,t)}),gd=g("$ZodReadonly",(e,t)=>{K.init(e,t),H(e._zod,"propValues",()=>t.innerType._zod.propValues),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"optin",()=>t.innerType?._zod?.optin),H(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(vl):vl(n)}});function vl(e){return e.value=Object.freeze(e.value),e}var _d=g("$ZodCustom",(e,t)=>{pe.init(e,t),K.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>$l(s,r,o,e));$l(n,r,o,e)}});function $l(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(sr(n))}}var B_=()=>{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(n){return e[n]??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"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=Cs(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${Xo(n.values[0])}`:`Invalid option: expected one of ${Go(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Go(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function yd(){return{localeError:B_()}}var vd,W_=Symbol("ZodOutput"),G_=Symbol("ZodInput"),Bs=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.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 o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function $d(){return new Bs}(vd=globalThis).__zod_globalRegistry??(vd.__zod_globalRegistry=$d());var wt=globalThis.__zod_globalRegistry;function wd(e,t){return new e({type:"string",...R(t)})}function bd(e,t){return new e({type:"string",coerce:!0,...R(t)})}function zd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function Ws(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function xd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function Sd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function kd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function Pd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Gs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function Ed(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function Td(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function Rd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function Od(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function Id(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function Ad(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function Cd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function Nd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function jd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function Zd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function qd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function Md(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function Dd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function Ud(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function Ld(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function Fd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function Vd(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Hd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function Kd(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function Jd(e,t){return new e({type:"number",checks:[],...R(t)})}function Bd(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function Wd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function Gd(e,t){return new e({type:"boolean",...R(t)})}function Yd(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function Qd(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function Xd(e,t){return new e({type:"null",...R(t)})}function ep(e){return new e({type:"any"})}function tp(e){return new e({type:"unknown"})}function rp(e,t){return new e({type:"never",...R(t)})}function op(e,t){return new e({type:"date",coerce:!0,...R(t)})}function ir(e,t){return new Us({check:"less_than",...R(t),value:e,inclusive:!1})}function at(e,t){return new Us({check:"less_than",...R(t),value:e,inclusive:!0})}function ar(e,t){return new Ls({check:"greater_than",...R(t),value:e,inclusive:!1})}function He(e,t){return new Ls({check:"greater_than",...R(t),value:e,inclusive:!0})}function Hr(e,t){return new Xu({check:"multiple_of",...R(t),value:e})}function un(e,t){return new tl({check:"max_length",...R(t),maximum:e})}function cr(e,t){return new rl({check:"min_length",...R(t),minimum:e})}function ln(e,t){return new ol({check:"length_equals",...R(t),length:e})}function Ys(e,t){return new nl({check:"string_format",format:"regex",...R(t),pattern:e})}function Qs(e){return new sl({check:"string_format",format:"lowercase",...R(e)})}function Xs(e){return new il({check:"string_format",format:"uppercase",...R(e)})}function ei(e,t){return new al({check:"string_format",format:"includes",...R(t),includes:e})}function ti(e,t){return new cl({check:"string_format",format:"starts_with",...R(t),prefix:e})}function ri(e,t){return new ul({check:"string_format",format:"ends_with",...R(t),suffix:e})}function bt(e){return new ll({check:"overwrite",tx:e})}function oi(e){return bt(t=>t.normalize(e))}function ni(){return bt(e=>e.trim())}function si(){return bt(e=>e.toLowerCase())}function ii(){return bt(e=>e.toUpperCase())}function ai(){return bt(e=>Es(e))}function np(e,t,r){return new e({type:"array",element:t,...R(r)})}function sp(e,t,r){let o=R(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function ip(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function ap(e,t){let r=Y_(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(sr(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(sr(s))}},e(o.value,o)),t);return r}function Y_(e,t){let r=new pe({check:"custom",...R(t)});return r._zod.check=e,r}function ci(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??wt,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 ae(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let f=i.schema,m=t.processors[n.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,f,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),ae(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&xe(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function ui(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,f=e.external.uri??(h=>h);if(d)return{ref:f(d)};let m=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=m,{defId:m,ref:`${f("__shared")}#/${a}/${m}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
76
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");let k=m.compile();return(z,P)=>k(f,z,P)},s,i=Nt,a=!rr.jitless,u=a&&Ns.value,l=t.catchall,d;e._zod.parse=(f,m)=>{d??(d=o.value);let h=f.value;return i(h)?a&&u&&m?.async===!1&&m.jitless!==!0?(s||(s=n(t.shape)),f=s(f,m),l?nd([],h,f,m,d,e):f):r(f,m):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function _l(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!$t(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Me(i,o,Te())))}),t)}var Ys=g("$ZodUnion",(e,t)=>{J.init(e,t),H(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),H(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),H(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),H(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>qr(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>_l(a,o,e,n)):_l(i,o,e,n)}});var id=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ys.init(e,t);let r=e._zod.parse;H(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=nr(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!Nt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),ad=g("$ZodIntersection",(e,t)=>{J.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>yl(r,c,u)):yl(r,s,i)}});function Ws(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(wt(e)&&wt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=Ws(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Ws(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function yl(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&e.issues.push({...n,keys:s}),$t(e))return e;let i=Ws(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var cd=g("$ZodRecord",(e,t)=>{J.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!wt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>Me(m,o,Te())),input:u,path:[u],inst:e});continue}let d=l.value,f=t.valueType._zod.run({value:n[u],issues:[]},o);f instanceof Promise?s.push(f.then(m=>{m.issues.length&&r.issues.push(...at(u,m.issues)),r.value[d]=m.value})):(f.issues.length&&r.issues.push(...at(u,f.issues)),r.value[d]=f.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Js.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},o);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[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Me(d,o,Te())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...at(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...at(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var ud=g("$ZodEnum",(e,t)=>{J.init(e,t);let r=Zr(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>js.has(typeof n)).map(n=>typeof n=="string"?it(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),ld=g("$ZodLiteral",(e,t)=>{if(J.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(o=>typeof o=="string"?it(o):o?it(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var dd=g("$ZodTransform",(e,t)=>{J.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new tr(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Xe;return r.value=n,r.fallback=!0,r}});function vl(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Qs=g("$ZodOptional",(e,t)=>{J.init(e,t),e._zod.optin="optional",e._zod.optout="optional",H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),H(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${qr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>vl(i,n)):vl(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),pd=g("$ZodExactOptional",(e,t)=>{Qs.init(e,t),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),fd=g("$ZodNullable",(e,t)=>{J.init(e,t),H(e._zod,"optin",()=>t.innerType._zod.optin),H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${qr(r.source)}|null)$`):void 0}),H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),md=g("$ZodDefault",(e,t)=>{J.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>wl(s,t)):wl(n,t)}});function wl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var hd=g("$ZodPrefault",(e,t)=>{J.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),gd=g("$ZodNonOptional",(e,t)=>{J.init(e,t),H(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>$l(s,e)):$l(n,e)}});function $l(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 _d=g("$ZodCatch",(e,t)=>{J.init(e,t),e._zod.optin="optional",H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Me(i,o,Te()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>Me(s,o,Te()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var Xs=g("$ZodPipe",(e,t)=>{J.init(e,t),H(e._zod,"values",()=>t.in._zod.values),H(e._zod,"optin",()=>t.in._zod.optin),H(e._zod,"optout",()=>t.out._zod.optout),H(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>un(i,t.in,o)):un(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>un(s,t.out,o)):un(n,t.out,o)}});function un(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var yd=g("$ZodPreprocess",(e,t)=>{Xs.init(e,t)}),vd=g("$ZodReadonly",(e,t)=>{J.init(e,t),H(e._zod,"propValues",()=>t.innerType._zod.propValues),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"optin",()=>t.innerType?._zod?.optin),H(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(bl):bl(n)}});function bl(e){return e.value=Object.freeze(e.value),e}var wd=g("$ZodCustom",(e,t)=>{pe.init(e,t),J.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>zl(s,r,o,e));zl(n,r,o,e)}});function zl(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(sr(n))}}var ny=()=>{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(n){return e[n]??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"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=Ds(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${rn(n.values[0])}`:`Invalid option: expected one of ${Xo(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Xo(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function $d(){return{localeError:ny()}}var bd,sy=Symbol("ZodOutput"),iy=Symbol("ZodInput"),ei=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.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 o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function zd(){return new ei}(bd=globalThis).__zod_globalRegistry??(bd.__zod_globalRegistry=zd());var bt=globalThis.__zod_globalRegistry;function xd(e,t){return new e({type:"string",...R(t)})}function Sd(e,t){return new e({type:"string",coerce:!0,...R(t)})}function kd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function ti(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function Pd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function Ed(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function Td(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function Rd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function ri(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function Od(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function Id(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function Cd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function Ad(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function Nd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function jd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function Zd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function Md(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function qd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function Dd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function Ud(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function Ld(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function Fd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function Vd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function Hd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function Jd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function Kd(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Bd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function Wd(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function Gd(e,t){return new e({type:"number",checks:[],...R(t)})}function Yd(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function Qd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function Xd(e,t){return new e({type:"boolean",...R(t)})}function ep(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function tp(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function rp(e,t){return new e({type:"null",...R(t)})}function op(e){return new e({type:"any"})}function np(e){return new e({type:"unknown"})}function sp(e,t){return new e({type:"never",...R(t)})}function ip(e,t){return new e({type:"date",coerce:!0,...R(t)})}function ir(e,t){return new Ks({check:"less_than",...R(t),value:e,inclusive:!1})}function ct(e,t){return new Ks({check:"less_than",...R(t),value:e,inclusive:!0})}function ar(e,t){return new Bs({check:"greater_than",...R(t),value:e,inclusive:!1})}function Je(e,t){return new Bs({check:"greater_than",...R(t),value:e,inclusive:!0})}function Jr(e,t){return new rl({check:"multiple_of",...R(t),value:e})}function pn(e,t){return new nl({check:"max_length",...R(t),maximum:e})}function cr(e,t){return new sl({check:"min_length",...R(t),minimum:e})}function fn(e,t){return new il({check:"length_equals",...R(t),length:e})}function oi(e,t){return new al({check:"string_format",format:"regex",...R(t),pattern:e})}function ni(e){return new cl({check:"string_format",format:"lowercase",...R(e)})}function si(e){return new ul({check:"string_format",format:"uppercase",...R(e)})}function ii(e,t){return new ll({check:"string_format",format:"includes",...R(t),includes:e})}function ai(e,t){return new dl({check:"string_format",format:"starts_with",...R(t),prefix:e})}function ci(e,t){return new pl({check:"string_format",format:"ends_with",...R(t),suffix:e})}function zt(e){return new fl({check:"overwrite",tx:e})}function ui(e){return zt(t=>t.normalize(e))}function li(){return zt(e=>e.trim())}function di(){return zt(e=>e.toLowerCase())}function pi(){return zt(e=>e.toUpperCase())}function fi(){return zt(e=>As(e))}function ap(e,t,r){return new e({type:"array",element:t,...R(r)})}function cp(e,t,r){let o=R(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function up(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function lp(e,t){let r=ay(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(sr(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(sr(s))}},e(o.value,o)),t);return r}function ay(e,t){let r=new pe({check:"custom",...R(t)});return r._zod.check=e,r}function mi(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??bt,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 ae(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let f=i.schema,m=t.processors[n.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,f,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),ae(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&xe(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function hi(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,f=e.external.uri??(h=>h);if(d)return{ref:f(d)};let m=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=m,{defId:m,ref:`${f("__shared")}#/${a}/${m}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
77
77
 
78
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function li(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let m=e.seen.get(d),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Object.assign(u,h),Object.assign(u,l),a._zod.parent===d)for(let v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(h.$ref&&m.def)for(let v in u)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(u[v])===JSON.stringify(m.def[v])&&delete u[v]}let f=a._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let h in u)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(u[h])===JSON.stringify(m.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$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");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Kr(t,"input",e.processors),output:Kr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function xe(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return xe(o.element,r);if(o.type==="set")return xe(o.valueType,r);if(o.type==="lazy")return xe(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return xe(o.innerType,r);if(o.type==="intersection")return xe(o.left,r)||xe(o.right,r);if(o.type==="record"||o.type==="map")return xe(o.keyType,r)||xe(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:xe(o.in,r)||xe(o.out,r);if(o.type==="object"){for(let n in o.shape)if(xe(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(xe(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(xe(n,r))return!0;return!!(o.rest&&xe(o.rest,r))}return!1}var cp=(e,t={})=>r=>{let o=ci({...r,processors:t});return ae(e,o),ui(o,e),li(o,e)},Kr=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=ci({...n??{},target:s,io:t,processors:r});return ae(e,i),ui(i,e),li(i,e)};var Q_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},up=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=Q_[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},lp=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),f=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";d?m?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),f?m?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},dp=(e,t,r,o)=>{r.type="boolean"},pp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};var fp=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var mp=(e,t,r,o)=>{r.not={}},hp=(e,t,r,o)=>{},gp=(e,t,r,o)=>{},_p=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},yp=(e,t,r,o)=>{let n=e._zod.def,s=jr(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},vp=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var $p=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var wp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var bp=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=ae(s.element,t,{...o,path:[...o.path,"items"]})},zp=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=ae(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=ae(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},xp=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>ae(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Sp=(e,t,r,o)=>{let n=e._zod.def,s=ae(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=ae(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var kp=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=ae(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=ae(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=ae(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},Pp=(e,t,r,o)=>{let n=e._zod.def,s=ae(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Ep=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Tp=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Rp=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Op=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Ip=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;ae(i,t,o);let a=t.seen.get(e);a.ref=i},Ap=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var di=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType};function lr(e){return!!e._zod}function Ke(e,t){return lr(e)?Ur(e,t):e.safeParse(t)}function dn(e){if(!e)return;let t;if(lr(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Cp(e){if(lr(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=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 o=e.value;if(o!==void 0)return o}var Jr={};zs(Jr,{ZodISODate:()=>jp,ZodISODateTime:()=>Np,ZodISODuration:()=>qp,ZodISOTime:()=>Zp,date:()=>fi,datetime:()=>pi,duration:()=>hi,time:()=>mi});var Np=g("ZodISODateTime",(e,t)=>{Il.init(e,t),re.init(e,t)});function pi(e){return Fd(Np,e)}var jp=g("ZodISODate",(e,t)=>{Al.init(e,t),re.init(e,t)});function fi(e){return Vd(jp,e)}var Zp=g("ZodISOTime",(e,t)=>{Cl.init(e,t),re.init(e,t)});function mi(e){return Hd(Zp,e)}var qp=g("ZodISODuration",(e,t)=>{Nl.init(e,t),re.init(e,t)});function hi(e){return Kd(qp,e)}var iy=(e,t)=>{en.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Zs(e,r)},flatten:{value:r=>js(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,or,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,or,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Ne=g("ZodError",iy,{Parent:Error});var Dp=tn(Ne),Up=rn(Ne),Lp=Dr(Ne),Fp=Lr(Ne),Vp=hu(Ne),Hp=gu(Ne),Kp=_u(Ne),Jp=yu(Ne),Bp=vu(Ne),Wp=$u(Ne),Gp=wu(Ne),Yp=bu(Ne);var Qp=new WeakMap;function Br(e,t,r){let o=Object.getPrototypeOf(e),n=Qp.get(o);if(n||(n=new Set,Qp.set(o,n)),!n.has(t)){n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var B=g("ZodType",(e,t)=>(K.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Kr(e,"input"),output:Kr(e,"output")}}),e.toJSONSchema=cp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Dp(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Lp(e,r,o),e.parseAsync=async(r,o)=>Up(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Fp(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Vp(e,r,o),e.decode=(r,o)=>Hp(e,r,o),e.encodeAsync=async(r,o)=>Kp(e,r,o),e.decodeAsync=async(r,o)=>Jp(e,r,o),e.safeEncode=(r,o)=>Bp(e,r,o),e.safeDecode=(r,o)=>Wp(e,r,o),e.safeEncodeAsync=async(r,o)=>Gp(e,r,o),e.safeDecodeAsync=async(r,o)=>Yp(e,r,o),Br(e,"ZodType",{check(...r){let o=this.def;return this.clone(M.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ze(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(By(r,o))},superRefine(r,o){return this.check(Wy(r,o))},overwrite(r){return this.check(bt(r))},optional(){return ne(this)},exactOptional(){return jy(this)},nullable(){return rf(this)},nullish(){return ne(rf(this))},nonoptional(r){return Ly(this,r)},array(){return b(this)},or(r){return X([this,r])},and(r){return mn(this,r)},transform(r){return of(this,mf(r))},default(r){return My(this,r)},prefault(r){return Uy(this,r)},catch(r){return Vy(this,r)},pipe(r){return of(this,r)},readonly(){return Jy(this)},describe(r){let o=this.clone();return wt.add(o,{description:r}),o},meta(...r){if(r.length===0)return wt.get(this);let o=this.clone();return wt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return wt.get(e)?.description},configurable:!0}),e)),nf=g("_ZodString",(e,t)=>{cn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>up(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Br(e,"_ZodString",{regex(...o){return this.check(Ys(...o))},includes(...o){return this.check(ei(...o))},startsWith(...o){return this.check(ti(...o))},endsWith(...o){return this.check(ri(...o))},min(...o){return this.check(cr(...o))},max(...o){return this.check(un(...o))},length(...o){return this.check(ln(...o))},nonempty(...o){return this.check(cr(1,...o))},lowercase(o){return this.check(Qs(o))},uppercase(o){return this.check(Xs(o))},trim(){return this.check(ni())},normalize(...o){return this.check(oi(...o))},toLowerCase(){return this.check(si())},toUpperCase(){return this.check(ii())},slugify(){return this.check(ai())}})}),_i=g("ZodString",(e,t)=>{cn.init(e,t),nf.init(e,t),e.email=r=>e.check(zd(cy,r)),e.url=r=>e.check(Gs(sf,r)),e.jwt=r=>e.check(Ld(zy,r)),e.emoji=r=>e.check(Ed(uy,r)),e.guid=r=>e.check(Ws(Xp,r)),e.uuid=r=>e.check(xd(pn,r)),e.uuidv4=r=>e.check(Sd(pn,r)),e.uuidv6=r=>e.check(kd(pn,r)),e.uuidv7=r=>e.check(Pd(pn,r)),e.nanoid=r=>e.check(Td(ly,r)),e.guid=r=>e.check(Ws(Xp,r)),e.cuid=r=>e.check(Rd(dy,r)),e.cuid2=r=>e.check(Od(py,r)),e.ulid=r=>e.check(Id(fy,r)),e.base64=r=>e.check(Md($y,r)),e.base64url=r=>e.check(Dd(wy,r)),e.xid=r=>e.check(Ad(my,r)),e.ksuid=r=>e.check(Cd(hy,r)),e.ipv4=r=>e.check(Nd(gy,r)),e.ipv6=r=>e.check(jd(_y,r)),e.cidrv4=r=>e.check(Zd(yy,r)),e.cidrv6=r=>e.check(qd(vy,r)),e.e164=r=>e.check(Ud(by,r)),e.datetime=r=>e.check(pi(r)),e.date=r=>e.check(fi(r)),e.time=r=>e.check(mi(r)),e.duration=r=>e.check(hi(r))});function p(e){return wd(_i,e)}var re=g("ZodStringFormat",(e,t)=>{Q.init(e,t),nf.init(e,t)}),cy=g("ZodEmail",(e,t)=>{zl.init(e,t),re.init(e,t)});var Xp=g("ZodGUID",(e,t)=>{wl.init(e,t),re.init(e,t)});var pn=g("ZodUUID",(e,t)=>{bl.init(e,t),re.init(e,t)});var sf=g("ZodURL",(e,t)=>{xl.init(e,t),re.init(e,t)});function af(e){return Gs(sf,e)}var uy=g("ZodEmoji",(e,t)=>{Sl.init(e,t),re.init(e,t)});var ly=g("ZodNanoID",(e,t)=>{kl.init(e,t),re.init(e,t)});var dy=g("ZodCUID",(e,t)=>{Pl.init(e,t),re.init(e,t)});var py=g("ZodCUID2",(e,t)=>{El.init(e,t),re.init(e,t)});var fy=g("ZodULID",(e,t)=>{Tl.init(e,t),re.init(e,t)});var my=g("ZodXID",(e,t)=>{Rl.init(e,t),re.init(e,t)});var hy=g("ZodKSUID",(e,t)=>{Ol.init(e,t),re.init(e,t)});var gy=g("ZodIPv4",(e,t)=>{jl.init(e,t),re.init(e,t)});var _y=g("ZodIPv6",(e,t)=>{Zl.init(e,t),re.init(e,t)});var yy=g("ZodCIDRv4",(e,t)=>{ql.init(e,t),re.init(e,t)});var vy=g("ZodCIDRv6",(e,t)=>{Ml.init(e,t),re.init(e,t)});var $y=g("ZodBase64",(e,t)=>{Ul.init(e,t),re.init(e,t)});var wy=g("ZodBase64URL",(e,t)=>{Ll.init(e,t),re.init(e,t)});var by=g("ZodE164",(e,t)=>{Fl.init(e,t),re.init(e,t)});var zy=g("ZodJWT",(e,t)=>{Vl.init(e,t),re.init(e,t)});var fn=g("ZodNumber",(e,t)=>{Vs.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>lp(e,o,n,s),Br(e,"ZodNumber",{gt(o,n){return this.check(ar(o,n))},gte(o,n){return this.check(He(o,n))},min(o,n){return this.check(He(o,n))},lt(o,n){return this.check(ir(o,n))},lte(o,n){return this.check(at(o,n))},max(o,n){return this.check(at(o,n))},int(o){return this.check(ef(o))},safe(o){return this.check(ef(o))},positive(o){return this.check(ar(0,o))},nonnegative(o){return this.check(He(0,o))},negative(o){return this.check(ir(0,o))},nonpositive(o){return this.check(at(0,o))},multipleOf(o,n){return this.check(Hr(o,n))},step(o,n){return this.check(Hr(o,n))},finite(){return this}});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 F(e){return Jd(fn,e)}var xy=g("ZodNumberFormat",(e,t)=>{Hl.init(e,t),fn.init(e,t)});function ef(e){return Wd(xy,e)}var yi=g("ZodBoolean",(e,t)=>{Kl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dp(e,r,o,n)});function W(e){return Gd(yi,e)}var cf=g("ZodBigInt",(e,t)=>{Jl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>pp(e,o,n,s),e.gte=(o,n)=>e.check(He(o,n)),e.min=(o,n)=>e.check(He(o,n)),e.gt=(o,n)=>e.check(ar(o,n)),e.gte=(o,n)=>e.check(He(o,n)),e.min=(o,n)=>e.check(He(o,n)),e.lt=(o,n)=>e.check(ir(o,n)),e.lte=(o,n)=>e.check(at(o,n)),e.max=(o,n)=>e.check(at(o,n)),e.positive=o=>e.check(ar(BigInt(0),o)),e.negative=o=>e.check(ir(BigInt(0),o)),e.nonpositive=o=>e.check(at(BigInt(0),o)),e.nonnegative=o=>e.check(He(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Hr(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var Sy=g("ZodNull",(e,t)=>{Bl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fp(e,r,o,n)});function uf(e){return Xd(Sy,e)}var ky=g("ZodAny",(e,t)=>{Wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hp(e,r,o,n)});function lf(){return ep(ky)}var Py=g("ZodUnknown",(e,t)=>{Gl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gp(e,r,o,n)});function oe(){return tp(Py)}var Ey=g("ZodNever",(e,t)=>{Yl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mp(e,r,o,n)});function Ty(e){return rp(Ey,e)}var df=g("ZodDate",(e,t)=>{Ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>_p(e,o,n,s),e.min=(o,n)=>e.check(He(o,n)),e.max=(o,n)=>e.check(at(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var Ry=g("ZodArray",(e,t)=>{Xl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bp(e,r,o,n),e.element=t.element,Br(e,"ZodArray",{min(r,o){return this.check(cr(r,o))},nonempty(r){return this.check(cr(1,r))},max(r,o){return this.check(un(r,o))},length(r,o){return this.check(ln(r,o))},unwrap(){return this.element}})});function b(e,t){return np(Ry,e,t)}var pf=g("ZodObject",(e,t)=>{rd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zp(e,r,o,n),M.defineLazy(e,"shape",()=>t.shape),Br(e,"ZodObject",{keyof(){return Re(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:oe()})},loose(){return this.clone({...this._zod.def,catchall:oe()})},strict(){return this.clone({...this._zod.def,catchall:Ty()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return M.extend(this,r)},safeExtend(r){return M.safeExtend(this,r)},merge(r){return M.merge(this,r)},pick(r){return M.pick(this,r)},omit(r){return M.omit(this,r)},partial(...r){return M.partial(hf,this,r[0])},required(...r){return M.required(gf,this,r[0])}})});function x(e,t){let r={type:"object",shape:e??{},...M.normalizeParams(t)};return new pf(r)}function le(e,t){return new pf({type:"object",shape:e,catchall:oe(),...M.normalizeParams(t)})}var ff=g("ZodUnion",(e,t)=>{Hs.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xp(e,r,o,n),e.options=t.options});function X(e,t){return new ff({type:"union",options:e,...M.normalizeParams(t)})}var Oy=g("ZodDiscriminatedUnion",(e,t)=>{ff.init(e,t),od.init(e,t)});function vi(e,t,r){return new Oy({type:"union",options:t,discriminator:e,...M.normalizeParams(r)})}var Iy=g("ZodIntersection",(e,t)=>{nd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sp(e,r,o,n)});function mn(e,t){return new Iy({type:"intersection",left:e,right:t})}var tf=g("ZodRecord",(e,t)=>{sd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kp(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Y(e,t,r){return!t||!t._zod?new tf({type:"record",keyType:p(),valueType:e,...M.normalizeParams(t)}):new tf({type:"record",keyType:e,valueType:t,...M.normalizeParams(r)})}var gi=g("ZodEnum",(e,t)=>{id.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>yp(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new gi({...t,checks:[],...M.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new gi({...t,checks:[],...M.normalizeParams(n),entries:s})}});function Re(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new gi({type:"enum",entries:r,...M.normalizeParams(t)})}var Ay=g("ZodLiteral",(e,t)=>{ad.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vp(e,r,o,n),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 E(e,t){return new Ay({type:"literal",values:Array.isArray(e)?e:[e],...M.normalizeParams(t)})}var Cy=g("ZodTransform",(e,t)=>{cd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wp(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new tr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(M.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(M.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function mf(e){return new Cy({type:"transform",transform:e})}var hf=g("ZodOptional",(e,t)=>{Ks.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>di(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ne(e){return new hf({type:"optional",innerType:e})}var Ny=g("ZodExactOptional",(e,t)=>{ud.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>di(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function jy(e){return new Ny({type:"optional",innerType:e})}var Zy=g("ZodNullable",(e,t)=>{ld.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function rf(e){return new Zy({type:"nullable",innerType:e})}var qy=g("ZodDefault",(e,t)=>{dd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function My(e,t){return new qy({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():M.shallowClone(t)}})}var Dy=g("ZodPrefault",(e,t)=>{pd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Uy(e,t){return new Dy({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():M.shallowClone(t)}})}var gf=g("ZodNonOptional",(e,t)=>{fd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ep(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Ly(e,t){return new gf({type:"nonoptional",innerType:e,...M.normalizeParams(t)})}var Fy=g("ZodCatch",(e,t)=>{md.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Op(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vy(e,t){return new Fy({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var _f=g("ZodPipe",(e,t)=>{Js.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ip(e,r,o,n),e.in=t.in,e.out=t.out});function of(e,t){return new _f({type:"pipe",in:e,out:t})}var Hy=g("ZodPreprocess",(e,t)=>{_f.init(e,t),hd.init(e,t)}),Ky=g("ZodReadonly",(e,t)=>{gd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ap(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Jy(e){return new Ky({type:"readonly",innerType:e})}var yf=g("ZodCustom",(e,t)=>{_d.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$p(e,r,o,n)});function vf(e,t){return sp(yf,e??(()=>!0),t)}function By(e,t={}){return ip(yf,e,t)}function Wy(e,t){return ap(e,t)}function $i(e,t){return new Hy({type:"pipe",in:mf(e),out:t})}var wf={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var $f;$f||($f={});var hn={};zs(hn,{bigint:()=>Xy,boolean:()=>Qy,date:()=>ev,number:()=>Yy,string:()=>Gy});function Gy(e){return bd(_i,e)}function Yy(e){return Bd(fn,e)}function Qy(e){return Yd(yi,e)}function Xy(e){return Qd(cf,e)}function ev(e){return op(df,e)}Te(yd());var pr="2025-11-25";var bf=[pr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],zt="io.modelcontextprotocol/related-task",_n="2.0",de=vf(e=>e!==null&&(typeof e=="object"||typeof e=="function")),zf=X([p(),F().int()]),xf=p(),JE=le({ttl:F().optional(),pollInterval:F().optional()}),rv=x({ttl:F().optional()}),ov=x({taskId:p()}),bi=le({progressToken:zf.optional(),[zt]:ov.optional()}),je=x({_meta:bi.optional()}),Wr=je.extend({task:rv.optional()}),Sf=e=>Wr.safeParse(e).success,fe=x({method:p(),params:je.loose().optional()}),Me=x({_meta:bi.optional()}),De=x({method:p(),params:Me.loose().optional()}),me=le({_meta:bi.optional()}),yn=X([p(),F().int()]),kf=x({jsonrpc:E(_n),id:yn,...fe.shape}).strict(),Gr=e=>kf.safeParse(e).success,Pf=x({jsonrpc:E(_n),...De.shape}).strict(),Ef=e=>Pf.safeParse(e).success,zi=x({jsonrpc:E(_n),id:yn,result:me}).strict(),jt=e=>zi.safeParse(e).success;var I;(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"})(I||(I={}));var xi=x({jsonrpc:E(_n),id:yn.optional(),error:x({code:F().int(),message:p(),data:oe().optional()})}).strict();var Tf=e=>xi.safeParse(e).success;var vn=X([kf,Pf,zi,xi]),BE=X([zi,xi]),Zt=me.strict(),nv=Me.extend({requestId:yn.optional(),reason:p().optional()}),$n=De.extend({method:E("notifications/cancelled"),params:nv}),sv=x({src:p(),mimeType:p().optional(),sizes:b(p()).optional(),theme:Re(["light","dark"]).optional()}),Yr=x({icons:b(sv).optional()}),dr=x({name:p(),title:p().optional()}),Rf=dr.extend({...dr.shape,...Yr.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),iv=mn(x({applyDefaults:W().optional()}),Y(p(),oe())),av=$i(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,mn(x({form:iv.optional(),url:de.optional()}),Y(p(),oe()).optional())),cv=le({list:de.optional(),cancel:de.optional(),requests:le({sampling:le({createMessage:de.optional()}).optional(),elicitation:le({create:de.optional()}).optional()}).optional()}),uv=le({list:de.optional(),cancel:de.optional(),requests:le({tools:le({call:de.optional()}).optional()}).optional()}),lv=x({experimental:Y(p(),de).optional(),sampling:x({context:de.optional(),tools:de.optional()}).optional(),elicitation:av.optional(),roots:x({listChanged:W().optional()}).optional(),tasks:cv.optional(),extensions:Y(p(),de).optional()}),dv=je.extend({protocolVersion:p(),capabilities:lv,clientInfo:Rf}),pv=fe.extend({method:E("initialize"),params:dv});var fv=x({experimental:Y(p(),de).optional(),logging:de.optional(),completions:de.optional(),prompts:x({listChanged:W().optional()}).optional(),resources:x({subscribe:W().optional(),listChanged:W().optional()}).optional(),tools:x({listChanged:W().optional()}).optional(),tasks:uv.optional(),extensions:Y(p(),de).optional()}),Si=me.extend({protocolVersion:p(),capabilities:fv,serverInfo:Rf,instructions:p().optional()}),Of=De.extend({method:E("notifications/initialized"),params:Me.optional()}),If=e=>Of.safeParse(e).success,wn=fe.extend({method:E("ping"),params:je.optional()}),mv=x({progress:F(),total:ne(F()),message:ne(p())}),hv=x({...Me.shape,...mv.shape,progressToken:zf}),bn=De.extend({method:E("notifications/progress"),params:hv}),gv=je.extend({cursor:xf.optional()}),Qr=fe.extend({params:gv.optional()}),Xr=me.extend({nextCursor:xf.optional()}),_v=Re(["working","input_required","completed","failed","cancelled"]),eo=x({taskId:p(),status:_v,ttl:X([F(),uf()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:ne(F()),statusMessage:ne(p())}),qt=me.extend({task:eo}),yv=Me.merge(eo),to=De.extend({method:E("notifications/tasks/status"),params:yv}),zn=fe.extend({method:E("tasks/get"),params:je.extend({taskId:p()})}),xn=me.merge(eo),Sn=fe.extend({method:E("tasks/result"),params:je.extend({taskId:p()})}),WE=me.loose(),kn=Qr.extend({method:E("tasks/list")}),Pn=Xr.extend({tasks:b(eo)}),En=fe.extend({method:E("tasks/cancel"),params:je.extend({taskId:p()})}),Af=me.merge(eo),Cf=x({uri:p(),mimeType:ne(p()),_meta:Y(p(),oe()).optional()}),Nf=Cf.extend({text:p()}),ki=p().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),jf=Cf.extend({blob:ki}),ro=Re(["user","assistant"]),fr=x({audience:b(ro).optional(),priority:F().min(0).max(1).optional(),lastModified:Jr.datetime({offset:!0}).optional()}),Zf=x({...dr.shape,...Yr.shape,uri:p(),description:ne(p()),mimeType:ne(p()),size:ne(F()),annotations:fr.optional(),_meta:ne(le({}))}),vv=x({...dr.shape,...Yr.shape,uriTemplate:p(),description:ne(p()),mimeType:ne(p()),annotations:fr.optional(),_meta:ne(le({}))}),$v=Qr.extend({method:E("resources/list")}),Pi=Xr.extend({resources:b(Zf)}),wv=Qr.extend({method:E("resources/templates/list")}),Ei=Xr.extend({resourceTemplates:b(vv)}),Ti=je.extend({uri:p()}),bv=Ti,zv=fe.extend({method:E("resources/read"),params:bv}),Ri=me.extend({contents:b(X([Nf,jf]))}),Oi=De.extend({method:E("notifications/resources/list_changed"),params:Me.optional()}),xv=Ti,Sv=fe.extend({method:E("resources/subscribe"),params:xv}),kv=Ti,Pv=fe.extend({method:E("resources/unsubscribe"),params:kv}),Ev=Me.extend({uri:p()}),Tv=De.extend({method:E("notifications/resources/updated"),params:Ev}),Rv=x({name:p(),description:ne(p()),required:ne(W())}),Ov=x({...dr.shape,...Yr.shape,description:ne(p()),arguments:ne(b(Rv)),_meta:ne(le({}))}),Iv=Qr.extend({method:E("prompts/list")}),Ii=Xr.extend({prompts:b(Ov)}),Av=je.extend({name:p(),arguments:Y(p(),p()).optional()}),Cv=fe.extend({method:E("prompts/get"),params:Av}),Ai=x({type:E("text"),text:p(),annotations:fr.optional(),_meta:Y(p(),oe()).optional()}),Ci=x({type:E("image"),data:ki,mimeType:p(),annotations:fr.optional(),_meta:Y(p(),oe()).optional()}),Ni=x({type:E("audio"),data:ki,mimeType:p(),annotations:fr.optional(),_meta:Y(p(),oe()).optional()}),Nv=x({type:E("tool_use"),name:p(),id:p(),input:Y(p(),oe()),_meta:Y(p(),oe()).optional()}),jv=x({type:E("resource"),resource:X([Nf,jf]),annotations:fr.optional(),_meta:Y(p(),oe()).optional()}),Zv=Zf.extend({type:E("resource_link")}),ji=X([Ai,Ci,Ni,Zv,jv]),qv=x({role:ro,content:ji}),Zi=me.extend({description:p().optional(),messages:b(qv)}),qi=De.extend({method:E("notifications/prompts/list_changed"),params:Me.optional()}),Mv=x({title:p().optional(),readOnlyHint:W().optional(),destructiveHint:W().optional(),idempotentHint:W().optional(),openWorldHint:W().optional()}),Dv=x({taskSupport:Re(["required","optional","forbidden"]).optional()}),qf=x({...dr.shape,...Yr.shape,description:p().optional(),inputSchema:x({type:E("object"),properties:Y(p(),de).optional(),required:b(p()).optional()}).catchall(oe()),outputSchema:x({type:E("object"),properties:Y(p(),de).optional(),required:b(p()).optional()}).catchall(oe()).optional(),annotations:Mv.optional(),execution:Dv.optional(),_meta:Y(p(),oe()).optional()}),Uv=Qr.extend({method:E("tools/list")}),Mi=Xr.extend({tools:b(qf)}),mr=me.extend({content:b(ji).default([]),structuredContent:Y(p(),oe()).optional(),isError:W().optional()}),GE=mr.or(me.extend({toolResult:oe()})),Lv=Wr.extend({name:p(),arguments:Y(p(),oe()).optional()}),Fv=fe.extend({method:E("tools/call"),params:Lv}),Di=De.extend({method:E("notifications/tools/list_changed"),params:Me.optional()}),Mf=x({autoRefresh:W().default(!0),debounceMs:F().int().nonnegative().default(300)}),Df=Re(["debug","info","notice","warning","error","critical","alert","emergency"]),Vv=je.extend({level:Df}),Hv=fe.extend({method:E("logging/setLevel"),params:Vv}),Kv=Me.extend({level:Df,logger:p().optional(),data:oe()}),Jv=De.extend({method:E("notifications/message"),params:Kv}),Bv=x({name:p().optional()}),Wv=x({hints:b(Bv).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),Gv=x({mode:Re(["auto","required","none"]).optional()}),Yv=x({type:E("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:b(ji).default([]),structuredContent:x({}).loose().optional(),isError:W().optional(),_meta:Y(p(),oe()).optional()}),Qv=vi("type",[Ai,Ci,Ni]),gn=vi("type",[Ai,Ci,Ni,Nv,Yv]),Xv=x({role:ro,content:X([gn,b(gn)]),_meta:Y(p(),oe()).optional()}),e$=Wr.extend({messages:b(Xv),modelPreferences:Wv.optional(),systemPrompt:p().optional(),includeContext:Re(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:b(p()).optional(),metadata:de.optional(),tools:b(qf).optional(),toolChoice:Gv.optional()}),Ui=fe.extend({method:E("sampling/createMessage"),params:e$}),Li=me.extend({model:p(),stopReason:ne(Re(["endTurn","stopSequence","maxTokens"]).or(p())),role:ro,content:Qv}),Fi=me.extend({model:p(),stopReason:ne(Re(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:ro,content:X([gn,b(gn)])}),t$=x({type:E("boolean"),title:p().optional(),description:p().optional(),default:W().optional()}),r$=x({type:E("string"),title:p().optional(),description:p().optional(),minLength:F().optional(),maxLength:F().optional(),format:Re(["email","uri","date","date-time"]).optional(),default:p().optional()}),o$=x({type:Re(["number","integer"]),title:p().optional(),description:p().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),n$=x({type:E("string"),title:p().optional(),description:p().optional(),enum:b(p()),default:p().optional()}),s$=x({type:E("string"),title:p().optional(),description:p().optional(),oneOf:b(x({const:p(),title:p()})),default:p().optional()}),i$=x({type:E("string"),title:p().optional(),description:p().optional(),enum:b(p()),enumNames:b(p()).optional(),default:p().optional()}),a$=X([n$,s$]),c$=x({type:E("array"),title:p().optional(),description:p().optional(),minItems:F().optional(),maxItems:F().optional(),items:x({type:E("string"),enum:b(p())}),default:b(p()).optional()}),u$=x({type:E("array"),title:p().optional(),description:p().optional(),minItems:F().optional(),maxItems:F().optional(),items:x({anyOf:b(x({const:p(),title:p()}))}),default:b(p()).optional()}),l$=X([c$,u$]),d$=X([i$,a$,l$]),p$=X([d$,t$,r$,o$]),f$=Wr.extend({mode:E("form").optional(),message:p(),requestedSchema:x({type:E("object"),properties:Y(p(),p$),required:b(p()).optional()})}),m$=Wr.extend({mode:E("url"),message:p(),elicitationId:p(),url:p().url()}),h$=X([f$,m$]),Vi=fe.extend({method:E("elicitation/create"),params:h$}),g$=Me.extend({elicitationId:p()}),_$=De.extend({method:E("notifications/elicitation/complete"),params:g$}),Hi=me.extend({action:Re(["accept","decline","cancel"]),content:$i(e=>e===null?void 0:e,Y(p(),X([p(),F(),W(),b(p())])).optional())}),y$=x({type:E("ref/resource"),uri:p()});var v$=x({type:E("ref/prompt"),name:p()}),$$=je.extend({ref:X([v$,y$]),argument:x({name:p(),value:p()}),context:x({arguments:Y(p(),p()).optional()}).optional()}),w$=fe.extend({method:E("completion/complete"),params:$$});var Ki=me.extend({completion:le({values:b(p()).max(100),total:ne(F().int()),hasMore:ne(W())})}),b$=x({uri:p().startsWith("file://"),name:p().optional(),_meta:Y(p(),oe()).optional()}),z$=fe.extend({method:E("roots/list"),params:je.optional()}),x$=me.extend({roots:b(b$)}),S$=De.extend({method:E("notifications/roots/list_changed"),params:Me.optional()}),YE=X([wn,pv,w$,Hv,Cv,Iv,$v,wv,zv,Sv,Pv,Fv,Uv,zn,Sn,kn,En]),QE=X([$n,bn,Of,S$,to]),XE=X([Zt,Li,Fi,Hi,x$,xn,Pn,qt]),eT=X([wn,Ui,Vi,z$,zn,Sn,kn,En]),tT=X([$n,bn,Jv,Tv,Oi,Di,qi,to,_$]),rT=X([Zt,Si,Ki,Zi,Ii,Pi,Ei,Ri,mr,Mi,xn,Pn,qt]),O=class e extends Error{constructor(t,r,o){super(`MCP error ${t}: ${r}`),this.code=t,this.data=o,this.name="McpError"}static fromError(t,r,o){if(t===I.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new wi(n.elicitations,r)}return new e(t,r,o)}},wi=class extends O{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(I.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function xt(e){return e==="completed"||e==="failed"||e==="cancelled"}var k$=Symbol("Let zodToJsonSchema decide on which parser to use");var NT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ji(e){let r=dn(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=Cp(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Bi(e,t){let r=Ke(e,t);if(!r.success)throw r.error;return r.data}var I$=6e4,Tn=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($n,r=>{this._oncancel(r)}),this.setNotificationHandler(bn,r=>{this._onprogress(r)}),this.setRequestHandler(wn,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(zn,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new O(I.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Sn,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,f=new O(d.error.code,d.error.message,d.error.data);l(f)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new O(I.InvalidParams,`Task not found: ${s}`);if(!xt(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(xt(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[zt]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(kn,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new O(I.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(En,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new O(I.InvalidParams,`Task not found: ${r.params.taskId}`);if(xt(n.status))throw new O(I.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new O(I.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof O?n:new O(I.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,o,n,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),O.fromError(I.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});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 o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),jt(s)||Tf(s)?this._onresponse(s):Gr(s)?this._onrequest(s,i):Ef(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=O.fromError(I.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of t.values())o(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(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,r){let o=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,n=this._transport,s=t.params?._meta?.[zt]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:I.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);let a=Sf(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:t.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(i.signal.aborted)throw new O(I.ConnectionClosed,"Request was cancelled");let m={...f,relatedRequestId:t.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let h=m.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>o(t,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:I.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(t){let r=Number(t.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),jt(t))o(t);else{let i=new O(t.error.code,t.error.message,t.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===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 s=!1;if(jt(t)&&t.result&&typeof t.result=="object"){let i=t.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),jt(t))n(t);else{let i=O.fromError(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(t,r,o)}}catch(i){yield{type:"error",error:i instanceof O?i:new O(I.InternalError,String(i))}}return}let s;try{let i=await this.request(t,qt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new O(I.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},xt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new O(I.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new O(I.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof O?i:new O(I.InternalError,String(i))}}}request(t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=k=>{l(k)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(k){d(k);return}o?.signal?.throwIfAborted();let f=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:f};o?.onprogress&&(this._progressHandlers.set(f,o.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[zt]:c}});let h=k=>{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(k)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`)));let z=k instanceof O?k:new O(I.RequestTimeout,String(k));l(z)};this._responseHandlers.set(f,k=>{if(!o?.signal?.aborted){if(k instanceof Error)return l(k);try{let z=Ke(r,k.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),o?.signal?.addEventListener("abort",()=>{h(o?.signal?.reason)});let _=o?.timeout??I$,v=()=>h(O.fromError(I.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(f,_,o?.maxTotalTimeout,v,o?.resetTimeoutOnProgress??!1);let $=c?.taskId;if($){let k=z=>{let P=this._responseHandlers.get(f);P?P(z):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,k),this._enqueueTaskMessage($,{type:"request",message:m,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(f),l(z)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(k=>{this._cleanupTimeout(f),l(k)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},xn,r)}async getTaskResult(t,r,o){return this.request({method:"tasks/result",params:t},r,o)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Pn,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Af,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let o=r?.relatedTask?.taskId;if(o){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[zt]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,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 a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[zt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[zt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let o=Ji(t);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Bi(t,n);return Promise.resolve(r(i,s))})}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 o=Ji(t);this._notificationHandlers.set(o,n=>{let s=Bi(t,n);return Promise.resolve(r(s))})}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,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,o,n)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(t,r);for(let n of o)if(n.type==="request"&&Gr(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new O(I.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(t);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new O(I.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new O(I.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!t)throw new Error("No request provided");return await o.createTask(n,t.id,{method:t.method,params:t.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new O(I.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=to.parse({method:"notifications/tasks/status",params:a});await this.notification(c),xt(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new O(I.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(xt(a.status))throw new O(I.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=to.parse({method:"notifications/tasks/status",params:c});await this.notification(u),xt(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function Uf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Lf(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];Uf(i)&&Uf(s)?r[n]={...i,...s}:r[n]=s}return r}var Ag=su(Cc(),1),Cg=su(Ig(),1);function jS(){let e=new Ag.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Cg.default)(e),e}var ls=class{constructor(t){this._ajv=t??jS()}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 o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var ds=class{constructor(t){this._client=t}async*callToolStream(t,r=mr,o){let n=this._client,s={...o,task:o?.task??(n.isToolTask(t.name)?{}:void 0)},i=n.requestStream({method:"tools/call",params:t},r,s),a=n.getToolOutputValidator(t.name);for await(let c of i){if(c.type==="result"&&a){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new O(I.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let l=a(u.structuredContent);if(!l.valid){yield{type:"error",error:new O(I.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof O){yield{type:"error",error:l};return}yield{type:"error",error:new O(I.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,o){return this._client.getTaskResult({taskId:t},r,o)}async listTasks(t,r){return this._client.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._client.cancelTask({taskId:t},r)}requestStream(t,r,o){return this._client.requestStream(t,r,o)}};function Ng(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 jg(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}}function ps(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[n]=s.default),r[n]!==void 0&&ps(s,r[n])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&ps(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&ps(r,t)}}function ZS(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}var fs=class extends Tn{constructor(t,r){super(r),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new ls,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Di,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",qi,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Oi,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new ds(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Lf(this._capabilities,t)}setRequestHandler(t,r){let n=dn(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(lr(n)){let a=n;s=a._zod?.def?.value??a.value}else{let a=n;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");let i=s;if(i==="elicitation/create"){let a=async(c,u)=>{let l=Ke(Vi,c);if(!l.success){let k=l.error instanceof Error?l.error.message:String(l.error);throw new O(I.InvalidParams,`Invalid elicitation request: ${k}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:f,supportsUrlMode:m}=ZS(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new O(I.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!m)throw new O(I.InvalidParams,"Client does not support URL-mode elicitation requests");let h=await Promise.resolve(r(c,u));if(d.task){let k=Ke(qt,h);if(!k.success){let z=k.error instanceof Error?k.error.message:String(k.error);throw new O(I.InvalidParams,`Invalid task creation result: ${z}`)}return k.data}let _=Ke(Hi,h);if(!_.success){let k=_.error instanceof Error?_.error.message:String(_.error);throw new O(I.InvalidParams,`Invalid elicitation result: ${k}`)}let v=_.data,$=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&v.action==="accept"&&v.content&&$&&this._capabilities.elicitation?.form?.applyDefaults)try{ps($,v.content)}catch{}return v};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,u)=>{let l=Ke(Ui,c);if(!l.success){let v=l.error instanceof Error?l.error.message:String(l.error);throw new O(I.InvalidParams,`Invalid sampling request: ${v}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let v=Ke(qt,f);if(!v.success){let $=v.error instanceof Error?v.error.message:String(v.error);throw new O(I.InvalidParams,`Invalid task creation result: ${$}`)}return v.data}let h=d.tools||d.toolChoice?Fi:Li,_=Ke(h,f);if(!_.success){let v=_.error instanceof Error?_.error.message:String(_.error);throw new O(I.InvalidParams,`Invalid sampling result: ${v}`)}return _.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapability(t,r){if(!this._serverCapabilities?.[t])throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{let o=await this.request({method:"initialize",params:{protocolVersion:pr,capabilities:this._capabilities,clientInfo:this._clientInfo}},Si,r);if(o===void 0)throw new Error(`Server sent invalid initialize result: ${o}`);if(!bf.includes(o.protocolVersion))throw new Error(`Server's protocol version is not supported: ${o.protocolVersion}`);this._serverCapabilities=o.capabilities,this._serverVersion=o.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(o.protocolVersion),this._instructions=o.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(o){throw this.close(),o}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break;case"ping":break}}assertTaskCapability(t){Ng(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&jg(this._capabilities.tasks?.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Zt,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},Ki,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Zt,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},Zi,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Ii,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},Pi,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},Ei,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},Ri,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Zt,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Zt,r)}async callTool(t,r=mr,o){if(this.isToolTaskRequired(t.name))throw new O(I.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:t},r,o),s=this.getToolOutputValidator(t.name);if(s){if(!n.structuredContent&&!n.isError)throw new O(I.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let i=s(n.structuredContent);if(!i.valid)throw new O(I.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof O?i:new O(I.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return n}isToolTask(t){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of t){if(r.outputSchema){let n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}let o=r.execution?.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(r.name),o==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let o=await this.request({method:"tools/list",params:t},Mi,r);return this.cacheToolMetadata(o.tools),o}_setupListChangedHandler(t,r,o,n){let s=Mf.safeParse(o);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof o.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=o,u=async()=>{if(!i){c(null,null);return}try{let d=await n();c(null,d)}catch(d){let f=d instanceof Error?d:new Error(String(d));c(f,null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let f=setTimeout(u,a);this._listChangedDebounceTimers.set(t,f)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function ms(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function Zg(e=fetch,t){return t?async(r,o)=>{let n={...t,...o,headers:o?.headers?{...ms(t.headers),...ms(o.headers)}:t.headers};return e(r,n)}:e}var Lc;Lc=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function qS(e){return(await Lc).getRandomValues(new Uint8Array(e))}async function MS(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,o="";for(;o.length<e;){let n=await qS(e-o.length);for(let s of n)s<r&&(o+=t[s%t.length])}return o}async function DS(e){return await MS(e)}async function US(e){let t=await(await Lc).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Fc(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await DS(e),r=await US(t);return{code_verifier:t,code_challenge:r}}var ye=af().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:wf.custom,message:"URL must be parseable",fatal:!0}),xs}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Mg=le({resource:p().url(),authorization_servers:b(ye).optional(),jwks_uri:p().url().optional(),scopes_supported:b(p()).optional(),bearer_methods_supported:b(p()).optional(),resource_signing_alg_values_supported:b(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:W().optional(),authorization_details_types_supported:b(p()).optional(),dpop_signing_alg_values_supported:b(p()).optional(),dpop_bound_access_tokens_required:W().optional()}),Vc=le({issuer:p(),authorization_endpoint:ye,token_endpoint:ye,registration_endpoint:ye.optional(),scopes_supported:b(p()).optional(),response_types_supported:b(p()),response_modes_supported:b(p()).optional(),grant_types_supported:b(p()).optional(),token_endpoint_auth_methods_supported:b(p()).optional(),token_endpoint_auth_signing_alg_values_supported:b(p()).optional(),service_documentation:ye.optional(),revocation_endpoint:ye.optional(),revocation_endpoint_auth_methods_supported:b(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:b(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:b(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:b(p()).optional(),code_challenge_methods_supported:b(p()).optional(),client_id_metadata_document_supported:W().optional()}),LS=le({issuer:p(),authorization_endpoint:ye,token_endpoint:ye,userinfo_endpoint:ye.optional(),jwks_uri:ye,registration_endpoint:ye.optional(),scopes_supported:b(p()).optional(),response_types_supported:b(p()),response_modes_supported:b(p()).optional(),grant_types_supported:b(p()).optional(),acr_values_supported:b(p()).optional(),subject_types_supported:b(p()),id_token_signing_alg_values_supported:b(p()),id_token_encryption_alg_values_supported:b(p()).optional(),id_token_encryption_enc_values_supported:b(p()).optional(),userinfo_signing_alg_values_supported:b(p()).optional(),userinfo_encryption_alg_values_supported:b(p()).optional(),userinfo_encryption_enc_values_supported:b(p()).optional(),request_object_signing_alg_values_supported:b(p()).optional(),request_object_encryption_alg_values_supported:b(p()).optional(),request_object_encryption_enc_values_supported:b(p()).optional(),token_endpoint_auth_methods_supported:b(p()).optional(),token_endpoint_auth_signing_alg_values_supported:b(p()).optional(),display_values_supported:b(p()).optional(),claim_types_supported:b(p()).optional(),claims_supported:b(p()).optional(),service_documentation:p().optional(),claims_locales_supported:b(p()).optional(),ui_locales_supported:b(p()).optional(),claims_parameter_supported:W().optional(),request_parameter_supported:W().optional(),request_uri_parameter_supported:W().optional(),require_request_uri_registration:W().optional(),op_policy_uri:ye.optional(),op_tos_uri:ye.optional(),client_id_metadata_document_supported:W().optional()}),Dg=x({...LS.shape,...Vc.pick({code_challenge_methods_supported:!0}).shape}),Ug=x({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:hn.number().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),Lg=x({error:p(),error_description:p().optional(),error_uri:p().optional()}),qg=ye.optional().or(E("").transform(()=>{})),FS=x({redirect_uris:b(ye),token_endpoint_auth_method:p().optional(),grant_types:b(p()).optional(),response_types:b(p()).optional(),client_name:p().optional(),client_uri:ye.optional(),logo_uri:qg,scope:p().optional(),contacts:b(p()).optional(),tos_uri:qg,policy_uri:p().optional(),jwks_uri:ye.optional(),jwks:lf().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),VS=x({client_id:p(),client_secret:p().optional(),client_id_issued_at:F().optional(),client_secret_expires_at:F().optional()}).strip(),Fg=FS.merge(VS),aA=x({error:p(),error_description:p().optional()}).strip(),cA=x({token:p(),token_type_hint:p().optional()}).strip();function Vg(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function Hg({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),o=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(s)}var ue=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},Co=class extends ue{};Co.errorCode="invalid_request";var Gt=class extends ue{};Gt.errorCode="invalid_client";var Yt=class extends ue{};Yt.errorCode="invalid_grant";var Qt=class extends ue{};Qt.errorCode="unauthorized_client";var No=class extends ue{};No.errorCode="unsupported_grant_type";var jo=class extends ue{};jo.errorCode="invalid_scope";var Zo=class extends ue{};Zo.errorCode="access_denied";var ft=class extends ue{};ft.errorCode="server_error";var qo=class extends ue{};qo.errorCode="temporarily_unavailable";var Mo=class extends ue{};Mo.errorCode="unsupported_response_type";var Do=class extends ue{};Do.errorCode="unsupported_token_type";var Uo=class extends ue{};Uo.errorCode="invalid_token";var Lo=class extends ue{};Lo.errorCode="method_not_allowed";var Fo=class extends ue{};Fo.errorCode="too_many_requests";var Xt=class extends ue{};Xt.errorCode="invalid_client_metadata";var Vo=class extends ue{};Vo.errorCode="insufficient_scope";var Ho=class extends ue{};Ho.errorCode="invalid_target";var Kg={[Co.errorCode]:Co,[Gt.errorCode]:Gt,[Yt.errorCode]:Yt,[Qt.errorCode]:Qt,[No.errorCode]:No,[jo.errorCode]:jo,[Zo.errorCode]:Zo,[ft.errorCode]:ft,[qo.errorCode]:qo,[Mo.errorCode]:Mo,[Do.errorCode]:Do,[Uo.errorCode]:Uo,[Lo.errorCode]:Lo,[Fo.errorCode]:Fo,[Xt.errorCode]:Xt,[Vo.errorCode]:Vo,[Ho.errorCode]:Ho};var mt=class extends Error{constructor(t){super(t??"Unauthorized")}};function HS(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Hc="code",Kc="S256";function KS(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&HS(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?"client_secret_basic":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function JS(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":BS(n,s,r);return;case"client_secret_post":WS(n,s,o);return;case"none":GS(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function BS(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function WS(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function GS(e,t){t.set("client_id",e)}async function Bg(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=Lg.parse(JSON.parse(r)),{error:n,error_description:s,error_uri:i}=o,a=Kg[n]||ft;return new a(s||"",i)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new ft(n)}}async function Ko(e,t){try{return await Jc(e,t)}catch(r){if(r instanceof Gt||r instanceof Qt)return await e.invalidateCredentials?.("all"),await Jc(e,t);if(r instanceof Yt)return await e.invalidateCredentials?.("tokens"),await Jc(e,t);throw r}}async function Jc(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:s}){let i=await e.discoveryState?.(),a,c,u,l=n;if(!l&&i?.resourceMetadataUrl&&(l=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await Gg(c,{fetchFn:s}),!a)try{a=await Wg(t,{resourceMetadataUrl:l},s)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}else{let z=await ok(t,{resourceMetadataUrl:l,fetchFn:s});c=z.authorizationServerUrl,u=z.authorizationServerMetadata,a=z.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}let d=await QS(t,e,a),f=o||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation());if(!m){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let z=u?.client_id_metadata_document_supported===!0,P=e.clientMetadataUrl;if(P&&!YS(P))throw new Xt(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${P}`);if(z&&P)m={client_id:P},await e.saveClientInformation?.(m);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let w=await ck(c,{metadata:u,clientMetadata:e.clientMetadata,scope:f,fetchFn:s});await e.saveClientInformation(w),m=w}}let h=!e.redirectUrl;if(r!==void 0||h){let z=await ak(e,c,{metadata:u,resource:d,authorizationCode:r,fetchFn:s});return await e.saveTokens(z),"AUTHORIZED"}let _=await e.tokens();if(_?.refresh_token)try{let z=await ik(c,{metadata:u,clientInformation:m,refreshToken:_.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(z),"AUTHORIZED"}catch(z){if(!(!(z instanceof ue)||z instanceof ft))throw z}let v=e.state?await e.state():void 0,{authorizationUrl:$,codeVerifier:k}=await nk(c,{metadata:u,clientInformation:m,state:v,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(k),await e.redirectToAuthorization($),"REDIRECT"}function YS(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function QS(e,t,r){let o=Vg(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!Hg({requestedResource:o,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}}function Wc(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=Bc(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=Bc(e,"scope")||void 0,a=Bc(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function Bc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(o);return n?n[1]||n[2]:null}async function Wg(e,t,r=fetch){let o=await tk(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.body?.cancel(),new Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return Mg.parse(await o.json())}async function Gc(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)return t?Gc(e,void 0,r):void 0;throw o}}function XS(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Jg(e,t,r=fetch){return await Gc(e,{"MCP-Protocol-Version":t},r)}function ek(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function tk(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??pr,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let c=XS(t,n.pathname);i=new URL(c,o?.metadataServerUrl??n),i.search=n.search}let a=await Jg(i,s,r);if(!o?.metadataUrl&&ek(a,n.pathname)){let c=new URL(`/.well-known/${t}`,n);a=await Jg(c,s,r)}return a}function rk(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function Gg(e,{fetchFn:t=fetch,protocolVersion:r=pr}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=rk(e);for(let{url:s,type:i}of n){let a=await Gc(s,o,t);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return i==="oauth"?Vc.parse(await a.json()):Dg.parse(await a.json())}}}async function ok(e,t){let r,o;try{r=await Wg(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(o=r.authorization_servers[0])}catch{}o||(o=String(new URL("/",e)));let n=await Gg(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}async function nk(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Hc))throw new Error(`Incompatible auth server: does not support response type ${Hc}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Kc))throw new Error(`Incompatible auth server: does not support code challenge method ${Kc}`)}else a=new URL("/authorize",e);let c=await Fc(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",Hc),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",Kc),a.searchParams.set("redirect_uri",String(o)),s&&a.searchParams.set("state",s),n&&a.searchParams.set("scope",n),n?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}function sk(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Yg(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),n)await n(c,r,a,t);else if(o){let l=t?.token_endpoint_auth_methods_supported??[],d=KS(o,l);JS(d,o,c,r)}let u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await Bg(u);return Ug.parse(await u.json())}async function ik(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),c=await Yg(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:n,fetchFn:i});return{refresh_token:o,...c}}async function ak(e,t,{metadata:r,resource:o,authorizationCode:n,fetchFn:s}={}){let i=e.clientMetadata.scope,a;if(e.prepareTokenRequest&&(a=await e.prepareTokenRequest(i)),!a){if(!n)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let u=await e.codeVerifier();a=sk(n,u,e.redirectUrl)}let c=await e.clientInformation();return Yg(t,{metadata:r,tokenRequestParams:a,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:s})}async function ck(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let s;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...o!==void 0?{scope:o}:{}})});if(!i.ok)throw await Bg(i);return Fg.parse(await i.json())}var Jo=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}},Qg=10,uk=13,er=32;function Yc(e){}function t_(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Yc,onError:r=Yc,onRetry:o=Yc,onComment:n,maxBufferSize:s}=e,i=[],a=0,c=!0,u,l="",d=0,f,m=!1;function h(y){if(m)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),i.length===0){let se=v(y);se!==""&&(i.push(se),a=se.length),_();return}if(y.indexOf(`
79
- `)===-1&&y.indexOf("\r")===-1){i.push(y),a+=y.length,_();return}i.push(y);let w=i.join("");i.length=0,a=0;let A=v(w);A!==""&&(i.push(A),a=A.length),_()}function _(){s!==void 0&&(a+l.length<=s||(m=!0,i.length=0,a=0,u=void 0,l="",d=0,f=void 0,r(new Jo(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function v(y){let w=0;if(y.indexOf("\r")===-1){let A=y.indexOf(`
80
- `,w);for(;A!==-1;){if(w===A){d>0&&t({id:u,event:f,data:l}),u=void 0,l="",d=0,f=void 0,w=A+1,A=y.indexOf(`
81
- `,w);continue}let se=y.charCodeAt(w);if(Xg(y,w,se)){let ie=y.charCodeAt(w+5)===er?w+6:w+5,Ee=y.slice(ie,A);if(d===0&&y.charCodeAt(A+1)===Qg){t({id:u,event:f,data:Ee}),u=void 0,l="",f=void 0,w=A+2,A=y.indexOf(`
82
- `,w);continue}l=d===0?Ee:`${l}
83
- ${Ee}`,d++}else e_(y,w,se)?f=y.slice(y.charCodeAt(w+6)===er?w+7:w+6,A)||void 0:$(y,w,A);w=A+1,A=y.indexOf(`
84
- `,w)}return y.slice(w)}for(;w<y.length;){let A=y.indexOf("\r",w),se=y.indexOf(`
85
- `,w),ie=-1;if(A!==-1&&se!==-1?ie=A<se?A:se:A!==-1?A===y.length-1?ie=-1:ie=A:se!==-1&&(ie=se),ie===-1)break;$(y,w,ie),w=ie+1,y.charCodeAt(w-1)===uk&&y.charCodeAt(w)===Qg&&w++}return y.slice(w)}function $(y,w,A){if(w===A){z();return}let se=y.charCodeAt(w);if(Xg(y,w,se)){let _t=y.charCodeAt(w+5)===er?w+6:w+5,nu=y.slice(_t,A);l=d===0?nu:`${l}
86
- ${nu}`,d++;return}if(e_(y,w,se)){f=y.slice(y.charCodeAt(w+6)===er?w+7:w+6,A)||void 0;return}if(se===105&&y.charCodeAt(w+1)===100&&y.charCodeAt(w+2)===58){let _t=y.slice(y.charCodeAt(w+3)===er?w+4:w+3,A);u=_t.includes("\0")?void 0:_t;return}if(se===58){if(n){let _t=y.slice(w,A);n(_t.slice(y.charCodeAt(w+1)===er?2:1))}return}let ie=y.slice(w,A),Ee=ie.indexOf(":");if(Ee===-1){k(ie,"",ie);return}let Cr=ie.slice(0,Ee),Bo=ie.charCodeAt(Ee+1)===er?2:1,Wo=ie.slice(Ee+Bo);k(Cr,Wo,ie)}function k(y,w,A){switch(y){case"event":f=w||void 0;break;case"data":l=d===0?w:`${l}
87
- ${w}`,d++;break;case"id":u=w.includes("\0")?void 0:w;break;case"retry":/^\d+$/.test(w)?o(parseInt(w,10)):r(new Jo(`Invalid \`retry\` value: "${w}"`,{type:"invalid-retry",value:w,line:A}));break;default:r(new Jo(`Unknown field "${y.length>20?`${y.slice(0,20)}\u2026`:y}"`,{type:"unknown-field",field:y,value:w,line:A}));break}}function z(){d>0&&t({id:u,event:f,data:l}),u=void 0,l="",d=0,f=void 0}function P(y={}){if(y.consume&&i.length>0){let w=i.join("");$(w,0,w.length)}c=!0,u=void 0,l="",d=0,f=void 0,i.length=0,a=0,m=!1}return{feed:h,reset:P}}function Xg(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function e_(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var hs=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:n}={}){let s;super({start(i){s=t_({onEvent:a=>{i.enqueue(a)},onError(a){typeof t=="function"&&t(a),(t==="terminate"||a.type==="max-buffer-size-exceeded")&&i.error(a)},onRetry:r,onComment:o,maxBufferSize:n})},transform(i){s.feed(i)}})}};var lk={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},At=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},gs=class{constructor(t,r){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Zg(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??lk}async _authThenStart(){if(!this._authProvider)throw new mt("No auth provider");let t;try{t=await Ko(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(t!=="AUTHORIZED")throw new mt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(t.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=ms(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),r&&o.set("last-event-id",r);let n=await(this._fetch??fetch)(this._url,{method:"GET",headers:o,signal:this._abortController?.signal});if(!n.ok){if(await n.body?.cancel(),n.status===401&&this._authProvider)return await this._authThenStart();if(n.status===405)return;throw new At(n.status,`Failed to open SSE stream: ${n.statusText}`)}this._handleSseStream(n.body,t,!0)}catch(o){throw this.onerror?.(o),o}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,o=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(o,t),n)}_scheduleReconnection(t,r=0){let o=this._reconnectionOptions.maxRetries;if(r>=o){this.onerror?.(new Error(`Maximum reconnection attempts (${o}) exceeded.`));return}let n=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,r+1)})},n)}_handleSseStream(t,r,o){if(!t)return;let{onresumptiontoken:n,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=t.pipeThrough(new TextDecoderStream).pipeThrough(new hs({onRetry:m=>{this._serverRetryMs=m}})).getReader();for(;;){let{value:m,done:h}=await l.read();if(h)break;if(m.id&&(i=m.id,a=!0,n?.(m.id)),!!m.data&&(!m.event||m.event==="message"))try{let _=vn.parse(JSON.parse(m.data));jt(_)&&(c=!0,s!==void 0&&(_.id=s)),this.onmessage?.(_)}catch(_){this.onerror?.(_)}}(o||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:n,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(o||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:n,replayMessageId:s},0)}catch(m){this.onerror?.(new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(t){if(!this._authProvider)throw new mt("No auth provider");if(await Ko(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new mt("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(t,r){try{let{resumptionToken:o,onresumptiontoken:n}=r||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Gr(t)?t.id:void 0}).catch(f=>this.onerror?.(f));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,i),c=a.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!a.ok){let f=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new At(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:m,scope:h}=Wc(a);if(this._resourceMetadataUrl=m,this._scope=h,await Ko(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new mt;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:m,scope:h,error:_}=Wc(a);if(_==="insufficient_scope"){let v=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===v)throw new At(403,"Server returned 403 after trying upscoping");if(h&&(this._scope=h),m&&(this._resourceMetadataUrl=m),this._lastUpscopingHeader=v??void 0,await Ko(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new mt;return this.send(t)}}throw new At(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),If(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let l=(Array.isArray(t)?t:[t]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=a.headers.get("content-type");if(l)if(d?.includes("text/event-stream"))this._handleSseStream(a.body,{onresumptiontoken:n},!1);else if(d?.includes("application/json")){let f=await a.json(),m=Array.isArray(f)?f.map(h=>vn.parse(h)):[vn.parse(f)];for(let h of m)this.onmessage?.(h)}else throw await a.body?.cancel(),new At(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(o){throw this.onerror?.(o),o}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let t=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:t,signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,r);if(await o.body?.cancel(),!o.ok&&o.status!==405)throw new At(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(t){throw this.onerror?.(t),t}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r?.onresumptiontoken})}};var Qc=r_(hk(),".kleo"),Ar=r_(Qc,"config.json"),gk="https://app.kleo.so";function eu(){if(!Xc(Ar))return{};try{return JSON.parse(pk(Ar,"utf8"))}catch{return{}}}function o_(e){Xc(Qc)||dk(Qc,{recursive:!0,mode:448}),mk(Ar,`${JSON.stringify(e,null,2)}
88
- `,{mode:384})}function n_(){Xc(Ar)&&fk(Ar)}function ys(){return Ar}function vs(e){let t=eu(),r=e.apiUrl??process.env.KLEO_API_URL??t.apiUrl??gk,o=e.apiKey??process.env.KLEO_API_KEY??t.apiKey;return{apiUrl:r.replace(/\/+$/,""),apiKey:o}}function _s(e){return`${e.replace(/\/+$/,"")}/api/mcp/mcp`}async function s_(e){let{apiUrl:t,apiKey:r}=vs(e);if(!r)throw new Error("No API key. Run `kleo login --key kleo_sk_\u2026` (or set KLEO_API_KEY). Mint one in Kleo \u2192 Settings \u2192 MCP, or POST /api/mcp/keys.");let o=new gs(new URL(_s(t)),{requestInit:{headers:{Authorization:`Bearer ${r}`}}}),n=new fs({name:"kleo-cli",version:"1.0.0"},{capabilities:{}});try{await n.connect(o)}catch(s){let i=s instanceof Error?s.message:String(s);throw/401|unauthor/i.test(i)?new Error(`Auth rejected by ${_s(t)} \u2014 the API key is invalid or revoked.`):/404|not found/i.test(i)?new Error(`${_s(t)} returned 404 \u2014 the MCP surface is off (NEXT_PUBLIC_ENABLE_MCP must be 'true') or the URL is wrong.`):new Error(`Could not connect to ${_s(t)}: ${i}`)}return{client:n,close:async()=>{await n.close().catch(()=>{})}}}function _k(e){return(e.content??[]).filter(t=>t.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
89
- `).trim()}async function tu(e,t,r={}){let o=await e.client.callTool({name:t,arguments:r}),n=_k(o);if(o.isError)throw new Error(n||`Tool ${t} returned an error.`);return{text:n,raw:o}}async function i_(e){let{tools:t}=await e.client.listTools();return t}var yk=new Set(["json","help","h","version"]);function vk(e){let t=[],r={};for(let o=0;o<e.length;o++){let n=e[o];if(n.startsWith("--")||n.startsWith("-")&&n.length===2&&Number.isNaN(Number(n))){let s=n.replace(/^-+/,""),[i,a]=s.split("=");if(a!==void 0)r[i]=a;else if(yk.has(i))r[i]=!0;else{let c=e[o+1];c!==void 0&&!c.startsWith("-")?(r[i]=c,o++):r[i]=!0}}else t.push(n)}return{positionals:t,flags:r}}function Ct(e,t){let r=e[t];return typeof r=="string"?r:void 0}function a_(e,t){let r=Ct(e,t);if(r===void 0)return;let o=Number(r);return Number.isFinite(o)?o:void 0}var ws=process.stdout.isTTY,ht=e=>ws?`\x1B[2m${e}\x1B[0m`:e,Pe=e=>ws?`\x1B[1m${e}\x1B[0m`:e,$k=e=>ws?`\x1B[31m${e}\x1B[0m`:e,ru=e=>ws?`\x1B[36m${e}\x1B[0m`:e;function ze(e){process.stdout.write(`${e}
90
- `)}function ve(e){process.stderr.write(`${$k("error")} ${e}
91
- `),process.exit(1)}function wk(e){return{apiUrl:Ct(e,"url"),apiKey:Ct(e,"key")}}async function ou(e,t){let r=await s_(wk(e)).catch(o=>ve(o.message));try{return await t(r)}finally{await r.close()}}async function gt(e,t,r){await ou(e,async o=>{let{text:n,raw:s}=await tu(o,t,r).catch(i=>ve(i.message));ze(e.json?JSON.stringify(s,null,2):n||ht("(empty)"))})}function bk(e){let t=Ct(e.flags,"key")??process.env.KLEO_API_KEY,r=Ct(e.flags,"url");!t&&!r&&ve("Nothing to save. Pass --key kleo_sk_\u2026 and/or --url https://your-host"),t&&!t.startsWith("kleo_sk_")&&ve("That doesn't look like a Kleo key (expected it to start with 'kleo_sk_').");let o=eu();t&&(o.apiKey=t),r&&(o.apiUrl=r.replace(/\/+$/,"")),o_(o);let{apiUrl:n}=vs({});ze(`${ru("\u2713")} Saved to ${ht(ys())}`),ze(` server: ${n}`),t&&ze(` key: ${c_(t)}`)}function zk(){n_(),ze(`${ru("\u2713")} Cleared ${ht(ys())}`)}function xk(){let{apiUrl:e,apiKey:t}=vs({});ze(`${Pe("server")} ${e}`),ze(`${Pe("key")} ${t?c_(t):ht("(none \u2014 run `kleo login`)")}`),ze(ht(`config file: ${ys()}`)),ze(ht("precedence: --flag > env (KLEO_API_KEY/KLEO_API_URL) > config file > default"))}function c_(e){return e.length<=12?e:`${e.slice(0,12)}\u2026${e.slice(-4)}`}async function Sk(e){await ou(e.flags,async t=>{let r=await i_(t);if(e.flags.json)return ze(JSON.stringify(r,null,2));ze(Pe(`${r.length} tools available`));for(let o of r){let n=o.title??"";ze(` ${ru(o.name.padEnd(22))} ${ht(n)}`)}})}async function kk(e){await ou(e.flags,async t=>{let r=[["Offers & audiences","getOffersAndAudiences"],["Content strategy","getContentStrategy"],["Content plan","getContentPlan"]],o={};for(let[n,s]of r){let{text:i,raw:a}=await tu(t,s,{}).catch(c=>({text:`(failed: ${c.message})`,raw:{error:c.message}}));e.flags.json?o[s]=a:(ze(Pe(`
92
- \u2500\u2500 ${n} \u2500\u2500`)),ze(i||ht("(none)")))}e.flags.json&&ze(JSON.stringify(o,null,2))})}async function Pk(e){let t=e.positionals.slice(1).join(" ").trim();t||ve('Give the agent a task, e.g. `kleo agent "draft a post about our launch"`');let r=Ct(e.flags,"chat");await gt(e.flags,"kleoAgent",{message:t,...r?{chatId:r}:{}})}async function Ek(e){let[,t,...r]=e.positionals;t||ve("Usage: kleo call <toolName> [--json '{...}'] [key=value \u2026]");let o={},n=Ct(e.flags,"input")??Ct(e.flags,"args");if(n)try{o=JSON.parse(n)}catch(s){ve(`--input is not valid JSON: ${s.message}`)}for(let s of r){let i=s.indexOf("=");i!==-1&&(o[s.slice(0,i)]=s.slice(i+1))}await gt(e.flags,t,o)}async function $s(e,t){let r=e.positionals[1],o=a_(e.flags,"limit");if(!r||r==="list")return t.list||ve("This store has no `list`; use `search` or `read`."),gt(e.flags,t.list.tool,o&&t.list.withLimit?{limit:o}:{});if(r==="search"){t.search||ve("This store has no `search`.");let n=e.positionals.slice(2).join(" ").trim();return n||ve("Usage: search <query>"),gt(e.flags,t.search.tool,{query:n,...o?{limit:o}:{}})}if(r==="read"){let n=e.positionals[2];return n||ve(`Usage: read <${t.read.label}>`),gt(e.flags,t.read.tool,{[t.read.argName]:n})}ve(`Unknown subcommand '${r}'. Expected: list | search | read`)}async function Tk(e){let t=e.positionals[1],r=a_(e.flags,"limit");if(!t||t==="view"||t==="list")return gt(e.flags,"viewMemory",{});if(t==="search"){let o=e.positionals.slice(2).join(" ").trim();return o||ve("Usage: kleo memory search <query>"),gt(e.flags,"searchMemory",{query:o,...r?{limit:r}:{}})}if(t==="read"){let o=e.positionals[2];return o||ve("Usage: kleo memory read <path> e.g. voice/style.md"),gt(e.flags,"readMemory",{path:o})}ve(`Unknown subcommand '${t}'. Expected: view | search | read`)}var Rk=`${Pe("kleo")} \u2014 your Kleo workspace from the terminal
78
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function gi(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let m=e.seen.get(d),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Object.assign(u,h),Object.assign(u,l),a._zod.parent===d)for(let v in u)v==="$ref"||v==="allOf"||v in l||delete u[v];if(h.$ref&&m.def)for(let v in u)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(u[v])===JSON.stringify(m.def[v])&&delete u[v]}let f=a._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let h in u)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(u[h])===JSON.stringify(m.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$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");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Kr(t,"input",e.processors),output:Kr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function xe(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return xe(o.element,r);if(o.type==="set")return xe(o.valueType,r);if(o.type==="lazy")return xe(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return xe(o.innerType,r);if(o.type==="intersection")return xe(o.left,r)||xe(o.right,r);if(o.type==="record"||o.type==="map")return xe(o.keyType,r)||xe(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:xe(o.in,r)||xe(o.out,r);if(o.type==="object"){for(let n in o.shape)if(xe(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(xe(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(xe(n,r))return!0;return!!(o.rest&&xe(o.rest,r))}return!1}var dp=(e,t={})=>r=>{let o=mi({...r,processors:t});return ae(e,o),hi(o,e),gi(o,e)},Kr=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=mi({...n??{},target:s,io:t,processors:r});return ae(e,i),hi(i,e),gi(i,e)};var cy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},pp=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=cy[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},fp=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),f=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";d?m?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),f?m?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},mp=(e,t,r,o)=>{r.type="boolean"},hp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")};var gp=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var _p=(e,t,r,o)=>{r.not={}},yp=(e,t,r,o)=>{},vp=(e,t,r,o)=>{},wp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},$p=(e,t,r,o)=>{let n=e._zod.def,s=Zr(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},bp=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var zp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var xp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Sp=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=ae(s.element,t,{...o,path:[...o.path,"items"]})},kp=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=ae(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=ae(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Pp=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>ae(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Ep=(e,t,r,o)=>{let n=e._zod.def,s=ae(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=ae(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var Tp=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=ae(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=ae(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=ae(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},Rp=(e,t,r,o)=>{let n=e._zod.def,s=ae(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Op=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Ip=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Cp=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Ap=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Np=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;ae(i,t,o);let a=t.seen.get(e);a.ref=i},jp=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var _i=(e,t,r,o)=>{let n=e._zod.def;ae(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType};var Br={};Ps(Br,{ZodISODate:()=>Mp,ZodISODateTime:()=>Zp,ZodISODuration:()=>Dp,ZodISOTime:()=>qp,date:()=>vi,datetime:()=>yi,duration:()=>$i,time:()=>wi});var Zp=g("ZodISODateTime",(e,t)=>{Nl.init(e,t),re.init(e,t)});function yi(e){return Jd(Zp,e)}var Mp=g("ZodISODate",(e,t)=>{jl.init(e,t),re.init(e,t)});function vi(e){return Kd(Mp,e)}var qp=g("ZodISOTime",(e,t)=>{Zl.init(e,t),re.init(e,t)});function wi(e){return Bd(qp,e)}var Dp=g("ZodISODuration",(e,t)=>{Ml.init(e,t),re.init(e,t)});function $i(e){return Wd(Dp,e)}var gy=(e,t)=>{on.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Fs(e,r)},flatten:{value:r=>Ls(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,or,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,or,2)}},isEmpty:{get(){return e.issues.length===0}}})};var Ne=g("ZodError",gy,{Parent:Error});var Lp=nn(Ne),Fp=sn(Ne),Vp=Ur(Ne),Hp=Fr(Ne),Jp=yu(Ne),Kp=vu(Ne),Bp=wu(Ne),Wp=$u(Ne),Gp=bu(Ne),Yp=zu(Ne),Qp=xu(Ne),Xp=Su(Ne);var ef=new WeakMap;function Wr(e,t,r){let o=Object.getPrototypeOf(e),n=ef.get(o);if(n||(n=new Set,ef.set(o,n)),!n.has(t)){n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var B=g("ZodType",(e,t)=>(J.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Kr(e,"input"),output:Kr(e,"output")}}),e.toJSONSchema=dp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Lp(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Vp(e,r,o),e.parseAsync=async(r,o)=>Fp(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Hp(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Jp(e,r,o),e.decode=(r,o)=>Kp(e,r,o),e.encodeAsync=async(r,o)=>Bp(e,r,o),e.decodeAsync=async(r,o)=>Wp(e,r,o),e.safeEncode=(r,o)=>Gp(e,r,o),e.safeDecode=(r,o)=>Yp(e,r,o),e.safeEncodeAsync=async(r,o)=>Qp(e,r,o),e.safeDecodeAsync=async(r,o)=>Xp(e,r,o),Wr(e,"ZodType",{check(...r){let o=this.def;return this.clone(q.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ze(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(nv(r,o))},superRefine(r,o){return this.check(sv(r,o))},overwrite(r){return this.check(zt(r))},optional(){return ne(this)},exactOptional(){return Jy(this)},nullable(){return nf(this)},nullish(){return ne(nf(this))},nonoptional(r){return Qy(this,r)},array(){return b(this)},or(r){return X([this,r])},and(r){return gn(this,r)},transform(r){return sf(this,gf(r))},default(r){return Wy(this,r)},prefault(r){return Yy(this,r)},catch(r){return ev(this,r)},pipe(r){return sf(this,r)},readonly(){return ov(this)},describe(r){let o=this.clone();return bt.add(o,{description:r}),o},meta(...r){if(r.length===0)return bt.get(this);let o=this.clone();return bt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return bt.get(e)?.description},configurable:!0}),e)),af=g("_ZodString",(e,t)=>{dn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>pp(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Wr(e,"_ZodString",{regex(...o){return this.check(oi(...o))},includes(...o){return this.check(ii(...o))},startsWith(...o){return this.check(ai(...o))},endsWith(...o){return this.check(ci(...o))},min(...o){return this.check(cr(...o))},max(...o){return this.check(pn(...o))},length(...o){return this.check(fn(...o))},nonempty(...o){return this.check(cr(1,...o))},lowercase(o){return this.check(ni(o))},uppercase(o){return this.check(si(o))},trim(){return this.check(li())},normalize(...o){return this.check(ui(...o))},toLowerCase(){return this.check(di())},toUpperCase(){return this.check(pi())},slugify(){return this.check(fi())}})}),zi=g("ZodString",(e,t)=>{dn.init(e,t),af.init(e,t),e.email=r=>e.check(kd(yy,r)),e.url=r=>e.check(ri(cf,r)),e.jwt=r=>e.check(Hd(Cy,r)),e.emoji=r=>e.check(Od(vy,r)),e.guid=r=>e.check(ti(tf,r)),e.uuid=r=>e.check(Pd(mn,r)),e.uuidv4=r=>e.check(Ed(mn,r)),e.uuidv6=r=>e.check(Td(mn,r)),e.uuidv7=r=>e.check(Rd(mn,r)),e.nanoid=r=>e.check(Id(wy,r)),e.guid=r=>e.check(ti(tf,r)),e.cuid=r=>e.check(Cd($y,r)),e.cuid2=r=>e.check(Ad(by,r)),e.ulid=r=>e.check(Nd(zy,r)),e.base64=r=>e.check(Ld(Ry,r)),e.base64url=r=>e.check(Fd(Oy,r)),e.xid=r=>e.check(jd(xy,r)),e.ksuid=r=>e.check(Zd(Sy,r)),e.ipv4=r=>e.check(Md(ky,r)),e.ipv6=r=>e.check(qd(Py,r)),e.cidrv4=r=>e.check(Dd(Ey,r)),e.cidrv6=r=>e.check(Ud(Ty,r)),e.e164=r=>e.check(Vd(Iy,r)),e.datetime=r=>e.check(yi(r)),e.date=r=>e.check(vi(r)),e.time=r=>e.check(wi(r)),e.duration=r=>e.check($i(r))});function p(e){return xd(zi,e)}var re=g("ZodStringFormat",(e,t)=>{Q.init(e,t),af.init(e,t)}),yy=g("ZodEmail",(e,t)=>{kl.init(e,t),re.init(e,t)});var tf=g("ZodGUID",(e,t)=>{xl.init(e,t),re.init(e,t)});var mn=g("ZodUUID",(e,t)=>{Sl.init(e,t),re.init(e,t)});var cf=g("ZodURL",(e,t)=>{Pl.init(e,t),re.init(e,t)});function uf(e){return ri(cf,e)}var vy=g("ZodEmoji",(e,t)=>{El.init(e,t),re.init(e,t)});var wy=g("ZodNanoID",(e,t)=>{Tl.init(e,t),re.init(e,t)});var $y=g("ZodCUID",(e,t)=>{Rl.init(e,t),re.init(e,t)});var by=g("ZodCUID2",(e,t)=>{Ol.init(e,t),re.init(e,t)});var zy=g("ZodULID",(e,t)=>{Il.init(e,t),re.init(e,t)});var xy=g("ZodXID",(e,t)=>{Cl.init(e,t),re.init(e,t)});var Sy=g("ZodKSUID",(e,t)=>{Al.init(e,t),re.init(e,t)});var ky=g("ZodIPv4",(e,t)=>{ql.init(e,t),re.init(e,t)});var Py=g("ZodIPv6",(e,t)=>{Dl.init(e,t),re.init(e,t)});var Ey=g("ZodCIDRv4",(e,t)=>{Ul.init(e,t),re.init(e,t)});var Ty=g("ZodCIDRv6",(e,t)=>{Ll.init(e,t),re.init(e,t)});var Ry=g("ZodBase64",(e,t)=>{Vl.init(e,t),re.init(e,t)});var Oy=g("ZodBase64URL",(e,t)=>{Hl.init(e,t),re.init(e,t)});var Iy=g("ZodE164",(e,t)=>{Jl.init(e,t),re.init(e,t)});var Cy=g("ZodJWT",(e,t)=>{Kl.init(e,t),re.init(e,t)});var hn=g("ZodNumber",(e,t)=>{Gs.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>fp(e,o,n,s),Wr(e,"ZodNumber",{gt(o,n){return this.check(ar(o,n))},gte(o,n){return this.check(Je(o,n))},min(o,n){return this.check(Je(o,n))},lt(o,n){return this.check(ir(o,n))},lte(o,n){return this.check(ct(o,n))},max(o,n){return this.check(ct(o,n))},int(o){return this.check(rf(o))},safe(o){return this.check(rf(o))},positive(o){return this.check(ar(0,o))},nonnegative(o){return this.check(Je(0,o))},negative(o){return this.check(ir(0,o))},nonpositive(o){return this.check(ct(0,o))},multipleOf(o,n){return this.check(Jr(o,n))},step(o,n){return this.check(Jr(o,n))},finite(){return this}});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 F(e){return Gd(hn,e)}var Ay=g("ZodNumberFormat",(e,t)=>{Bl.init(e,t),hn.init(e,t)});function rf(e){return Qd(Ay,e)}var xi=g("ZodBoolean",(e,t)=>{Wl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mp(e,r,o,n)});function W(e){return Xd(xi,e)}var lf=g("ZodBigInt",(e,t)=>{Gl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>hp(e,o,n,s),e.gte=(o,n)=>e.check(Je(o,n)),e.min=(o,n)=>e.check(Je(o,n)),e.gt=(o,n)=>e.check(ar(o,n)),e.gte=(o,n)=>e.check(Je(o,n)),e.min=(o,n)=>e.check(Je(o,n)),e.lt=(o,n)=>e.check(ir(o,n)),e.lte=(o,n)=>e.check(ct(o,n)),e.max=(o,n)=>e.check(ct(o,n)),e.positive=o=>e.check(ar(BigInt(0),o)),e.negative=o=>e.check(ir(BigInt(0),o)),e.nonpositive=o=>e.check(ct(BigInt(0),o)),e.nonnegative=o=>e.check(Je(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Jr(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var Ny=g("ZodNull",(e,t)=>{Yl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gp(e,r,o,n)});function df(e){return rp(Ny,e)}var jy=g("ZodAny",(e,t)=>{Ql.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yp(e,r,o,n)});function pf(){return op(jy)}var Zy=g("ZodUnknown",(e,t)=>{Xl.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vp(e,r,o,n)});function oe(){return np(Zy)}var My=g("ZodNever",(e,t)=>{ed.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_p(e,r,o,n)});function qy(e){return sp(My,e)}var ff=g("ZodDate",(e,t)=>{td.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>wp(e,o,n,s),e.min=(o,n)=>e.check(Je(o,n)),e.max=(o,n)=>e.check(ct(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var Dy=g("ZodArray",(e,t)=>{rd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sp(e,r,o,n),e.element=t.element,Wr(e,"ZodArray",{min(r,o){return this.check(cr(r,o))},nonempty(r){return this.check(cr(1,r))},max(r,o){return this.check(pn(r,o))},length(r,o){return this.check(fn(r,o))},unwrap(){return this.element}})});function b(e,t){return ap(Dy,e,t)}var mf=g("ZodObject",(e,t)=>{sd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kp(e,r,o,n),q.defineLazy(e,"shape",()=>t.shape),Wr(e,"ZodObject",{keyof(){return Re(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:oe()})},loose(){return this.clone({...this._zod.def,catchall:oe()})},strict(){return this.clone({...this._zod.def,catchall:qy()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return q.extend(this,r)},safeExtend(r){return q.safeExtend(this,r)},merge(r){return q.merge(this,r)},pick(r){return q.pick(this,r)},omit(r){return q.omit(this,r)},partial(...r){return q.partial(_f,this,r[0])},required(...r){return q.required(yf,this,r[0])}})});function x(e,t){let r={type:"object",shape:e??{},...q.normalizeParams(t)};return new mf(r)}function le(e,t){return new mf({type:"object",shape:e,catchall:oe(),...q.normalizeParams(t)})}var hf=g("ZodUnion",(e,t)=>{Ys.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pp(e,r,o,n),e.options=t.options});function X(e,t){return new hf({type:"union",options:e,...q.normalizeParams(t)})}var Uy=g("ZodDiscriminatedUnion",(e,t)=>{hf.init(e,t),id.init(e,t)});function Si(e,t,r){return new Uy({type:"union",options:t,discriminator:e,...q.normalizeParams(r)})}var Ly=g("ZodIntersection",(e,t)=>{ad.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ep(e,r,o,n)});function gn(e,t){return new Ly({type:"intersection",left:e,right:t})}var of=g("ZodRecord",(e,t)=>{cd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tp(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function Y(e,t,r){return!t||!t._zod?new of({type:"record",keyType:p(),valueType:e,...q.normalizeParams(t)}):new of({type:"record",keyType:e,valueType:t,...q.normalizeParams(r)})}var bi=g("ZodEnum",(e,t)=>{ud.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>$p(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new bi({...t,checks:[],...q.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new bi({...t,checks:[],...q.normalizeParams(n),entries:s})}});function Re(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new bi({type:"enum",entries:r,...q.normalizeParams(t)})}var Fy=g("ZodLiteral",(e,t)=>{ld.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bp(e,r,o,n),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 E(e,t){return new Fy({type:"literal",values:Array.isArray(e)?e:[e],...q.normalizeParams(t)})}var Vy=g("ZodTransform",(e,t)=>{dd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xp(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new tr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(q.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(q.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function gf(e){return new Vy({type:"transform",transform:e})}var _f=g("ZodOptional",(e,t)=>{Qs.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_i(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ne(e){return new _f({type:"optional",innerType:e})}var Hy=g("ZodExactOptional",(e,t)=>{pd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_i(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Jy(e){return new Hy({type:"optional",innerType:e})}var Ky=g("ZodNullable",(e,t)=>{fd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function nf(e){return new Ky({type:"nullable",innerType:e})}var By=g("ZodDefault",(e,t)=>{md.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ip(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wy(e,t){return new By({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():q.shallowClone(t)}})}var Gy=g("ZodPrefault",(e,t)=>{hd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Yy(e,t){return new Gy({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():q.shallowClone(t)}})}var yf=g("ZodNonOptional",(e,t)=>{gd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Op(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Qy(e,t){return new yf({type:"nonoptional",innerType:e,...q.normalizeParams(t)})}var Xy=g("ZodCatch",(e,t)=>{_d.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ap(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ev(e,t){return new Xy({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var vf=g("ZodPipe",(e,t)=>{Xs.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Np(e,r,o,n),e.in=t.in,e.out=t.out});function sf(e,t){return new vf({type:"pipe",in:e,out:t})}var tv=g("ZodPreprocess",(e,t)=>{vf.init(e,t),yd.init(e,t)}),rv=g("ZodReadonly",(e,t)=>{vd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ov(e){return new rv({type:"readonly",innerType:e})}var wf=g("ZodCustom",(e,t)=>{wd.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zp(e,r,o,n)});function $f(e,t){return cp(wf,e??(()=>!0),t)}function nv(e,t={}){return up(wf,e,t)}function sv(e,t){return lp(e,t)}function ki(e,t){return new tv({type:"pipe",in:gf(e),out:t})}var zf={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var bf;bf||(bf={});var _n={};Ps(_n,{bigint:()=>uv,boolean:()=>cv,date:()=>lv,number:()=>av,string:()=>iv});function iv(e){return Sd(zi,e)}function av(e){return Yd(hn,e)}function cv(e){return ep(xi,e)}function uv(e){return tp(lf,e)}function lv(e){return ip(ff,e)}Te($d());var dr="2025-11-25";var xf=[dr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],xt="io.modelcontextprotocol/related-task",vn="2.0",de=$f(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Sf=X([p(),F().int()]),kf=p(),FE=le({ttl:F().optional(),pollInterval:F().optional()}),pv=x({ttl:F().optional()}),fv=x({taskId:p()}),Ei=le({progressToken:Sf.optional(),[xt]:fv.optional()}),je=x({_meta:Ei.optional()}),Gr=je.extend({task:pv.optional()}),Pf=e=>Gr.safeParse(e).success,fe=x({method:p(),params:je.loose().optional()}),qe=x({_meta:Ei.optional()}),De=x({method:p(),params:qe.loose().optional()}),me=le({_meta:Ei.optional()}),wn=X([p(),F().int()]),Ef=x({jsonrpc:E(vn),id:wn,...fe.shape}).strict(),Yr=e=>Ef.safeParse(e).success,Tf=x({jsonrpc:E(vn),...De.shape}).strict(),Rf=e=>Tf.safeParse(e).success,Ti=x({jsonrpc:E(vn),id:wn,result:me}).strict(),jt=e=>Ti.safeParse(e).success;var I;(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"})(I||(I={}));var Ri=x({jsonrpc:E(vn),id:wn.optional(),error:x({code:F().int(),message:p(),data:oe().optional()})}).strict();var Of=e=>Ri.safeParse(e).success;var $n=X([Ef,Tf,Ti,Ri]),VE=X([Ti,Ri]),Zt=me.strict(),mv=qe.extend({requestId:wn.optional(),reason:p().optional()}),bn=De.extend({method:E("notifications/cancelled"),params:mv}),hv=x({src:p(),mimeType:p().optional(),sizes:b(p()).optional(),theme:Re(["light","dark"]).optional()}),Qr=x({icons:b(hv).optional()}),lr=x({name:p(),title:p().optional()}),If=lr.extend({...lr.shape,...Qr.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),gv=gn(x({applyDefaults:W().optional()}),Y(p(),oe())),_v=ki(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,gn(x({form:gv.optional(),url:de.optional()}),Y(p(),oe()).optional())),yv=le({list:de.optional(),cancel:de.optional(),requests:le({sampling:le({createMessage:de.optional()}).optional(),elicitation:le({create:de.optional()}).optional()}).optional()}),vv=le({list:de.optional(),cancel:de.optional(),requests:le({tools:le({call:de.optional()}).optional()}).optional()}),wv=x({experimental:Y(p(),de).optional(),sampling:x({context:de.optional(),tools:de.optional()}).optional(),elicitation:_v.optional(),roots:x({listChanged:W().optional()}).optional(),tasks:yv.optional(),extensions:Y(p(),de).optional()}),$v=je.extend({protocolVersion:p(),capabilities:wv,clientInfo:If}),bv=fe.extend({method:E("initialize"),params:$v});var zv=x({experimental:Y(p(),de).optional(),logging:de.optional(),completions:de.optional(),prompts:x({listChanged:W().optional()}).optional(),resources:x({subscribe:W().optional(),listChanged:W().optional()}).optional(),tools:x({listChanged:W().optional()}).optional(),tasks:vv.optional(),extensions:Y(p(),de).optional()}),Oi=me.extend({protocolVersion:p(),capabilities:zv,serverInfo:If,instructions:p().optional()}),Cf=De.extend({method:E("notifications/initialized"),params:qe.optional()}),Af=e=>Cf.safeParse(e).success,zn=fe.extend({method:E("ping"),params:je.optional()}),xv=x({progress:F(),total:ne(F()),message:ne(p())}),Sv=x({...qe.shape,...xv.shape,progressToken:Sf}),xn=De.extend({method:E("notifications/progress"),params:Sv}),kv=je.extend({cursor:kf.optional()}),Xr=fe.extend({params:kv.optional()}),eo=me.extend({nextCursor:kf.optional()}),Pv=Re(["working","input_required","completed","failed","cancelled"]),to=x({taskId:p(),status:Pv,ttl:X([F(),df()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:ne(F()),statusMessage:ne(p())}),Mt=me.extend({task:to}),Ev=qe.merge(to),ro=De.extend({method:E("notifications/tasks/status"),params:Ev}),Sn=fe.extend({method:E("tasks/get"),params:je.extend({taskId:p()})}),kn=me.merge(to),Pn=fe.extend({method:E("tasks/result"),params:je.extend({taskId:p()})}),HE=me.loose(),En=Xr.extend({method:E("tasks/list")}),Tn=eo.extend({tasks:b(to)}),Rn=fe.extend({method:E("tasks/cancel"),params:je.extend({taskId:p()})}),Nf=me.merge(to),jf=x({uri:p(),mimeType:ne(p()),_meta:Y(p(),oe()).optional()}),Zf=jf.extend({text:p()}),Ii=p().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Mf=jf.extend({blob:Ii}),oo=Re(["user","assistant"]),pr=x({audience:b(oo).optional(),priority:F().min(0).max(1).optional(),lastModified:Br.datetime({offset:!0}).optional()}),qf=x({...lr.shape,...Qr.shape,uri:p(),description:ne(p()),mimeType:ne(p()),size:ne(F()),annotations:pr.optional(),_meta:ne(le({}))}),Tv=x({...lr.shape,...Qr.shape,uriTemplate:p(),description:ne(p()),mimeType:ne(p()),annotations:pr.optional(),_meta:ne(le({}))}),Rv=Xr.extend({method:E("resources/list")}),Ci=eo.extend({resources:b(qf)}),Ov=Xr.extend({method:E("resources/templates/list")}),Ai=eo.extend({resourceTemplates:b(Tv)}),Ni=je.extend({uri:p()}),Iv=Ni,Cv=fe.extend({method:E("resources/read"),params:Iv}),ji=me.extend({contents:b(X([Zf,Mf]))}),Zi=De.extend({method:E("notifications/resources/list_changed"),params:qe.optional()}),Av=Ni,Nv=fe.extend({method:E("resources/subscribe"),params:Av}),jv=Ni,Zv=fe.extend({method:E("resources/unsubscribe"),params:jv}),Mv=qe.extend({uri:p()}),qv=De.extend({method:E("notifications/resources/updated"),params:Mv}),Dv=x({name:p(),description:ne(p()),required:ne(W())}),Uv=x({...lr.shape,...Qr.shape,description:ne(p()),arguments:ne(b(Dv)),_meta:ne(le({}))}),Lv=Xr.extend({method:E("prompts/list")}),Mi=eo.extend({prompts:b(Uv)}),Fv=je.extend({name:p(),arguments:Y(p(),p()).optional()}),Vv=fe.extend({method:E("prompts/get"),params:Fv}),qi=x({type:E("text"),text:p(),annotations:pr.optional(),_meta:Y(p(),oe()).optional()}),Di=x({type:E("image"),data:Ii,mimeType:p(),annotations:pr.optional(),_meta:Y(p(),oe()).optional()}),Ui=x({type:E("audio"),data:Ii,mimeType:p(),annotations:pr.optional(),_meta:Y(p(),oe()).optional()}),Hv=x({type:E("tool_use"),name:p(),id:p(),input:Y(p(),oe()),_meta:Y(p(),oe()).optional()}),Jv=x({type:E("resource"),resource:X([Zf,Mf]),annotations:pr.optional(),_meta:Y(p(),oe()).optional()}),Kv=qf.extend({type:E("resource_link")}),Li=X([qi,Di,Ui,Kv,Jv]),Bv=x({role:oo,content:Li}),Fi=me.extend({description:p().optional(),messages:b(Bv)}),Vi=De.extend({method:E("notifications/prompts/list_changed"),params:qe.optional()}),Wv=x({title:p().optional(),readOnlyHint:W().optional(),destructiveHint:W().optional(),idempotentHint:W().optional(),openWorldHint:W().optional()}),Gv=x({taskSupport:Re(["required","optional","forbidden"]).optional()}),Df=x({...lr.shape,...Qr.shape,description:p().optional(),inputSchema:x({type:E("object"),properties:Y(p(),de).optional(),required:b(p()).optional()}).catchall(oe()),outputSchema:x({type:E("object"),properties:Y(p(),de).optional(),required:b(p()).optional()}).catchall(oe()).optional(),annotations:Wv.optional(),execution:Gv.optional(),_meta:Y(p(),oe()).optional()}),Yv=Xr.extend({method:E("tools/list")}),Hi=eo.extend({tools:b(Df)}),fr=me.extend({content:b(Li).default([]),structuredContent:Y(p(),oe()).optional(),isError:W().optional()}),JE=fr.or(me.extend({toolResult:oe()})),Qv=Gr.extend({name:p(),arguments:Y(p(),oe()).optional()}),Xv=fe.extend({method:E("tools/call"),params:Qv}),Ji=De.extend({method:E("notifications/tools/list_changed"),params:qe.optional()}),Uf=x({autoRefresh:W().default(!0),debounceMs:F().int().nonnegative().default(300)}),Lf=Re(["debug","info","notice","warning","error","critical","alert","emergency"]),ew=je.extend({level:Lf}),tw=fe.extend({method:E("logging/setLevel"),params:ew}),rw=qe.extend({level:Lf,logger:p().optional(),data:oe()}),ow=De.extend({method:E("notifications/message"),params:rw}),nw=x({name:p().optional()}),sw=x({hints:b(nw).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),iw=x({mode:Re(["auto","required","none"]).optional()}),aw=x({type:E("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:b(Li).default([]),structuredContent:x({}).loose().optional(),isError:W().optional(),_meta:Y(p(),oe()).optional()}),cw=Si("type",[qi,Di,Ui]),yn=Si("type",[qi,Di,Ui,Hv,aw]),uw=x({role:oo,content:X([yn,b(yn)]),_meta:Y(p(),oe()).optional()}),lw=Gr.extend({messages:b(uw),modelPreferences:sw.optional(),systemPrompt:p().optional(),includeContext:Re(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:b(p()).optional(),metadata:de.optional(),tools:b(Df).optional(),toolChoice:iw.optional()}),Ki=fe.extend({method:E("sampling/createMessage"),params:lw}),Bi=me.extend({model:p(),stopReason:ne(Re(["endTurn","stopSequence","maxTokens"]).or(p())),role:oo,content:cw}),Wi=me.extend({model:p(),stopReason:ne(Re(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:oo,content:X([yn,b(yn)])}),dw=x({type:E("boolean"),title:p().optional(),description:p().optional(),default:W().optional()}),pw=x({type:E("string"),title:p().optional(),description:p().optional(),minLength:F().optional(),maxLength:F().optional(),format:Re(["email","uri","date","date-time"]).optional(),default:p().optional()}),fw=x({type:Re(["number","integer"]),title:p().optional(),description:p().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),mw=x({type:E("string"),title:p().optional(),description:p().optional(),enum:b(p()),default:p().optional()}),hw=x({type:E("string"),title:p().optional(),description:p().optional(),oneOf:b(x({const:p(),title:p()})),default:p().optional()}),gw=x({type:E("string"),title:p().optional(),description:p().optional(),enum:b(p()),enumNames:b(p()).optional(),default:p().optional()}),_w=X([mw,hw]),yw=x({type:E("array"),title:p().optional(),description:p().optional(),minItems:F().optional(),maxItems:F().optional(),items:x({type:E("string"),enum:b(p())}),default:b(p()).optional()}),vw=x({type:E("array"),title:p().optional(),description:p().optional(),minItems:F().optional(),maxItems:F().optional(),items:x({anyOf:b(x({const:p(),title:p()}))}),default:b(p()).optional()}),ww=X([yw,vw]),$w=X([gw,_w,ww]),bw=X([$w,dw,pw,fw]),zw=Gr.extend({mode:E("form").optional(),message:p(),requestedSchema:x({type:E("object"),properties:Y(p(),bw),required:b(p()).optional()})}),xw=Gr.extend({mode:E("url"),message:p(),elicitationId:p(),url:p().url()}),Sw=X([zw,xw]),Gi=fe.extend({method:E("elicitation/create"),params:Sw}),kw=qe.extend({elicitationId:p()}),Pw=De.extend({method:E("notifications/elicitation/complete"),params:kw}),Yi=me.extend({action:Re(["accept","decline","cancel"]),content:ki(e=>e===null?void 0:e,Y(p(),X([p(),F(),W(),b(p())])).optional())}),Ew=x({type:E("ref/resource"),uri:p()});var Tw=x({type:E("ref/prompt"),name:p()}),Rw=je.extend({ref:X([Tw,Ew]),argument:x({name:p(),value:p()}),context:x({arguments:Y(p(),p()).optional()}).optional()}),Ow=fe.extend({method:E("completion/complete"),params:Rw});var Qi=me.extend({completion:le({values:b(p()).max(100),total:ne(F().int()),hasMore:ne(W())})}),Iw=x({uri:p().startsWith("file://"),name:p().optional(),_meta:Y(p(),oe()).optional()}),Cw=fe.extend({method:E("roots/list"),params:je.optional()}),Aw=me.extend({roots:b(Iw)}),Nw=De.extend({method:E("notifications/roots/list_changed"),params:qe.optional()}),KE=X([zn,bv,Ow,tw,Vv,Lv,Rv,Ov,Cv,Nv,Zv,Xv,Yv,Sn,Pn,En,Rn]),BE=X([bn,xn,Cf,Nw,ro]),WE=X([Zt,Bi,Wi,Yi,Aw,kn,Tn,Mt]),GE=X([zn,Ki,Gi,Cw,Sn,Pn,En,Rn]),YE=X([bn,xn,ow,qv,Zi,Ji,Vi,ro,Pw]),QE=X([Zt,Oi,Qi,Fi,Mi,Ci,Ai,ji,fr,Hi,kn,Tn,Mt]),O=class e extends Error{constructor(t,r,o){super(`MCP error ${t}: ${r}`),this.code=t,this.data=o,this.name="McpError"}static fromError(t,r,o){if(t===I.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Pi(n.elicitations,r)}return new e(t,r,o)}},Pi=class extends O{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(I.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};var he=uf().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:zf.custom,message:"URL must be parseable",fatal:!0}),Rs}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Vf=le({resource:p().url(),authorization_servers:b(he).optional(),jwks_uri:p().url().optional(),scopes_supported:b(p()).optional(),bearer_methods_supported:b(p()).optional(),resource_signing_alg_values_supported:b(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:W().optional(),authorization_details_types_supported:b(p()).optional(),dpop_signing_alg_values_supported:b(p()).optional(),dpop_bound_access_tokens_required:W().optional()}),Xi=le({issuer:p(),authorization_endpoint:he,token_endpoint:he,registration_endpoint:he.optional(),scopes_supported:b(p()).optional(),response_types_supported:b(p()),response_modes_supported:b(p()).optional(),grant_types_supported:b(p()).optional(),token_endpoint_auth_methods_supported:b(p()).optional(),token_endpoint_auth_signing_alg_values_supported:b(p()).optional(),service_documentation:he.optional(),revocation_endpoint:he.optional(),revocation_endpoint_auth_methods_supported:b(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:b(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:b(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:b(p()).optional(),code_challenge_methods_supported:b(p()).optional(),client_id_metadata_document_supported:W().optional()}),jw=le({issuer:p(),authorization_endpoint:he,token_endpoint:he,userinfo_endpoint:he.optional(),jwks_uri:he,registration_endpoint:he.optional(),scopes_supported:b(p()).optional(),response_types_supported:b(p()),response_modes_supported:b(p()).optional(),grant_types_supported:b(p()).optional(),acr_values_supported:b(p()).optional(),subject_types_supported:b(p()),id_token_signing_alg_values_supported:b(p()),id_token_encryption_alg_values_supported:b(p()).optional(),id_token_encryption_enc_values_supported:b(p()).optional(),userinfo_signing_alg_values_supported:b(p()).optional(),userinfo_encryption_alg_values_supported:b(p()).optional(),userinfo_encryption_enc_values_supported:b(p()).optional(),request_object_signing_alg_values_supported:b(p()).optional(),request_object_encryption_alg_values_supported:b(p()).optional(),request_object_encryption_enc_values_supported:b(p()).optional(),token_endpoint_auth_methods_supported:b(p()).optional(),token_endpoint_auth_signing_alg_values_supported:b(p()).optional(),display_values_supported:b(p()).optional(),claim_types_supported:b(p()).optional(),claims_supported:b(p()).optional(),service_documentation:p().optional(),claims_locales_supported:b(p()).optional(),ui_locales_supported:b(p()).optional(),claims_parameter_supported:W().optional(),request_parameter_supported:W().optional(),request_uri_parameter_supported:W().optional(),require_request_uri_registration:W().optional(),op_policy_uri:he.optional(),op_tos_uri:he.optional(),client_id_metadata_document_supported:W().optional()}),Hf=x({...jw.shape,...Xi.pick({code_challenge_methods_supported:!0}).shape}),Jf=x({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:_n.number().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),Kf=x({error:p(),error_description:p().optional(),error_uri:p().optional()}),Ff=he.optional().or(E("").transform(()=>{})),Zw=x({redirect_uris:b(he),token_endpoint_auth_method:p().optional(),grant_types:b(p()).optional(),response_types:b(p()).optional(),client_name:p().optional(),client_uri:he.optional(),logo_uri:Ff,scope:p().optional(),contacts:b(p()).optional(),tos_uri:Ff,policy_uri:p().optional(),jwks_uri:he.optional(),jwks:pf().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),Mw=x({client_id:p(),client_secret:p().optional(),client_id_issued_at:F().optional(),client_secret_expires_at:F().optional()}).strip(),Bf=Zw.merge(Mw),eT=x({error:p(),error_description:p().optional()}).strip(),tT=x({token:p(),token_type_hint:p().optional()}).strip();function Wf(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function Gf({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),o=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(s)}var ce=class extends Error{constructor(t,r){super(t),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let t={error:this.errorCode,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}get errorCode(){return this.constructor.errorCode}},no=class extends ce{};no.errorCode="invalid_request";var qt=class extends ce{};qt.errorCode="invalid_client";var Dt=class extends ce{};Dt.errorCode="invalid_grant";var Ut=class extends ce{};Ut.errorCode="unauthorized_client";var so=class extends ce{};so.errorCode="unsupported_grant_type";var io=class extends ce{};io.errorCode="invalid_scope";var ao=class extends ce{};ao.errorCode="access_denied";var ut=class extends ce{};ut.errorCode="server_error";var co=class extends ce{};co.errorCode="temporarily_unavailable";var uo=class extends ce{};uo.errorCode="unsupported_response_type";var lo=class extends ce{};lo.errorCode="unsupported_token_type";var po=class extends ce{};po.errorCode="invalid_token";var fo=class extends ce{};fo.errorCode="method_not_allowed";var mo=class extends ce{};mo.errorCode="too_many_requests";var Lt=class extends ce{};Lt.errorCode="invalid_client_metadata";var ho=class extends ce{};ho.errorCode="insufficient_scope";var go=class extends ce{};go.errorCode="invalid_target";var Yf={[no.errorCode]:no,[qt.errorCode]:qt,[Dt.errorCode]:Dt,[Ut.errorCode]:Ut,[so.errorCode]:so,[io.errorCode]:io,[ao.errorCode]:ao,[ut.errorCode]:ut,[co.errorCode]:co,[uo.errorCode]:uo,[lo.errorCode]:lo,[po.errorCode]:po,[fo.errorCode]:fo,[mo.errorCode]:mo,[Lt.errorCode]:Lt,[ho.errorCode]:ho,[go.errorCode]:go};var Ue=class extends Error{constructor(t){super(t??"Unauthorized")}};function qw(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var ea="code",ta="S256";function Dw(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&qw(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method))?e.token_endpoint_auth_method:t.length===0?r?"client_secret_basic":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function Uw(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":Lw(n,s,r);return;case"client_secret_post":Fw(n,s,o);return;case"none":Vw(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function Lw(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function Fw(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function Vw(e,t){t.set("client_id",e)}async function Xf(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=Kf.parse(JSON.parse(r)),{error:n,error_description:s,error_uri:i}=o,a=Yf[n]||ut;return new a(s||"",i)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new ut(n)}}async function _o(e,t){try{return await ra(e,t)}catch(r){if(r instanceof qt||r instanceof Ut)return await e.invalidateCredentials?.("all"),await ra(e,t);if(r instanceof Dt)return await e.invalidateCredentials?.("tokens"),await ra(e,t);throw r}}async function ra(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:s}){let i=await e.discoveryState?.(),a,c,u,l=n;if(!l&&i?.resourceMetadataUrl&&(l=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await tm(c,{fetchFn:s}),!a)try{a=await em(t,{resourceMetadataUrl:l},s)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}else{let z=await Yw(t,{resourceMetadataUrl:l,fetchFn:s});c=z.authorizationServerUrl,u=z.authorizationServerMetadata,a=z.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}let d=await Jw(t,e,a),f=o||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation());if(!m){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let z=u?.client_id_metadata_document_supported===!0,P=e.clientMetadataUrl;if(P&&!Hw(P))throw new Lt(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${P}`);if(z&&P)m={client_id:P},await e.saveClientInformation?.(m);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let $=await r$(c,{metadata:u,clientMetadata:e.clientMetadata,scope:f,fetchFn:s});await e.saveClientInformation($),m=$}}let h=!e.redirectUrl;if(r!==void 0||h){let z=await t$(e,c,{metadata:u,resource:d,authorizationCode:r,fetchFn:s});return await e.saveTokens(z),"AUTHORIZED"}let _=await e.tokens();if(_?.refresh_token)try{let z=await e$(c,{metadata:u,clientInformation:m,refreshToken:_.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(z),"AUTHORIZED"}catch(z){if(!(!(z instanceof ce)||z instanceof ut))throw z}let v=e.state?await e.state():void 0,{authorizationUrl:w,codeVerifier:k}=await Qw(c,{metadata:u,clientInformation:m,state:v,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(k),await e.redirectToAuthorization(w),"REDIRECT"}function Hw(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function Jw(e,t,r){let o=Wf(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!Gf({requestedResource:o,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}}function na(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=oa(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=oa(e,"scope")||void 0,a=oa(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function oa(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(o);return n?n[1]||n[2]:null}async function em(e,t,r=fetch){let o=await Ww(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.body?.cancel(),new Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return Vf.parse(await o.json())}async function sa(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)return t?sa(e,void 0,r):void 0;throw o}}function Kw(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Qf(e,t,r=fetch){return await sa(e,{"MCP-Protocol-Version":t},r)}function Bw(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function Ww(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??dr,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let c=Kw(t,n.pathname);i=new URL(c,o?.metadataServerUrl??n),i.search=n.search}let a=await Qf(i,s,r);if(!o?.metadataUrl&&Bw(a,n.pathname)){let c=new URL(`/.well-known/${t}`,n);a=await Qf(c,s,r)}return a}function Gw(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function tm(e,{fetchFn:t=fetch,protocolVersion:r=dr}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=Gw(e);for(let{url:s,type:i}of n){let a=await sa(s,o,t);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return i==="oauth"?Xi.parse(await a.json()):Hf.parse(await a.json())}}}async function Yw(e,t){let r,o;try{r=await em(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(o=r.authorization_servers[0])}catch{}o||(o=String(new URL("/",e)));let n=await tm(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}async function Qw(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(ea))throw new Error(`Incompatible auth server: does not support response type ${ea}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(ta))throw new Error(`Incompatible auth server: does not support code challenge method ${ta}`)}else a=new URL("/authorize",e);let c=await Ts(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",ea),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",ta),a.searchParams.set("redirect_uri",String(o)),s&&a.searchParams.set("state",s),n&&a.searchParams.set("scope",n),n?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}function Xw(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function rm(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),n)await n(c,r,a,t);else if(o){let l=t?.token_endpoint_auth_methods_supported??[],d=Dw(o,l);Uw(d,o,c,r)}let u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await Xf(u);return Jf.parse(await u.json())}async function e$(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),c=await rm(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:n,fetchFn:i});return{refresh_token:o,...c}}async function t$(e,t,{metadata:r,resource:o,authorizationCode:n,fetchFn:s}={}){let i=e.clientMetadata.scope,a;if(e.prepareTokenRequest&&(a=await e.prepareTokenRequest(i)),!a){if(!n)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let u=await e.codeVerifier();a=Xw(n,u,e.redirectUrl)}let c=await e.clientInformation();return rm(t,{metadata:r,tokenRequestParams:a,clientInformation:c??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:s})}async function r$(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let s;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...o!==void 0?{scope:o}:{}})});if(!i.ok)throw await Xf(i);return Bf.parse(await i.json())}function mr(e){return!!e._zod}function Ke(e,t){return mr(e)?Lr(e,t):e.safeParse(t)}function On(e){if(!e)return;let t;if(mr(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function om(e){if(mr(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=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 o=e.value;if(o!==void 0)return o}function St(e){return e==="completed"||e==="failed"||e==="cancelled"}var o$=Symbol("Let zodToJsonSchema decide on which parser to use");var rR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ia(e){let r=On(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=om(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function aa(e,t){let r=Ke(e,t);if(!r.success)throw r.error;return r.data}var u$=6e4,In=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(bn,r=>{this._oncancel(r)}),this.setNotificationHandler(xn,r=>{this._onprogress(r)}),this.setRequestHandler(zn,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Sn,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new O(I.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Pn,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,f=new O(d.error.code,d.error.message,d.error.data);l(f)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new O(I.InvalidParams,`Task not found: ${s}`);if(!St(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(St(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[xt]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(En,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new O(I.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Rn,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new O(I.InvalidParams,`Task not found: ${r.params.taskId}`);if(St(n.status))throw new O(I.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new O(I.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof O?n:new O(I.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,o,n,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),O.fromError(I.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});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 o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),jt(s)||Of(s)?this._onresponse(s):Yr(s)?this._onrequest(s,i):Rf(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=O.fromError(I.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of t.values())o(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(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,r){let o=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,n=this._transport,s=t.params?._meta?.[xt]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:I.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);let a=Pf(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:t.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(i.signal.aborted)throw new O(I.ConnectionClosed,"Request was cancelled");let m={...f,relatedRequestId:t.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let h=m.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>o(t,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:I.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(t){let r=Number(t.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),jt(t))o(t);else{let i=new O(t.error.code,t.error.message,t.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===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 s=!1;if(jt(t)&&t.result&&typeof t.result=="object"){let i=t.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),jt(t))n(t);else{let i=O.fromError(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(t,r,o)}}catch(i){yield{type:"error",error:i instanceof O?i:new O(I.InternalError,String(i))}}return}let s;try{let i=await this.request(t,Mt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new O(I.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},St(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new O(I.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new O(I.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof O?i:new O(I.InternalError,String(i))}}}request(t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=k=>{l(k)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(k){d(k);return}o?.signal?.throwIfAborted();let f=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:f};o?.onprogress&&(this._progressHandlers.set(f,o.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[xt]:c}});let h=k=>{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(k)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`)));let z=k instanceof O?k:new O(I.RequestTimeout,String(k));l(z)};this._responseHandlers.set(f,k=>{if(!o?.signal?.aborted){if(k instanceof Error)return l(k);try{let z=Ke(r,k.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),o?.signal?.addEventListener("abort",()=>{h(o?.signal?.reason)});let _=o?.timeout??u$,v=()=>h(O.fromError(I.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(f,_,o?.maxTotalTimeout,v,o?.resetTimeoutOnProgress??!1);let w=c?.taskId;if(w){let k=z=>{let P=this._responseHandlers.get(f);P?P(z):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,k),this._enqueueTaskMessage(w,{type:"request",message:m,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(f),l(z)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(k=>{this._cleanupTimeout(f),l(k)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},kn,r)}async getTaskResult(t,r,o){return this.request({method:"tasks/result",params:t},r,o)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Tn,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Nf,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let o=r?.relatedTask?.taskId;if(o){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[xt]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,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 a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[xt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[xt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let o=ia(t);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=aa(t,n);return Promise.resolve(r(i,s))})}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 o=ia(t);this._notificationHandlers.set(o,n=>{let s=aa(t,n);return Promise.resolve(r(s))})}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,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,o,n)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(t,r);for(let n of o)if(n.type==="request"&&Yr(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new O(I.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(t);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new O(I.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new O(I.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!t)throw new Error("No request provided");return await o.createTask(n,t.id,{method:t.method,params:t.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new O(I.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=ro.parse({method:"notifications/tasks/status",params:a});await this.notification(c),St(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new O(I.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(St(a.status))throw new O(I.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=ro.parse({method:"notifications/tasks/status",params:c});await this.notification(u),St(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function nm(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function sm(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];nm(i)&&nm(s)?r[n]={...i,...s}:r[n]=s}return r}var Gg=cu(Kc(),1),Yg=cu(Wg(),1);function fk(){let e=new Gg.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Yg.default)(e),e}var fs=class{constructor(t){this._ajv=t??fk()}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 o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var ms=class{constructor(t){this._client=t}async*callToolStream(t,r=fr,o){let n=this._client,s={...o,task:o?.task??(n.isToolTask(t.name)?{}:void 0)},i=n.requestStream({method:"tools/call",params:t},r,s),a=n.getToolOutputValidator(t.name);for await(let c of i){if(c.type==="result"&&a){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new O(I.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let l=a(u.structuredContent);if(!l.valid){yield{type:"error",error:new O(I.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof O){yield{type:"error",error:l};return}yield{type:"error",error:new O(I.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield c}}async getTask(t,r){return this._client.getTask({taskId:t},r)}async getTaskResult(t,r,o){return this._client.getTaskResult({taskId:t},r,o)}async listTasks(t,r){return this._client.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._client.cancelTask({taskId:t},r)}requestStream(t,r,o){return this._client.requestStream(t,r,o)}};function Qg(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 Xg(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}}function hs(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[n]=s.default),r[n]!==void 0&&hs(s,r[n])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&hs(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&hs(r,t)}}function mk(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}var Bo=class extends In{constructor(t,r){super(r),this._clientInfo=t,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new fs,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ji,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Vi,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Zi,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new ms(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=sm(this._capabilities,t)}setRequestHandler(t,r){let n=On(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(mr(n)){let a=n;s=a._zod?.def?.value??a.value}else{let a=n;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");let i=s;if(i==="elicitation/create"){let a=async(c,u)=>{let l=Ke(Gi,c);if(!l.success){let k=l.error instanceof Error?l.error.message:String(l.error);throw new O(I.InvalidParams,`Invalid elicitation request: ${k}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:f,supportsUrlMode:m}=mk(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new O(I.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!m)throw new O(I.InvalidParams,"Client does not support URL-mode elicitation requests");let h=await Promise.resolve(r(c,u));if(d.task){let k=Ke(Mt,h);if(!k.success){let z=k.error instanceof Error?k.error.message:String(k.error);throw new O(I.InvalidParams,`Invalid task creation result: ${z}`)}return k.data}let _=Ke(Yi,h);if(!_.success){let k=_.error instanceof Error?_.error.message:String(_.error);throw new O(I.InvalidParams,`Invalid elicitation result: ${k}`)}let v=_.data,w=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&v.action==="accept"&&v.content&&w&&this._capabilities.elicitation?.form?.applyDefaults)try{hs(w,v.content)}catch{}return v};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,u)=>{let l=Ke(Ki,c);if(!l.success){let v=l.error instanceof Error?l.error.message:String(l.error);throw new O(I.InvalidParams,`Invalid sampling request: ${v}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let v=Ke(Mt,f);if(!v.success){let w=v.error instanceof Error?v.error.message:String(v.error);throw new O(I.InvalidParams,`Invalid task creation result: ${w}`)}return v.data}let h=d.tools||d.toolChoice?Wi:Bi,_=Ke(h,f);if(!_.success){let v=_.error instanceof Error?_.error.message:String(_.error);throw new O(I.InvalidParams,`Invalid sampling result: ${v}`)}return _.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapability(t,r){if(!this._serverCapabilities?.[t])throw new Error(`Server does not support ${t} (required for ${r})`)}async connect(t,r){if(await super.connect(t),t.sessionId===void 0)try{let o=await this.request({method:"initialize",params:{protocolVersion:dr,capabilities:this._capabilities,clientInfo:this._clientInfo}},Oi,r);if(o===void 0)throw new Error(`Server sent invalid initialize result: ${o}`);if(!xf.includes(o.protocolVersion))throw new Error(`Server's protocol version is not supported: ${o.protocolVersion}`);this._serverCapabilities=o.capabilities,this._serverVersion=o.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(o.protocolVersion),this._instructions=o.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(o){throw this.close(),o}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(t){switch(t){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${t})`);if(t==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${t})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${t})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${t})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${t})`);break;case"ping":break}}assertTaskCapability(t){Qg(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&Xg(this._capabilities.tasks?.requests,t,"Client")}async ping(t){return this.request({method:"ping"},Zt,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},Qi,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},Zt,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},Fi,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Mi,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},Ci,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},Ai,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},ji,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},Zt,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},Zt,r)}async callTool(t,r=fr,o){if(this.isToolTaskRequired(t.name))throw new O(I.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:t},r,o),s=this.getToolOutputValidator(t.name);if(s){if(!n.structuredContent&&!n.isError)throw new O(I.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let i=s(n.structuredContent);if(!i.valid)throw new O(I.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof O?i:new O(I.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return n}isToolTask(t){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(t):!1}isToolTaskRequired(t){return this._cachedRequiredTaskTools.has(t)}cacheToolMetadata(t){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of t){if(r.outputSchema){let n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}let o=r.execution?.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(r.name),o==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let o=await this.request({method:"tools/list",params:t},Hi,r);return this.cacheToolMetadata(o.tools),o}_setupListChangedHandler(t,r,o,n){let s=Uf.safeParse(o);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof o.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=o,u=async()=>{if(!i){c(null,null);return}try{let d=await n();c(null,d)}catch(d){let f=d instanceof Error?d:new Error(String(d));c(f,null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let f=setTimeout(u,a);this._listChangedDebounceTimers.set(t,f)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};function gs(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function e_(e=fetch,t){return t?async(r,o)=>{let n={...t,...o,headers:o?.headers?{...gs(t.headers),...gs(o.headers)}:t.headers};return e(r,n)}:e}var Wo=class extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}},t_=10,hk=13,er=32;function tu(e){}function n_(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=tu,onError:r=tu,onRetry:o=tu,onComment:n,maxBufferSize:s}=e,i=[],a=0,c=!0,u,l="",d=0,f,m=!1;function h(y){if(m)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),i.length===0){let se=v(y);se!==""&&(i.push(se),a=se.length),_();return}if(y.indexOf(`
79
+ `)===-1&&y.indexOf("\r")===-1){i.push(y),a+=y.length,_();return}i.push(y);let $=i.join("");i.length=0,a=0;let C=v($);C!==""&&(i.push(C),a=C.length),_()}function _(){s!==void 0&&(a+l.length<=s||(m=!0,i.length=0,a=0,u=void 0,l="",d=0,f=void 0,r(new Wo(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function v(y){let $=0;if(y.indexOf("\r")===-1){let C=y.indexOf(`
80
+ `,$);for(;C!==-1;){if($===C){d>0&&t({id:u,event:f,data:l}),u=void 0,l="",d=0,f=void 0,$=C+1,C=y.indexOf(`
81
+ `,$);continue}let se=y.charCodeAt($);if(r_(y,$,se)){let ie=y.charCodeAt($+5)===er?$+6:$+5,Ee=y.slice(ie,C);if(d===0&&y.charCodeAt(C+1)===t_){t({id:u,event:f,data:Ee}),u=void 0,l="",f=void 0,$=C+2,C=y.indexOf(`
82
+ `,$);continue}l=d===0?Ee:`${l}
83
+ ${Ee}`,d++}else o_(y,$,se)?f=y.slice(y.charCodeAt($+6)===er?$+7:$+6,C)||void 0:w(y,$,C);$=C+1,C=y.indexOf(`
84
+ `,$)}return y.slice($)}for(;$<y.length;){let C=y.indexOf("\r",$),se=y.indexOf(`
85
+ `,$),ie=-1;if(C!==-1&&se!==-1?ie=C<se?C:se:C!==-1?C===y.length-1?ie=-1:ie=C:se!==-1&&(ie=se),ie===-1)break;w(y,$,ie),$=ie+1,y.charCodeAt($-1)===hk&&y.charCodeAt($)===t_&&$++}return y.slice($)}function w(y,$,C){if($===C){z();return}let se=y.charCodeAt($);if(r_(y,$,se)){let yt=y.charCodeAt($+5)===er?$+6:$+5,au=y.slice(yt,C);l=d===0?au:`${l}
86
+ ${au}`,d++;return}if(o_(y,$,se)){f=y.slice(y.charCodeAt($+6)===er?$+7:$+6,C)||void 0;return}if(se===105&&y.charCodeAt($+1)===100&&y.charCodeAt($+2)===58){let yt=y.slice(y.charCodeAt($+3)===er?$+4:$+3,C);u=yt.includes("\0")?void 0:yt;return}if(se===58){if(n){let yt=y.slice($,C);n(yt.slice(y.charCodeAt($+1)===er?2:1))}return}let ie=y.slice($,C),Ee=ie.indexOf(":");if(Ee===-1){k(ie,"",ie);return}let Nr=ie.slice(0,Ee),Yo=ie.charCodeAt(Ee+1)===er?2:1,Qo=ie.slice(Ee+Yo);k(Nr,Qo,ie)}function k(y,$,C){switch(y){case"event":f=$||void 0;break;case"data":l=d===0?$:`${l}
87
+ ${$}`,d++;break;case"id":u=$.includes("\0")?void 0:$;break;case"retry":/^\d+$/.test($)?o(parseInt($,10)):r(new Wo(`Invalid \`retry\` value: "${$}"`,{type:"invalid-retry",value:$,line:C}));break;default:r(new Wo(`Unknown field "${y.length>20?`${y.slice(0,20)}\u2026`:y}"`,{type:"unknown-field",field:y,value:$,line:C}));break}}function z(){d>0&&t({id:u,event:f,data:l}),u=void 0,l="",d=0,f=void 0}function P(y={}){if(y.consume&&i.length>0){let $=i.join("");w($,0,$.length)}c=!0,u=void 0,l="",d=0,f=void 0,i.length=0,a=0,m=!1}return{feed:h,reset:P}}function r_(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function o_(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}var _s=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:o,maxBufferSize:n}={}){let s;super({start(i){s=n_({onEvent:a=>{i.enqueue(a)},onError(a){typeof t=="function"&&t(a),(t==="terminate"||a.type==="max-buffer-size-exceeded")&&i.error(a)},onRetry:r,onComment:o,maxBufferSize:n})},transform(i){s.feed(i)}})}};var gk={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},At=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},Go=class{constructor(t,r){this._hasCompletedAuthFlow=!1,this._url=t,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=e_(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??gk}async _authThenStart(){if(!this._authProvider)throw new Ue("No auth provider");let t;try{t=await _o(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(t!=="AUTHORIZED")throw new Ue;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let o=await this._authProvider.tokens();o&&(t.Authorization=`Bearer ${o.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=gs(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),r&&o.set("last-event-id",r);let n=await(this._fetch??fetch)(this._url,{method:"GET",headers:o,signal:this._abortController?.signal});if(!n.ok){if(await n.body?.cancel(),n.status===401&&this._authProvider)return await this._authThenStart();if(n.status===405)return;throw new At(n.status,`Failed to open SSE stream: ${n.statusText}`)}this._handleSseStream(n.body,t,!0)}catch(o){throw this.onerror?.(o),o}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,o=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(o,t),n)}_scheduleReconnection(t,r=0){let o=this._reconnectionOptions.maxRetries;if(r>=o){this.onerror?.(new Error(`Maximum reconnection attempts (${o}) exceeded.`));return}let n=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(t).catch(s=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(t,r+1)})},n)}_handleSseStream(t,r,o){if(!t)return;let{onresumptiontoken:n,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=t.pipeThrough(new TextDecoderStream).pipeThrough(new _s({onRetry:m=>{this._serverRetryMs=m}})).getReader();for(;;){let{value:m,done:h}=await l.read();if(h)break;if(m.id&&(i=m.id,a=!0,n?.(m.id)),!!m.data&&(!m.event||m.event==="message"))try{let _=$n.parse(JSON.parse(m.data));jt(_)&&(c=!0,s!==void 0&&(_.id=s)),this.onmessage?.(_)}catch(_){this.onerror?.(_)}}(o||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:n,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(o||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:n,replayMessageId:s},0)}catch(m){this.onerror?.(new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(t){if(!this._authProvider)throw new Ue("No auth provider");if(await _o(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ue("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(t,r){try{let{resumptionToken:o,onresumptiontoken:n}=r||{};if(o){this._startOrAuthSse({resumptionToken:o,replayMessageId:Yr(t)?t.id:void 0}).catch(f=>this.onerror?.(f));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(t),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,i),c=a.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!a.ok){let f=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new At(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:m,scope:h}=na(a);if(this._resourceMetadataUrl=m,this._scope=h,await _o(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ue;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:m,scope:h,error:_}=na(a);if(_==="insufficient_scope"){let v=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===v)throw new At(403,"Server returned 403 after trying upscoping");if(h&&(this._scope=h),m&&(this._resourceMetadataUrl=m),this._lastUpscopingHeader=v??void 0,await _o(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ue;return this.send(t)}}throw new At(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),Af(t)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let l=(Array.isArray(t)?t:[t]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=a.headers.get("content-type");if(l)if(d?.includes("text/event-stream"))this._handleSseStream(a.body,{onresumptiontoken:n},!1);else if(d?.includes("application/json")){let f=await a.json(),m=Array.isArray(f)?f.map(h=>$n.parse(h)):[$n.parse(f)];for(let h of m)this.onmessage?.(h)}else throw await a.body?.cancel(),new At(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(o){throw this.onerror?.(o),o}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let t=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:t,signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._url,r);if(await o.body?.cancel(),!o.ok&&o.status!==405)throw new At(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(t){throw this.onerror?.(t),t}}setProtocolVersion(t){this._protocolVersion=t}get protocolVersion(){return this._protocolVersion}async resumeStream(t,r){await this._startOrAuthSse({resumptionToken:t,onresumptiontoken:r?.onresumptiontoken})}};import{exec as s_}from"node:child_process";function i_(e){if(process.platform==="win32"){s_('start "" "%KLEO_BROWSER_URL%"',{env:{...process.env,KLEO_BROWSER_URL:e}},()=>{});return}let t=process.platform==="darwin"?"open":"xdg-open";s_(`${t} "${e}"`,()=>{})}var ru=c_(bk(),".kleo"),Cr=c_(ru,"config.json"),zk="https://app.kleo.so",ou=51820,u_="/callback",a_=`http://localhost:${ou}${u_}`;function ht(){if(!su(Cr))return{};try{return JSON.parse(yk(Cr,"utf8"))}catch{return{}}}function nu(e){su(ru)||_k(ru,{recursive:!0,mode:448}),wk(Cr,`${JSON.stringify(e,null,2)}
88
+ `,{mode:384})}function l_(){su(Cr)&&vk(Cr)}function ws(){return Cr}function $s(e){let t=ht();return(e??process.env.KLEO_API_URL??t.apiUrl??zk).replace(/\/+$/,"")}function ys(e){return`${e.replace(/\/+$/,"")}/api/mcp/mcp`}var vs=class{constructor(t){this.interactive=t}verifier;get redirectUrl(){return a_}get clientMetadata(){return{client_name:"Kleo CLI",redirect_uris:[a_],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none"}}clientInformation(){return ht().oauthClient}saveClientInformation(t){nu({...ht(),oauthClient:t})}tokens(){return ht().tokens}saveTokens(t){nu({...ht(),tokens:t})}saveCodeVerifier(t){this.verifier=t}codeVerifier(){if(!this.verifier)throw new Error("No code verifier saved");return this.verifier}redirectToAuthorization(t){if(!this.interactive)throw new Error("Session expired or was revoked. Run `kleo login` again.");process.stdout.write(`
89
+ Opening your browser to sign in. If it doesn't open, visit:
90
+ ${t.toString()}
91
+
92
+ `),i_(t.toString())}};function xk(){return new Promise((e,t)=>{let r=$k((n,s)=>{let i=new URL(n.url??"",`http://localhost:${ou}`);if(i.pathname!==u_){s.writeHead(404),s.end();return}let a=i.searchParams.get("code"),c=i.searchParams.get("error");s.writeHead(200,{"Content-Type":"text/html"}),s.end(a?"<html><body><h1>Signed in \u2014 you can close this tab.</h1><script>setTimeout(()=>window.close(),1500)</script></body></html>":`<html><body><h1>Authorization failed</h1><p>${c??"no code returned"}</p></body></html>`),clearTimeout(o),setTimeout(()=>r.close(),500),a?e(a):t(new Error(`Authorization failed: ${c??"no code returned"}`))}),o=setTimeout(()=>{r.close(),t(new Error("Timed out waiting for browser authorization (5 min)."))},5*60*1e3);r.listen(ou)})}async function d_(e){let t=$s(e.apiUrl);if(!ht().tokens)throw new Error("Not signed in. Run `kleo login` first.");let r=new vs(!1),o=new Go(new URL(ys(t)),{authProvider:r}),n=new Bo({name:"kleo-cli",version:"1.0.0"},{capabilities:{}});try{await n.connect(o)}catch(s){if(s instanceof Ue)throw new Error("Session expired or was revoked. Run `kleo login` again.");let i=s instanceof Error?s.message:String(s);throw/404|not found/i.test(i)?new Error(`${ys(t)} returned 404 \u2014 the MCP surface is off (NEXT_PUBLIC_ENABLE_MCP must be 'true') or the URL is wrong.`):new Error(`Could not connect to ${ys(t)}: ${i}`)}return{client:n,close:async()=>{await n.close().catch(()=>{})}}}async function p_(e){let t=$s(e.apiUrl);e.apiUrl&&nu({...ht(),apiUrl:t});let r=new vs(!0),o=new Bo({name:"kleo-cli",version:"1.0.0"},{capabilities:{}});async function n(){let i=new Go(new URL(ys(t)),{authProvider:r});try{await o.connect(i)}catch(a){if(!(a instanceof Ue))throw a;let c=await xk();await i.finishAuth(c),await n()}}await n();let{text:s}=await bs({client:o,close:async()=>{}},"whoami",{}).catch(()=>({text:"",raw:{}}));return await o.close().catch(()=>{}),{apiUrl:t,whoami:s}}function Sk(e){return(e.content??[]).filter(t=>t.type==="text"&&typeof t.text=="string").map(t=>t.text).join(`
93
+ `).trim()}async function bs(e,t,r={}){let o=await e.client.callTool({name:t,arguments:r}),n=Sk(o);if(o.isError)throw new Error(n||`Tool ${t} returned an error.`);return{text:n,raw:o}}async function f_(e){let{tools:t}=await e.client.listTools();return t}var kk=new Set(["json","help","h","version"]);function Pk(e){let t=[],r={};for(let o=0;o<e.length;o++){let n=e[o];if(n.startsWith("--")||n.startsWith("-")&&n.length===2&&Number.isNaN(Number(n))){let s=n.replace(/^-+/,""),[i,a]=s.split("=");if(a!==void 0)r[i]=a;else if(kk.has(i))r[i]=!0;else{let c=e[o+1];c!==void 0&&!c.startsWith("-")?(r[i]=c,o++):r[i]=!0}}else t.push(n)}return{positionals:t,flags:r}}function Ar(e,t){let r=e[t];return typeof r=="string"?r:void 0}function m_(e,t){let r=Ar(e,t);if(r===void 0)return;let o=Number(r);return Number.isFinite(o)?o:void 0}var xs=process.stdout.isTTY,gt=e=>xs?`\x1B[2m${e}\x1B[0m`:e,Pe=e=>xs?`\x1B[1m${e}\x1B[0m`:e,Ek=e=>xs?`\x1B[31m${e}\x1B[0m`:e,Ss=e=>xs?`\x1B[36m${e}\x1B[0m`:e;function ze(e){process.stdout.write(`${e}
94
+ `)}function be(e){process.stderr.write(`${Ek("error")} ${e}
95
+ `),process.exit(1)}function Tk(e){return{apiUrl:Ar(e,"url")}}async function iu(e,t){let r=await d_(Tk(e)).catch(o=>be(o.message));try{return await t(r)}finally{await r.close()}}async function _t(e,t,r){await iu(e,async o=>{let{text:n,raw:s}=await bs(o,t,r).catch(i=>be(i.message));ze(e.json?JSON.stringify(s,null,2):n||gt("(empty)"))})}async function Rk(e){let t=Ar(e.flags,"url"),r=await p_({apiUrl:t}).catch(o=>be(o.message));ze(`${Ss("\u2713")} Signed in \u2014 saved to ${gt(ws())}`),ze(` server: ${r.apiUrl}`);try{let o=JSON.parse(r.whoami),n=o.name??o.email;n&&ze(` as: ${n}`)}catch{}}function Ok(){l_(),ze(`${Ss("\u2713")} Cleared ${gt(ws())}`)}function Ik(){let e=$s(),t=!!ht().tokens;ze(`${Pe("server")} ${e}`),ze(`${Pe("session")} ${t?`${Ss("signed in")}`:gt("(none \u2014 run `kleo login`)")}`),ze(gt(`config file: ${ws()}`)),ze(gt("precedence for server: --url > KLEO_API_URL > config file > default"))}async function Ck(e){await iu(e.flags,async t=>{let r=await f_(t);if(e.flags.json)return ze(JSON.stringify(r,null,2));ze(Pe(`${r.length} tools available`));for(let o of r){let n=o.title??"";ze(` ${Ss(o.name.padEnd(22))} ${gt(n)}`)}})}async function Ak(e){await iu(e.flags,async t=>{let r=[["Offers & audiences","getOffersAndAudiences"],["Content strategy","getContentStrategy"],["Content plan","getContentPlan"]],o={};for(let[n,s]of r){let{text:i,raw:a}=await bs(t,s,{}).catch(c=>({text:`(failed: ${c.message})`,raw:{error:c.message}}));e.flags.json?o[s]=a:(ze(Pe(`
96
+ \u2500\u2500 ${n} \u2500\u2500`)),ze(i||gt("(none)")))}e.flags.json&&ze(JSON.stringify(o,null,2))})}async function Nk(e){let t=e.positionals.slice(1).join(" ").trim();t||be('Give the agent a task, e.g. `kleo agent "draft a post about our launch"`');let r=Ar(e.flags,"chat");await _t(e.flags,"kleoAgent",{message:t,...r?{chatId:r}:{}})}async function jk(e){let[,t,...r]=e.positionals;t||be("Usage: kleo call <toolName> [--json '{...}'] [key=value \u2026]");let o={},n=Ar(e.flags,"input")??Ar(e.flags,"args");if(n)try{o=JSON.parse(n)}catch(s){be(`--input is not valid JSON: ${s.message}`)}for(let s of r){let i=s.indexOf("=");i!==-1&&(o[s.slice(0,i)]=s.slice(i+1))}await _t(e.flags,t,o)}async function zs(e,t){let r=e.positionals[1],o=m_(e.flags,"limit");if(!r||r==="list")return t.list||be("This store has no `list`; use `search` or `read`."),_t(e.flags,t.list.tool,o&&t.list.withLimit?{limit:o}:{});if(r==="search"){t.search||be("This store has no `search`.");let n=e.positionals.slice(2).join(" ").trim();return n||be("Usage: search <query>"),_t(e.flags,t.search.tool,{query:n,...o?{limit:o}:{}})}if(r==="read"){let n=e.positionals[2];return n||be(`Usage: read <${t.read.label}>`),_t(e.flags,t.read.tool,{[t.read.argName]:n})}be(`Unknown subcommand '${r}'. Expected: list | search | read`)}async function Zk(e){let t=e.positionals[1],r=m_(e.flags,"limit");if(!t||t==="view"||t==="list")return _t(e.flags,"viewMemory",{});if(t==="search"){let o=e.positionals.slice(2).join(" ").trim();return o||be("Usage: kleo memory search <query>"),_t(e.flags,"searchMemory",{query:o,...r?{limit:r}:{}})}if(t==="read"){let o=e.positionals[2];return o||be("Usage: kleo memory read <path> e.g. voice/style.md"),_t(e.flags,"readMemory",{path:o})}be(`Unknown subcommand '${t}'. Expected: view | search | read`)}var Mk=`${Pe("kleo")} \u2014 your Kleo workspace from the terminal
93
97
 
94
98
  ${Pe("USAGE")}
95
99
  kleo <command> [subcommand] [args] [flags]
96
100
 
97
101
  ${Pe("AUTH")}
98
- kleo login --key kleo_sk_\u2026 [--url https://app.kleo.so] Save credentials (~/.kleo/config.json)
99
- kleo logout Forget credentials
100
- kleo config Show current server + key
101
- kleo whoami Which user/profile this key acts as
102
+ kleo login [--url https://app.kleo.so] Sign in via browser (saves to ~/.kleo/config.json)
103
+ kleo logout Forget the saved session
104
+ kleo config Show current server + session status
105
+ kleo whoami Which user/profile this session acts as
102
106
 
103
107
  ${Pe("KNOWLEDGE BASE")}
104
108
  kleo kb list Catalog of every KB item (id \xB7 title \xB7 type \xB7 preview)
@@ -133,8 +137,7 @@ ${Pe("AGENT & ESCAPE HATCH")}
133
137
  kleo call <tool> [--input '{\u2026}'] [k=v \u2026] Call any tool by name
134
138
 
135
139
  ${Pe("GLOBAL FLAGS")}
136
- --url <u> Override server base URL --key <k> Override API key
137
- --limit <n> Cap list/search results --json Raw JSON output
138
- -h, --help Show this help
140
+ --url <u> Override server base URL --json Raw JSON output
141
+ --limit <n> Cap list/search results -h, --help Show this help
139
142
 
140
- ${ht("Precedence for url/key: --flag > KLEO_API_URL / KLEO_API_KEY > ~/.kleo/config.json > default")}`;async function Ok(){let e=vk(process.argv.slice(2)),t=e.positionals[0];if(!t||e.flags.help||e.flags.h){ze(Rk);return}switch(t){case"login":return bk(e);case"logout":return zk();case"config":return xk();case"whoami":return gt(e.flags,"whoami",{});case"tools":return Sk(e);case"kb":return $s(e,{list:{tool:"listKB"},search:{tool:"searchKB"},read:{tool:"readKB",argName:"id",label:"id"}});case"swipe":case"swipes":return $s(e,{list:{tool:"listSwipes"},search:{tool:"searchSwipes"},read:{tool:"readSwipe",argName:"id",label:"id"}});case"template":case"templates":return $s(e,{list:{tool:"listTemplates",withLimit:!0},search:{tool:"searchTemplates"},read:{tool:"readTemplate",argName:"id",label:"id"}});case"post":case"posts":return $s(e,{list:{tool:"listPosts",withLimit:!0},read:{tool:"readPost",argName:"id",label:"id"}});case"memory":return Tk(e);case"strategy":return kk(e);case"agent":return Pk(e);case"call":return Ek(e);default:ve(`Unknown command '${t}'. Run \`kleo --help\`.`)}}Ok().catch(e=>ve(e instanceof Error?e.message:String(e)));
143
+ ${gt("Precedence for server: --url > KLEO_API_URL > ~/.kleo/config.json > default")}`;async function qk(){let e=Pk(process.argv.slice(2)),t=e.positionals[0];if(!t||e.flags.help||e.flags.h){ze(Mk);return}switch(t){case"login":return Rk(e);case"logout":return Ok();case"config":return Ik();case"whoami":return _t(e.flags,"whoami",{});case"tools":return Ck(e);case"kb":return zs(e,{list:{tool:"listKB"},search:{tool:"searchKB"},read:{tool:"readKB",argName:"id",label:"id"}});case"swipe":case"swipes":return zs(e,{list:{tool:"listSwipes"},search:{tool:"searchSwipes"},read:{tool:"readSwipe",argName:"id",label:"id"}});case"template":case"templates":return zs(e,{list:{tool:"listTemplates",withLimit:!0},search:{tool:"searchTemplates"},read:{tool:"readTemplate",argName:"id",label:"id"}});case"post":case"posts":return zs(e,{list:{tool:"listPosts",withLimit:!0},read:{tool:"readPost",argName:"id",label:"id"}});case"memory":return Zk(e);case"strategy":return Ak(e);case"agent":return Nk(e);case"call":return jk(e);default:be(`Unknown command '${t}'. Run \`kleo --help\`.`)}}qk().catch(e=>be(e instanceof Error?e.message:String(e)));