jotbus 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -26
- package/dist/index.js +61 -50
- package/package.json +34 -7
package/dist/index.js
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
-
var Ob=Object.create;var na=Object.defineProperty;var Rb=Object.getOwnPropertyDescriptor;var Ab=Object.getOwnPropertyNames;var Ib=Object.getPrototypeOf,Cb=Object.prototype.hasOwnProperty;var k=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},oa=(e,t)=>{for(var r in t)na(e,r,{get:t[r],enumerable:!0})},Nb=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ab(t))!Cb.call(e,o)&&o!==r&&na(e,o,{get:()=>t[o],enumerable:!(n=Rb(t,o))||n.enumerable});return e};var sa=(e,t,r)=>(r=e!=null?Ob(Ib(e)):{},Nb(t||!e||!e.__esModule?na(r,"default",{value:e,enumerable:!0}):r,e));var Fn=k(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.regexpCode=H.getEsmExportName=H.getProperty=H.safeStringify=H.stringify=H.strConcat=H.addCodeArg=H.str=H._=H.nil=H._Code=H.Name=H.IDENTIFIER=H._CodeOrName=void 0;var Un=class{};H._CodeOrName=Un;H.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var nr=class extends Un{constructor(t){if(super(),!H.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}}};H.Name=nr;var Be=class extends Un{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof nr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};H._Code=Be;H.nil=new Be("");function Tg(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Bc(r,t[n]),r.push(e[++n]);return new Be(r)}H._=Tg;var Vc=new Be("+");function Og(e,...t){let r=[qn(e[0])],n=0;for(;n<t.length;)r.push(Vc),Bc(r,t[n]),r.push(Vc,qn(e[++n]));return R$(r),new Be(r)}H.str=Og;function Bc(e,t){t instanceof Be?e.push(...t._items):t instanceof nr?e.push(t):e.push(C$(t))}H.addCodeArg=Bc;function R$(e){let t=1;for(;t<e.length-1;){if(e[t]===Vc){let r=A$(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function A$(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof nr||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 nr))return`"${e}${t.slice(1)}`}function I$(e,t){return t.emptyStr()?e:e.emptyStr()?t:Og`${e}${t}`}H.strConcat=I$;function C$(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:qn(Array.isArray(e)?e.join(","):e)}function N$(e){return new Be(qn(e))}H.stringify=N$;function qn(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}H.safeStringify=qn;function j$(e){return typeof e=="string"&&H.IDENTIFIER.test(e)?new Be(`.${e}`):Tg`[${e}]`}H.getProperty=j$;function Z$(e){if(typeof e=="string"&&H.IDENTIFIER.test(e))return new Be(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}H.getEsmExportName=Z$;function M$(e){return new Be(e.toString())}H.regexpCode=M$});var Jc=k(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.ValueScope=Ne.ValueScopeName=Ne.Scope=Ne.varKinds=Ne.UsedValueState=void 0;var Ce=Fn(),Hc=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Hs;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Hs||(Ne.UsedValueState=Hs={}));Ne.varKinds={const:new Ce.Name("const"),let:new Ce.Name("let"),var:new Ce.Name("var")};var Ks=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Ce.Name?t:this.name(t)}name(t){return new Ce.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Ne.Scope=Ks;var Js=class extends Ce.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Ce._)`.${new Ce.Name(r)}[${n}]`}};Ne.ValueScopeName=Js;var D$=(0,Ce._)`\n`,Kc=class extends Ks{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?D$:Ce.nil}}get(){return this._scope}name(t){return new Js(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ce._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=Ce.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Hs.Started);let l=r(u);if(l){let d=this.opts.es5?Ne.varKinds.var:Ne.varKinds.const;s=(0,Ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Ce._)`${s}${l}${this.opts._n}`;else throw new Hc(u);c.set(u,Hs.Completed)})}return s}};Ne.ValueScope=Kc});var M=k(D=>{"use strict";Object.defineProperty(D,"__esModule",{value:!0});D.or=D.and=D.not=D.CodeGen=D.operators=D.varKinds=D.ValueScopeName=D.ValueScope=D.Scope=D.Name=D.regexpCode=D.stringify=D.getProperty=D.nil=D.strConcat=D.str=D._=void 0;var U=Fn(),Qe=Jc(),Lt=Fn();Object.defineProperty(D,"_",{enumerable:!0,get:function(){return Lt._}});Object.defineProperty(D,"str",{enumerable:!0,get:function(){return Lt.str}});Object.defineProperty(D,"strConcat",{enumerable:!0,get:function(){return Lt.strConcat}});Object.defineProperty(D,"nil",{enumerable:!0,get:function(){return Lt.nil}});Object.defineProperty(D,"getProperty",{enumerable:!0,get:function(){return Lt.getProperty}});Object.defineProperty(D,"stringify",{enumerable:!0,get:function(){return Lt.stringify}});Object.defineProperty(D,"regexpCode",{enumerable:!0,get:function(){return Lt.regexpCode}});Object.defineProperty(D,"Name",{enumerable:!0,get:function(){return Lt.Name}});var Ys=Jc();Object.defineProperty(D,"Scope",{enumerable:!0,get:function(){return Ys.Scope}});Object.defineProperty(D,"ValueScope",{enumerable:!0,get:function(){return Ys.ValueScope}});Object.defineProperty(D,"ValueScopeName",{enumerable:!0,get:function(){return Ys.ValueScopeName}});Object.defineProperty(D,"varKinds",{enumerable:!0,get:function(){return Ys.varKinds}});D.operators={GT:new U._Code(">"),GTE:new U._Code(">="),LT:new U._Code("<"),LTE:new U._Code("<="),EQ:new U._Code("==="),NEQ:new U._Code("!=="),NOT:new U._Code("!"),OR:new U._Code("||"),AND:new U._Code("&&"),ADD:new U._Code("+")};var vt=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Wc=class extends vt{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Qe.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Vr(this.rhs,t,r)),this}get names(){return this.rhs instanceof U._CodeOrName?this.rhs.names:{}}},Ws=class extends vt{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof U.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Vr(this.rhs,t,r),this}get names(){let t=this.lhs instanceof U.Name?{}:{...this.lhs.names};return Xs(t,this.rhs)}},Gc=class extends Ws{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Xc=class extends vt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Yc=class extends vt{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Qc=class extends vt{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},eu=class extends vt{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=Vr(this.code,t,r),this}get names(){return this.code instanceof U._CodeOrName?this.code.names:{}}},Vn=class extends vt{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(L$(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>ir(t,r.names),{})}},$t=class extends Vn{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},tu=class extends Vn{},Fr=class extends $t{};Fr.kind="else";var or=class e extends $t{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Fr(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Rg(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Vr(this.condition,t,r),this}get names(){let t=super.names;return Xs(t,this.condition),this.else&&ir(t,this.else.names),t}};or.kind="if";var sr=class extends $t{};sr.kind="for";var ru=class extends sr{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=Vr(this.iteration,t,r),this}get names(){return ir(super.names,this.iteration.names)}},nu=class extends sr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?Qe.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=Xs(super.names,this.from);return Xs(t,this.to)}},Gs=class extends sr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}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=Vr(this.iterable,t,r),this}get names(){return ir(super.names,this.iterable.names)}},Bn=class extends $t{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Bn.kind="func";var Hn=class extends Vn{render(t){return"return "+super.render(t)}};Hn.kind="return";var ou=class extends $t{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&ir(t,this.catch.names),this.finally&&ir(t,this.finally.names),t}},Kn=class extends $t{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Kn.kind="catch";var Jn=class extends $t{render(t){return"finally"+super.render(t)}};Jn.kind="finally";var su=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
-
`:""},this._extScope=t,this._scope=new Qe.Scope({parent:t}),this._nodes=[new tu]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Wc(t,s,n)),s}const(t,r,n){return this._def(Qe.varKinds.const,t,r,n)}let(t,r,n){return this._def(Qe.varKinds.let,t,r,n)}var(t,r,n){return this._def(Qe.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Ws(t,r,n))}add(t,r){return this._leafNode(new Gc(t,D.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==U.nil&&this._leafNode(new eu(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,U.addCodeArg)(r,o));return r.push("}"),new U._Code(r)}if(t,r,n){if(this._blockNode(new or(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new or(t))}else(){return this._elseNode(new Fr)}endIf(){return this._endBlockNode(or,Fr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new ru(t),r)}forRange(t,r,n,o,s=this.opts.es5?Qe.varKinds.var:Qe.varKinds.let){let i=this._scope.toName(t);return this._for(new nu(s,i,r,n),()=>o(i))}forOf(t,r,n,o=Qe.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof U.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,U._)`${i}.length`,a=>{this.var(s,(0,U._)`${i}[${a}]`),n(s)})}return this._for(new Gs("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?Qe.varKinds.var:Qe.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,U._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new Gs("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(sr)}label(t){return this._leafNode(new Xc(t))}break(t){return this._leafNode(new Yc(t))}return(t){let r=new Hn;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Hn)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new ou;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new Kn(s),r(s)}return n&&(this._currNode=o.finally=new Jn,this.code(n)),this._endBlockNode(Kn,Jn)}throw(t){return this._leafNode(new Qc(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=U.nil,n,o){return this._blockNode(new Bn(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Bn)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof or))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}};D.CodeGen=su;function ir(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Xs(e,t){return t instanceof U._CodeOrName?ir(e,t.names):e}function Vr(e,t,r){if(e instanceof U.Name)return n(e);if(!o(e))return e;return new U._Code(e._items.reduce((s,i)=>(i instanceof U.Name&&(i=n(i)),i instanceof U._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof U._Code&&s._items.some(i=>i instanceof U.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 Rg(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,U._)`!${iu(e)}`}D.not=Rg;var U$=Ag(D.operators.AND);function q$(...e){return e.reduce(U$)}D.and=q$;var F$=Ag(D.operators.OR);function V$(...e){return e.reduce(F$)}D.or=V$;function Ag(e){return(t,r)=>t===U.nil?r:r===U.nil?t:(0,U._)`${iu(t)} ${e} ${iu(r)}`}function iu(e){return e instanceof U.Name?e:(0,U._)`(${e})`}});var q=k(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.checkStrictMode=L.getErrorPath=L.Type=L.useFunc=L.setEvaluated=L.evaluatedPropsToName=L.mergeEvaluated=L.eachItem=L.unescapeJsonPointer=L.escapeJsonPointer=L.escapeFragment=L.unescapeFragment=L.schemaRefOrVal=L.schemaHasRulesButRef=L.schemaHasRules=L.checkUnknownRules=L.alwaysValidSchema=L.toHash=void 0;var Y=M(),B$=Fn();function H$(e){let t={};for(let r of e)t[r]=!0;return t}L.toHash=H$;function K$(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Ng(e,t),!jg(t,e.self.RULES.all))}L.alwaysValidSchema=K$;function Ng(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||Dg(e,`unknown keyword: "${s}"`)}L.checkUnknownRules=Ng;function jg(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}L.schemaHasRules=jg;function J$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}L.schemaHasRulesButRef=J$;function W$({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Y._)`${r}`}return(0,Y._)`${e}${t}${(0,Y.getProperty)(n)}`}L.schemaRefOrVal=W$;function G$(e){return Zg(decodeURIComponent(e))}L.unescapeFragment=G$;function X$(e){return encodeURIComponent(cu(e))}L.escapeFragment=X$;function cu(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}L.escapeJsonPointer=cu;function Zg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}L.unescapeJsonPointer=Zg;function Y$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}L.eachItem=Y$;function Ig({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof Y.Name?(s instanceof Y.Name?e(o,s,i):t(o,s,i),i):s instanceof Y.Name?(t(o,i,s),s):r(s,i);return a===Y.Name&&!(c instanceof Y.Name)?n(o,c):c}}L.mergeEvaluated={props:Ig({mergeNames:(e,t,r)=>e.if((0,Y._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Y._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Y._)`${r} || {}`).code((0,Y._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Y._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Y._)`${r} || {}`),uu(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Mg}),items:Ig({mergeNames:(e,t,r)=>e.if((0,Y._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Y._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Y._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Y._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Mg(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,Y._)`{}`);return t!==void 0&&uu(e,r,t),r}L.evaluatedPropsToName=Mg;function uu(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Y._)`${t}${(0,Y.getProperty)(n)}`,!0))}L.setEvaluated=uu;var Cg={};function Q$(e,t){return e.scopeValue("func",{ref:t,code:Cg[t.code]||(Cg[t.code]=new B$._Code(t.code))})}L.useFunc=Q$;var au;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(au||(L.Type=au={}));function eS(e,t,r){if(e instanceof Y.Name){let n=t===au.Num;return r?n?(0,Y._)`"[" + ${e} + "]"`:(0,Y._)`"['" + ${e} + "']"`:n?(0,Y._)`"/" + ${e}`:(0,Y._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Y.getProperty)(e).toString():"/"+cu(e)}L.getErrorPath=eS;function Dg(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}L.checkStrictMode=Dg});var St=k(lu=>{"use strict";Object.defineProperty(lu,"__esModule",{value:!0});var $e=M(),tS={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")};lu.default=tS});var Wn=k(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.extendErrors=Se.resetErrorsCount=Se.reportExtraError=Se.reportError=Se.keyword$DataError=Se.keywordError=void 0;var F=M(),Qs=q(),Te=St();Se.keywordError={message:({keyword:e})=>(0,F.str)`must pass "${e}" keyword validation`};Se.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,F.str)`"${e}" keyword must be ${t} ($data)`:(0,F.str)`"${e}" keyword is invalid ($data)`};function rS(e,t=Se.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=qg(e,t,r);n??(i||a)?Lg(s,c):Ug(o,(0,F._)`[${c}]`)}Se.reportError=rS;function nS(e,t=Se.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=qg(e,t,r);Lg(o,a),s||i||Ug(n,Te.default.vErrors)}Se.reportExtraError=nS;function oS(e,t){e.assign(Te.default.errors,t),e.if((0,F._)`${Te.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,F._)`${Te.default.vErrors}.length`,t),()=>e.assign(Te.default.vErrors,null)))}Se.resetErrorsCount=oS;function sS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,Te.default.errors,a=>{e.const(i,(0,F._)`${Te.default.vErrors}[${a}]`),e.if((0,F._)`${i}.instancePath === undefined`,()=>e.assign((0,F._)`${i}.instancePath`,(0,F.strConcat)(Te.default.instancePath,s.errorPath))),e.assign((0,F._)`${i}.schemaPath`,(0,F.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,F._)`${i}.schema`,r),e.assign((0,F._)`${i}.data`,n))})}Se.extendErrors=sS;function Lg(e,t){let r=e.const("err",t);e.if((0,F._)`${Te.default.vErrors} === null`,()=>e.assign(Te.default.vErrors,(0,F._)`[${r}]`),(0,F._)`${Te.default.vErrors}.push(${r})`),e.code((0,F._)`${Te.default.errors}++`)}function Ug(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,F._)`new ${e.ValidationError}(${t})`):(r.assign((0,F._)`${n}.errors`,t),r.return(!1))}var ar={keyword:new F.Name("keyword"),schemaPath:new F.Name("schemaPath"),params:new F.Name("params"),propertyName:new F.Name("propertyName"),message:new F.Name("message"),schema:new F.Name("schema"),parentSchema:new F.Name("parentSchema")};function qg(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,F._)`{}`:iS(e,t,r)}function iS(e,t,r={}){let{gen:n,it:o}=e,s=[aS(o,r),cS(e,r)];return uS(e,t,s),n.object(...s)}function aS({errorPath:e},{instancePath:t}){let r=t?(0,F.str)`${e}${(0,Qs.getErrorPath)(t,Qs.Type.Str)}`:e;return[Te.default.instancePath,(0,F.strConcat)(Te.default.instancePath,r)]}function cS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,F.str)`${t}/${e}`;return r&&(o=(0,F.str)`${o}${(0,Qs.getErrorPath)(r,Qs.Type.Str)}`),[ar.schemaPath,o]}function uS(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([ar.keyword,o],[ar.params,typeof t=="function"?t(e):t||(0,F._)`{}`]),c.messages&&n.push([ar.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([ar.schema,i],[ar.parentSchema,(0,F._)`${l}${d}`],[Te.default.data,s]),u&&n.push([ar.propertyName,u])}});var Vg=k(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.boolOrEmptySchema=Br.topBoolOrEmptySchema=void 0;var lS=Wn(),dS=M(),fS=St(),pS={message:"boolean schema is false"};function hS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Fg(e,!1):typeof r=="object"&&r.$async===!0?t.return(fS.default.data):(t.assign((0,dS._)`${n}.errors`,null),t.return(!0))}Br.topBoolOrEmptySchema=hS;function mS(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Fg(e)):r.var(t,!0)}Br.boolOrEmptySchema=mS;function Fg(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,lS.reportError)(o,pS,void 0,t)}});var du=k(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0});Hr.getRules=Hr.isJSONType=void 0;var gS=["string","number","integer","boolean","null","object","array"],yS=new Set(gS);function _S(e){return typeof e=="string"&&yS.has(e)}Hr.isJSONType=_S;function bS(){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:{}}}Hr.getRules=bS});var fu=k(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.shouldUseRule=Ut.shouldUseGroup=Ut.schemaHasRulesForType=void 0;function wS({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Bg(e,n)}Ut.schemaHasRulesForType=wS;function Bg(e,t){return t.rules.some(r=>Hg(e,r))}Ut.shouldUseGroup=Bg;function Hg(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Ut.shouldUseRule=Hg});var Gn=k(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.reportTypeError=ze.checkDataTypes=ze.checkDataType=ze.coerceAndCheckDataType=ze.getJSONTypes=ze.getSchemaTypes=ze.DataType=void 0;var xS=du(),vS=fu(),$S=Wn(),j=M(),Kg=q(),Kr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Kr||(ze.DataType=Kr={}));function SS(e){let t=Jg(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}ze.getSchemaTypes=SS;function Jg(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(xS.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ze.getJSONTypes=Jg;function zS(e,t){let{gen:r,data:n,opts:o}=e,s=kS(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,vS.schemaHasRulesForType)(e,t[0]));if(i){let a=hu(t,n,o.strictNumbers,Kr.Wrong);r.if(a,()=>{s.length?PS(e,t,s):mu(e)})}return i}ze.coerceAndCheckDataType=zS;var Wg=new Set(["string","number","integer","boolean","null"]);function kS(e,t){return t?e.filter(r=>Wg.has(r)||t==="array"&&r==="array"):[]}function PS(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,j._)`typeof ${o}`),a=n.let("coerced",(0,j._)`undefined`);s.coerceTypes==="array"&&n.if((0,j._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,j._)`${o}[0]`).assign(i,(0,j._)`typeof ${o}`).if(hu(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,j._)`${a} !== undefined`);for(let u of r)(Wg.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),mu(e),n.endIf(),n.if((0,j._)`${a} !== undefined`,()=>{n.assign(o,a),ES(e,a)});function c(u){switch(u){case"string":n.elseIf((0,j._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,j._)`"" + ${o}`).elseIf((0,j._)`${o} === null`).assign(a,(0,j._)`""`);return;case"number":n.elseIf((0,j._)`${i} == "boolean" || ${o} === null
|
|
5
|
-
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,
|
|
6
|
-
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,
|
|
7
|
-
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,j._)`[${o}]`)}}}function ES({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,j._)`${t} !== undefined`,()=>e.assign((0,j._)`${t}[${r}]`,n))}function pu(e,t,r,n=Kr.Correct){let o=n===Kr.Correct?j.operators.EQ:j.operators.NEQ,s;switch(e){case"null":return(0,j._)`${t} ${o} null`;case"array":s=(0,j._)`Array.isArray(${t})`;break;case"object":s=(0,j._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,j._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,j._)`typeof ${t} ${o} ${e}`}return n===Kr.Correct?s:(0,j.not)(s);function i(a=j.nil){return(0,j.and)((0,j._)`typeof ${t} == "number"`,a,r?(0,j._)`isFinite(${t})`:j.nil)}}ze.checkDataType=pu;function hu(e,t,r,n){if(e.length===1)return pu(e[0],t,r,n);let o,s=(0,Kg.toHash)(e);if(s.array&&s.object){let i=(0,j._)`typeof ${t} != "object"`;o=s.null?i:(0,j._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=j.nil;s.number&&delete s.integer;for(let i in s)o=(0,j.and)(o,pu(i,t,r,n));return o}ze.checkDataTypes=hu;var TS={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,j._)`{type: ${e}}`:(0,j._)`{type: ${t}}`};function mu(e){let t=OS(e);(0,$S.reportError)(t,TS)}ze.reportTypeError=mu;function OS(e){let{gen:t,data:r,schema:n}=e,o=(0,Kg.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Xg=k(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});ei.assignDefaults=void 0;var Jr=M(),RS=q();function AS(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Gg(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Gg(e,s,o.default))}ei.assignDefaults=AS;function Gg(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,Jr._)`${s}${(0,Jr.getProperty)(t)}`;if(o){(0,RS.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,Jr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Jr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Jr._)`${a} = ${(0,Jr.stringify)(r)}`)}});var He=k(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.validateUnion=W.validateArray=W.usePattern=W.callValidateCode=W.schemaProperties=W.allSchemaProperties=W.noPropertyInData=W.propertyInData=W.isOwnProperty=W.hasPropFunc=W.reportMissingProp=W.checkMissingProp=W.checkReportMissingProp=void 0;var re=M(),gu=q(),qt=St(),IS=q();function CS(e,t){let{gen:r,data:n,it:o}=e;r.if(_u(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,re._)`${t}`},!0),e.error()})}W.checkReportMissingProp=CS;function NS({gen:e,data:t,it:{opts:r}},n,o){return(0,re.or)(...n.map(s=>(0,re.and)(_u(e,t,s,r.ownProperties),(0,re._)`${o} = ${s}`)))}W.checkMissingProp=NS;function jS(e,t){e.setParams({missingProperty:t},!0),e.error()}W.reportMissingProp=jS;function Yg(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,re._)`Object.prototype.hasOwnProperty`})}W.hasPropFunc=Yg;function yu(e,t,r){return(0,re._)`${Yg(e)}.call(${t}, ${r})`}W.isOwnProperty=yu;function ZS(e,t,r,n){let o=(0,re._)`${t}${(0,re.getProperty)(r)} !== undefined`;return n?(0,re._)`${o} && ${yu(e,t,r)}`:o}W.propertyInData=ZS;function _u(e,t,r,n){let o=(0,re._)`${t}${(0,re.getProperty)(r)} === undefined`;return n?(0,re.or)(o,(0,re.not)(yu(e,t,r))):o}W.noPropertyInData=_u;function Qg(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}W.allSchemaProperties=Qg;function MS(e,t){return Qg(t).filter(r=>!(0,gu.alwaysValidSchema)(e,t[r]))}W.schemaProperties=MS;function DS({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,re._)`${e}, ${t}, ${n}${o}`:t,d=[[qt.default.instancePath,(0,re.strConcat)(qt.default.instancePath,s)],[qt.default.parentData,i.parentData],[qt.default.parentDataProperty,i.parentDataProperty],[qt.default.rootData,qt.default.rootData]];i.opts.dynamicRef&&d.push([qt.default.dynamicAnchors,qt.default.dynamicAnchors]);let p=(0,re._)`${l}, ${r.object(...d)}`;return c!==re.nil?(0,re._)`${a}.call(${c}, ${p})`:(0,re._)`${a}(${p})`}W.callValidateCode=DS;var LS=(0,re._)`new RegExp`;function US({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,re._)`${o.code==="new RegExp"?LS:(0,IS.useFunc)(e,o)}(${r}, ${n})`})}W.usePattern=US;function qS(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.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,re._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:gu.Type.Num},s),t.if((0,re.not)(s),a)})}}W.validateArray=qS;function FS(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,gu.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,re._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,re.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}W.validateUnion=FS});var ry=k(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.validateKeywordUsage=st.validSchemaType=st.funcKeywordCode=st.macroKeywordCode=void 0;var Oe=M(),cr=St(),VS=He(),BS=Wn();function HS(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=ty(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:Oe.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}st.macroKeywordCode=HS;function KS(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;WS(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=ty(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)m(),t.modifying&&ey(e),y(()=>e.error());else{let w=t.async?f():h();t.modifying&&ey(e),y(()=>JS(e,w))}}function f(){let w=n.let("ruleErrs",null);return n.try(()=>m((0,Oe._)`await `),v=>n.assign(d,!1).if((0,Oe._)`${v} instanceof ${c.ValidationError}`,()=>n.assign(w,(0,Oe._)`${v}.errors`),()=>n.throw(v))),w}function h(){let w=(0,Oe._)`${l}.errors`;return n.assign(w,null),m(Oe.nil),w}function m(w=t.async?(0,Oe._)`await `:Oe.nil){let v=c.opts.passContext?cr.default.this:cr.default.self,z=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,Oe._)`${w}${(0,VS.callValidateCode)(e,l,v,z)}`,t.modifying)}function y(w){var v;n.if((0,Oe.not)((v=t.valid)!==null&&v!==void 0?v:d),w)}}st.funcKeywordCode=KS;function ey(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Oe._)`${n.parentData}[${n.parentDataProperty}]`))}function JS(e,t){let{gen:r}=e;r.if((0,Oe._)`Array.isArray(${t})`,()=>{r.assign(cr.default.vErrors,(0,Oe._)`${cr.default.vErrors} === null ? ${t} : ${cr.default.vErrors}.concat(${t})`).assign(cr.default.errors,(0,Oe._)`${cr.default.vErrors}.length`),(0,BS.extendErrors)(e)},()=>e.error())}function WS({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function ty(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,Oe.stringify)(r)})}function GS(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}st.validSchemaType=GS;function XS({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}st.validateKeywordUsage=XS});var oy=k(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.extendSubschemaMode=Ft.extendSubschemaData=Ft.getSubschema=void 0;var it=M(),ny=q();function YS(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==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,it._)`${e.schemaPath}${(0,it.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,it._)`${e.schemaPath}${(0,it.getProperty)(t)}${(0,it.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,ny.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Ft.getSubschema=YS;function QS(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==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,p=a.let("data",(0,it._)`${t.data}${(0,it.getProperty)(r)}`,!0);c(p),e.errorPath=(0,it.str)`${u}${(0,ny.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,it._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof it.Name?o:a.let("data",o,!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]}}Ft.extendSubschemaData=QS;function ez(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Ft.extendSubschemaMode=ez});var bu=k((YN,sy)=>{"use strict";sy.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))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),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var ay=k((QN,iy)=>{"use strict";var Vt=iy.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};ti(t,n,o,e,"",e)};Vt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Vt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Vt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Vt.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 ti(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Vt.arrayKeywords)for(var p=0;p<d.length;p++)ti(e,t,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in Vt.propsKeywords){if(d&&typeof d=="object")for(var f in d)ti(e,t,r,d[f],o+"/"+l+"/"+tz(f),s,o,l,n,f)}else(l in Vt.keywords||e.allKeys&&!(l in Vt.skipKeywords))&&ti(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function tz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Xn=k(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.getSchemaRefs=je.resolveUrl=je.normalizeId=je._getFullPath=je.getFullPath=je.inlineRef=void 0;var rz=q(),nz=bu(),oz=ay(),sz=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function iz(e,t=!0){return typeof e=="boolean"?!0:t===!0?!wu(e):t?cy(e)<=t:!1}je.inlineRef=iz;var az=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function wu(e){for(let t in e){if(az.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(wu)||typeof r=="object"&&wu(r))return!0}return!1}function cy(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!sz.has(r)&&(typeof e[r]=="object"&&(0,rz.eachItem)(e[r],n=>t+=cy(n)),t===1/0))return 1/0}return t}function uy(e,t="",r){r!==!1&&(t=Wr(t));let n=e.parse(t);return ly(e,n)}je.getFullPath=uy;function ly(e,t){return e.serialize(t).split("#")[0]+"#"}je._getFullPath=ly;var cz=/#\/?$/;function Wr(e){return e?e.replace(cz,""):""}je.normalizeId=Wr;function uz(e,t,r){return r=Wr(r),e.resolve(t,r)}je.resolveUrl=uz;var lz=/^[a-z_][-a-z0-9._]*$/i;function dz(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Wr(e[r]||t),s={"":o},i=uy(n,o,!1),a={},c=new Set;return oz(e,{allKeys:!0},(d,p,f,h)=>{if(h===void 0)return;let m=i+p,y=s[h];typeof d[r]=="string"&&(y=w.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),s[p]=y;function w(z){let A=this.opts.uriResolver.resolve;if(z=Wr(y?A(y,z):z),c.has(z))throw l(z);c.add(z);let b=this.refs[z];return typeof b=="string"&&(b=this.refs[b]),typeof b=="object"?u(d,b.schema,z):z!==Wr(m)&&(z[0]==="#"?(u(d,a[z],z),a[z]=d):this.refs[z]=m),z}function v(z){if(typeof z=="string"){if(!lz.test(z))throw new Error(`invalid anchor "${z}"`);w.call(this,`#${z}`)}}}),a;function u(d,p,f){if(p!==void 0&&!nz(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}je.getSchemaRefs=dz});var eo=k(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.getData=Bt.KeywordCxt=Bt.validateFunctionCode=void 0;var my=Vg(),dy=Gn(),vu=fu(),ri=Gn(),fz=Xg(),Qn=ry(),xu=oy(),O=M(),N=St(),pz=Xn(),zt=q(),Yn=Wn();function hz(e){if(_y(e)&&(by(e),yy(e))){yz(e);return}gy(e,()=>(0,my.topBoolOrEmptySchema)(e))}Bt.validateFunctionCode=hz;function gy({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,O._)`${N.default.data}, ${N.default.valCxt}`,n.$async,()=>{e.code((0,O._)`"use strict"; ${fy(r,o)}`),gz(e,o),e.code(s)}):e.func(t,(0,O._)`${N.default.data}, ${mz(o)}`,n.$async,()=>e.code(fy(r,o)).code(s))}function mz(e){return(0,O._)`{${N.default.instancePath}="", ${N.default.parentData}, ${N.default.parentDataProperty}, ${N.default.rootData}=${N.default.data}${e.dynamicRef?(0,O._)`, ${N.default.dynamicAnchors}={}`:O.nil}}={}`}function gz(e,t){e.if(N.default.valCxt,()=>{e.var(N.default.instancePath,(0,O._)`${N.default.valCxt}.${N.default.instancePath}`),e.var(N.default.parentData,(0,O._)`${N.default.valCxt}.${N.default.parentData}`),e.var(N.default.parentDataProperty,(0,O._)`${N.default.valCxt}.${N.default.parentDataProperty}`),e.var(N.default.rootData,(0,O._)`${N.default.valCxt}.${N.default.rootData}`),t.dynamicRef&&e.var(N.default.dynamicAnchors,(0,O._)`${N.default.valCxt}.${N.default.dynamicAnchors}`)},()=>{e.var(N.default.instancePath,(0,O._)`""`),e.var(N.default.parentData,(0,O._)`undefined`),e.var(N.default.parentDataProperty,(0,O._)`undefined`),e.var(N.default.rootData,N.default.data),t.dynamicRef&&e.var(N.default.dynamicAnchors,(0,O._)`{}`)})}function yz(e){let{schema:t,opts:r,gen:n}=e;gy(e,()=>{r.$comment&&t.$comment&&xy(e),vz(e),n.let(N.default.vErrors,null),n.let(N.default.errors,0),r.unevaluated&&_z(e),wy(e),zz(e)})}function _z(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,O._)`${r}.evaluated`),t.if((0,O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,O._)`${e.evaluated}.props`,(0,O._)`undefined`)),t.if((0,O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,O._)`${e.evaluated}.items`,(0,O._)`undefined`))}function fy(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function bz(e,t){if(_y(e)&&(by(e),yy(e))){wz(e,t);return}(0,my.boolOrEmptySchema)(e,t)}function yy({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 _y(e){return typeof e.schema!="boolean"}function wz(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&xy(e),$z(e),Sz(e);let s=n.const("_errs",N.default.errors);wy(e,s),n.var(t,(0,O._)`${s} === ${N.default.errors}`)}function by(e){(0,zt.checkUnknownRules)(e),xz(e)}function wy(e,t){if(e.opts.jtd)return py(e,[],!1,t);let r=(0,dy.getSchemaTypes)(e.schema),n=(0,dy.coerceAndCheckDataType)(e,r);py(e,r,!n,t)}function xz(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,zt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function vz(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,zt.checkStrictMode)(e,"default is ignored in the schema root")}function $z(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,pz.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function Sz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function xy({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,O._)`${N.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,O.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,O._)`${N.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function zz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,O._)`${N.default.errors} === 0`,()=>t.return(N.default.data),()=>t.throw((0,O._)`new ${o}(${N.default.vErrors})`)):(t.assign((0,O._)`${n}.errors`,N.default.vErrors),s.unevaluated&&kz(e),t.return((0,O._)`${N.default.errors} === 0`))}function kz({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0,O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0,O._)`${t}.items`,n)}function py(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,zt.schemaHasRulesButRef)(s,l))){o.block(()=>$y(e,"$ref",l.all.$ref.definition));return}c.jtd||Pz(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,vu.shouldUseGroup)(s,p)&&(p.type?(o.if((0,ri.checkDataType)(p.type,i,c.strictNumbers)),hy(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,ri.reportTypeError)(e)),o.endIf()):hy(e,p),a||o.if((0,O._)`${N.default.errors} === ${n||0}`))}}function hy(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,fz.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,vu.shouldUseRule)(n,s)&&$y(e,s.keyword,s.definition,t.type)})}function Pz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Ez(e,t),e.opts.allowUnionTypes||Tz(e,t),Oz(e,e.dataTypes))}function Ez(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{vy(e.dataTypes,r)||$u(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Az(e,t)}}function Tz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&$u(e,"use allowUnionTypes to allow union type keyword")}function Oz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,vu.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>Rz(t,i))&&$u(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function Rz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function vy(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Az(e,t){let r=[];for(let n of e.dataTypes)vy(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function $u(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,zt.checkStrictMode)(e,t,e.opts.strictTypes)}var ni=class{constructor(t,r,n){if((0,Qn.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,zt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Sy(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Qn.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",N.default.errors))}result(t,r,n){this.failResult((0,O.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,O.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,O._)`${r} !== undefined && (${(0,O.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Yn.reportExtraError:Yn.reportError)(this,this.def.error,r)}$dataError(){(0,Yn.reportError)(this,this.def.$dataError||Yn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Yn.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=O.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),t!==O.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,O.or)(i(),a());function i(){if(n.length){if(!(r instanceof O.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,O._)`${(0,ri.checkDataTypes)(c,r,s.opts.strictNumbers,ri.DataType.Wrong)}`}return O.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0,xu.getSubschema)(this.it,t);(0,xu.extendSubschemaData)(n,this.it,t),(0,xu.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return bz(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=zt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=zt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,O.Name)),!0}};Bt.KeywordCxt=ni;function $y(e,t,r,n){let o=new ni(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Qn.funcKeywordCode)(o,r):"macro"in r?(0,Qn.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Qn.funcKeywordCode)(o,r)}var Iz=/^\/(?:[^~]|~0|~1)*$/,Cz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Sy(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return N.default.rootData;if(e[0]==="/"){if(!Iz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=N.default.rootData}else{let u=Cz.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,O._)`${s}${(0,O.getProperty)((0,zt.unescapeJsonPointer)(u))}`,i=(0,O._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Bt.getData=Sy});var oi=k(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});var Su=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};zu.default=Su});var to=k(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});var ku=Xn(),Pu=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,ku.resolveUrl)(t,r,n),this.missingSchema=(0,ku.normalizeId)((0,ku.getFullPath)(t,this.missingRef))}};Eu.default=Pu});var ii=k(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.resolveSchema=Ke.getCompilingSchema=Ke.resolveRef=Ke.compileSchema=Ke.SchemaEnv=void 0;var et=M(),Nz=oi(),ur=St(),tt=Xn(),zy=q(),jz=eo(),Gr=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,tt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Ke.SchemaEnv=Gr;function Ou(e){let t=ky.call(this,e);if(t)return t;let r=(0,tt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new et.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:Nz.default,code:(0,et._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:ur.default.data,parentData:ur.default.parentData,parentDataProperty:ur.default.parentDataProperty,dataNames:[ur.default.data],dataPathArr:[et.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,et.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:et.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,et._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,jz.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(ur.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${ur.default.self}`,`${ur.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:m}=u;f.evaluated={props:h instanceof et.Name?void 0:h,items:m instanceof et.Name?void 0:m,dynamicProps:h instanceof et.Name,dynamicItems:m instanceof et.Name},f.source&&(f.source.evaluated=(0,et.stringify)(f.evaluated))}return e.validate=f,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)}}Ke.compileSchema=Ou;function Zz(e,t,r){var n;r=(0,tt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=Lz.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new Gr({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=Mz.call(this,s)}Ke.resolveRef=Zz;function Mz(e){return(0,tt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Ou.call(this,e)}function ky(e){for(let t of this._compilations)if(Dz(t,e))return t}Ke.getCompilingSchema=ky;function Dz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Lz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||si.call(this,e,t)}function si(e,t){let r=this.opts.uriResolver.parse(t),n=(0,tt._getFullPath)(this.opts.uriResolver,r),o=(0,tt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Tu.call(this,r,e);let s=(0,tt.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=si.call(this,e,i);return typeof a?.schema!="object"?void 0:Tu.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Ou.call(this,i),s===(0,tt.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,tt.resolveUrl)(this.opts.uriResolver,o,u)),new Gr({schema:a,schemaId:c,root:e,baseId:o})}return Tu.call(this,r,i)}}Ke.resolveSchema=si;var Uz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Tu(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,zy.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Uz.has(a)&&u&&(t=(0,tt.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,zy.schemaHasRulesButRef)(r,this.RULES)){let a=(0,tt.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=si.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Gr({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var Py=k((s4,qz)=>{qz.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 ju=k((i4,Cy)=>{"use strict";var Fz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Au=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),Vz=RegExp.prototype.test.bind(/^\d*$/u),lr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Iu=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Ty=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Cu=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Bz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ze=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ze[t]="%"+e[t>>4]+e[t&15]}function ke(e){return e<2048?Ze[192|e>>6]+Ze[128|e&63]:e<65536?Ze[224|e>>12]+Ze[128|e>>6&63]+Ze[128|e&63]:Ze[240|e>>18]+Ze[128|e>>12&63]+Ze[128|e>>6&63]+Ze[128|e&63]}function Hz(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Kz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Jz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Wz=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Gz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Xz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Wz(e[t])){if(e[t]==="%"&&t+2<e.length&&lr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function Ey(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)e[a]==="0"?(n===-1&&(n=a),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function Yz(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!Au(c))return;s+=2;continue}if(!Kz(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:Ey(o);if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return Ey(i)}function Ru(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&Jz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Qz(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!Xz(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=Yz(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function Qz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function ek(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===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(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var tk={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},rk=/[@/?#:]/g,nk=/[@/?#]/g;function Oy(e,t){let r=t?nk:rk;return r.lastIndex=0,e.replace(r,n=>tk[n])}function Ry(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(lr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&Iu(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function ok(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(lr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&Iu(i)?t+=i:t+="%"+s,r+=2;continue}}if(Ty(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Iy(o)?n:Ze[o];else if(o<55296||o>57343)t+=ke(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=ke(65536+(o-55296<<10)+(s-56320)),r++):t+=ke(65533)}else t+=ke(65533)}}return t}function sk(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(lr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/"&&(n=!1),Ty(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Ze[i];else if(i<55296||i>57343)r+=ke(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=ke(65536+(i-55296<<10)+(a-56320)),o++):r+=ke(65533)}else r+=ke(65533)}}return r}function Nu(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(lr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Ze[s];else if(s<55296||s>57343)r+=ke(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=ke(65536+(s-55296<<10)+(i-56320)),n++):r+=ke(65533)}else r+=ke(65533)}}return r}function Ay(e){return Nu(e,Bz)}function ik(e){return Nu(e,Cu)}function ak(e){return Nu(e,Cu)}function Iy(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function ck(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(lr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));Iu(i)?t+=i:t+="%"+s,r+=2;continue}}if(Cu(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Iy(o)?n:Ze[o];else if(o<55296||o>57343)t+=ke(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=ke(65536+(o-55296<<10)+(s-56320)),r++):t+=ke(65533)}else t+=ke(65533)}}return t}function uk(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(lr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function lk(e){let t=[];if(e.userinfo!==void 0&&(t.push(Ay(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!Au(r)){let n=Ru(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=Ry(r,!0),n=Ru(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=Oy(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Vz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}Cy.exports={nonSimpleDomain:Gz,recomposeAuthority:lk,reescapeHostDelimiters:Oy,normalizePercentEncoding:Ry,normalizePathEncoding:ok,serializePathEncoding:sk,normalizeQueryFragmentEncoding:ck,encodeUserinfo:Ay,encodeQuery:ik,encodeFragment:ak,escapePreservingEscapes:uk,removeDotSegments:ek,isIPv4:Au,isUUID:Fz,normalizeIPv6:Ru,stringArrayToHexStripped:Hz}});var Dy=k((a4,My)=>{"use strict";var{isUUID:dk}=ju(),fk=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,pk=["http","https","ws","wss","urn","urn:uuid"];function hk(e){return pk.indexOf(e)!==-1}function Zu(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 Ny(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function jy(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 mk(e){return e.secure=Zu(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function gk(e){if((e.port===(Zu(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=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function yk(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(fk);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=Mu(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function _k(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=Mu(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function bk(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!dk(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function wk(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Zy={scheme:"http",domainHost:!0,parse:Ny,serialize:jy},xk={scheme:"https",domainHost:Zy.domainHost,parse:Ny,serialize:jy},ai={scheme:"ws",domainHost:!0,parse:mk,serialize:gk},vk={scheme:"wss",domainHost:ai.domainHost,parse:ai.parse,serialize:ai.serialize},$k={scheme:"urn",parse:yk,serialize:_k,skipNormalize:!0},Sk={scheme:"urn:uuid",parse:bk,serialize:wk,skipNormalize:!0},ci={http:Zy,https:xk,ws:ai,wss:vk,urn:$k,"urn:uuid":Sk};Object.setPrototypeOf(ci,null);function Mu(e){return e&&(ci[e]||ci[e.toLowerCase()])||void 0}My.exports={wsIsSecure:Zu,SCHEMES:ci,isValidSchemeName:hk,getSchemeHandler:Mu}});var Yy=k((c4,di)=>{"use strict";var{normalizeIPv6:Vy,removeDotSegments:no,recomposeAuthority:zk,normalizePercentEncoding:Du,normalizePathEncoding:kk,serializePathEncoding:Ly,normalizeQueryFragmentEncoding:Uy,encodeQuery:Pk,encodeFragment:Ek,reescapeHostDelimiters:Tk,isIPv4:By,nonSimpleDomain:Ok}=ju(),{SCHEMES:Hy,getSchemeHandler:Lu}=Dy(),Ky=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Jy="URI scheme is malformed.";function qy(e){let t=unescape(String(e));if(!Ky.test(t))throw new TypeError(Jy);return t}function Rk(e,t){return typeof e=="string"?e=Dk(e,t):typeof e=="object"&&(e=li(dr(e,t),t)),e}function Ak(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=ui(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:h,malformedScheme:m}=ui(t,n);if(s||d||i||p||a||f||c||h||u||m)throw new Error(o.error||l.error||"URI is malformed.");let y=Wy(o,l,n,!0),w=Lu(r&&r.scheme||y.scheme),v=y.host,z=v!==void 0&&v!==""&&(By(v)||Vy(v).isIPV6);Gy(y,r||{},w,z);let A=v&&v.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(v);if(y.error&&!A)throw new Error(y.error);return n.skipEscape=!0,dr(y,n)}function Wy(e,t,r,n){let o={};return n||(e=li(dr(e,r),r),t=li(dr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=no(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=no(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=no(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=no(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function Ik(e,t,r){let n=Fy(e,r),o=Fy(t,r);return n!==void 0&&o!==void 0&&n===o}function dr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=qy(r.scheme));let s=Lu(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(n.skipEscape?r.path=Du(r.path):r.path=Ly(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=qy(r.scheme),o.push(r.scheme,":"));let c=zk(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(u=no(u)),a&&(u=Ly(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",Pk(r.query)),r.fragment!==void 0&&o.push("#",Ek(r.fragment)),o.join("")}var Ck=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Nk=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,jk=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Zk(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 ro(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Uu(e){return e[0]==="["&&e[e.length-1]==="]"}function Mk(e){let t=e[4];return ro(e[3])||t!==void 0&&!Uu(t)&&ro(t)||ro(e[6])||ro(e[7])||ro(e[8])}function Gy(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Uu(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&Ok(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function ui(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(Nk);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let p=e.match(jk);if(p!==null){let h=p[1],m=h.replace(/[\t\n\r]/g,"");m.length>=2&&(m.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):h.length!==m.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let f=e.match(Ck);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let y=unescape(n.scheme);Ky.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||Jy,u=!0)}s=Mk(f),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let h=Zk(n,f);if(h!==void 0&&(n.error=n.error||h,o=!0),n.host)if(By(n.host)===!1){let w=Uu(n.host),v=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,z=Vy(n.host);l=z.isIPV6||z.isIPVFuture===!0,c=v&&(!w||z.error===!0),n.host=l?z.host:z.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else l=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let m=Lu(r.scheme||n.scheme);if(c||(a=Gy(n,r,m,l)),e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:Du(n.host,!0);l||(y=Du(y.toLowerCase())),n.host=Tk(y,l)}(!m||m&&!m.skipNormalize)&&(n.path&&(n.path=kk(n.path)),n.query&&(n.query=Uy(n.query)),n.fragment&&(n.fragment=Uy(n.fragment))),m&&m.parse&&(m.parse(n,r),m===Hy.urn&&n.nid===void 0&&(i=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function li(e,t){return ui(e,t).parsed}function Dk(e,t){return Xy(e,t).normalized}function Xy(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=ui(e,t);return{normalized:n||o||s||i||a?e:dr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function Fy(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:dr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=Xy(r,t);return o||s||i||a||c?void 0:n}var qu={SCHEMES:Hy,normalize:Rk,resolve:Ak,resolveComponent:Wy,equal:Ik,serialize:dr,parse:li};di.exports=qu;di.exports.default=qu;di.exports.fastUri=qu});var e_=k(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});var Qy=Yy();Qy.code='require("ajv/dist/runtime/uri").default';Fu.default=Qy});var c_=k(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.CodeGen=we.Name=we.nil=we.stringify=we.str=we._=we.KeywordCxt=void 0;var Lk=eo();Object.defineProperty(we,"KeywordCxt",{enumerable:!0,get:function(){return Lk.KeywordCxt}});var Xr=M();Object.defineProperty(we,"_",{enumerable:!0,get:function(){return Xr._}});Object.defineProperty(we,"str",{enumerable:!0,get:function(){return Xr.str}});Object.defineProperty(we,"stringify",{enumerable:!0,get:function(){return Xr.stringify}});Object.defineProperty(we,"nil",{enumerable:!0,get:function(){return Xr.nil}});Object.defineProperty(we,"Name",{enumerable:!0,get:function(){return Xr.Name}});Object.defineProperty(we,"CodeGen",{enumerable:!0,get:function(){return Xr.CodeGen}});var Uk=oi(),s_=to(),qk=du(),oo=ii(),Fk=M(),so=Xn(),fi=Gn(),Bu=q(),t_=Py(),Vk=e_(),i_=(e,t)=>new RegExp(e,t);i_.code="new RegExp";var Bk=["removeAdditional","useDefaults","coerceTypes"],Hk=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Kk={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."},Jk={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},r_=200;function Wk(e){var t,r,n,o,s,i,a,c,u,l,d,p,f,h,m,y,w,v,z,A,b,x,T,K,Z;let oe=e.strict,ft=(t=e.code)===null||t===void 0?void 0:t.optimize,Yt=ft===!0||ft===void 0?1:ft||0,vr=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:i_,Tt=(o=e.uriResolver)!==null&&o!==void 0?o:Vk.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:oe)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:oe)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:oe)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:oe)!==null&&p!==void 0?p:"log",strictRequired:(h=(f=e.strictRequired)!==null&&f!==void 0?f:oe)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:Yt,regExp:vr}:{optimize:Yt,regExp:vr},loopRequired:(m=e.loopRequired)!==null&&m!==void 0?m:r_,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:r_,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(v=e.messages)!==null&&v!==void 0?v:!0,inlineRefs:(z=e.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(A=e.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(b=e.addUsedSchema)!==null&&b!==void 0?b:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:(T=e.validateFormats)!==null&&T!==void 0?T:!0,unicodeRegExp:(K=e.unicodeRegExp)!==null&&K!==void 0?K:!0,int32range:(Z=e.int32range)!==null&&Z!==void 0?Z:!0,uriResolver:Tt}}var io=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,...Wk(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new Fk.ValueScope({scope:{},prefixes:Hk,es5:r,lines:n}),this.logger=t1(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,qk.getRules)(),n_.call(this,Kk,t,"NOT SUPPORTED"),n_.call(this,Jk,t,"DEPRECATED","warn"),this._metaOpts=Qk.call(this),t.formats&&Xk.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Yk.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Gk.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=t_;n==="id"&&(o={...t_},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof s_.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]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);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,so.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=o_.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new oo.SchemaEnv({schema:{},schemaId:n});if(r=oo.resolveSchema.call(this,o,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=o_.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,so.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(n1.call(this,n,r),!r)return(0,Bu.eachItem)(n,s=>Vu.call(this,s)),this;s1.call(this,r);let o={...r,type:(0,fi.getJSONTypes)(r.type),schemaType:(0,fi.getJSONTypes)(r.schemaType)};return(0,Bu.eachItem)(n,o.type.length===0?s=>Vu.call(this,s,o):s=>o.type.forEach(i=>Vu.call(this,s,o,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 n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=a_(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=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;n=(0,so.normalizeId)(i||n);let u=so.getSchemaRefs.call(this,t,n);return c=new oo.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&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):oo.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{oo.compileSchema.call(this,t)}finally{this.opts=r}}};io.ValidationError=Uk.default;io.MissingRefError=s_.default;we.default=io;function n_(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function o_(e){return e=(0,so.normalizeId)(e),this.schemas[e]||this.refs[e]}function Gk(){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 Xk(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Yk(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 Qk(){let e={...this.opts};for(let t of Bk)delete e[t];return e}var e1={log(){},warn(){},error(){}};function t1(e){if(e===!1)return e1;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 r1=/^[a-z_$][a-z0-9_$:-]*$/i;function n1(e,t){let{RULES:r}=this;if((0,Bu.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!r1.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Vu(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?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,fi.getJSONTypes)(t.type),schemaType:(0,fi.getJSONTypes)(t.schemaType)}};t.before?o1.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function o1(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function s1(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=a_(t)),e.validateSchema=this.compile(t,!0))}var i1={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function a_(e){return{anyOf:[e,i1]}}});var u_=k(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});var a1={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Hu.default=a1});var p_=k(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.callRef=fr.getValidate=void 0;var c1=to(),l_=He(),Me=M(),Yr=St(),d_=ii(),pi=q(),u1={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=d_.resolveRef.call(c,u,o,r);if(l===void 0)throw new c1.default(n.opts.uriResolver,o,r);if(l instanceof d_.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return hi(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return hi(e,(0,Me._)`${h}.validate`,u,u.$async)}function p(h){let m=f_(e,h);hi(e,m,h,h.$async)}function f(h){let m=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Me.stringify)(h)}:{ref:h}),y=t.name("valid"),w=e.subschema({schema:h,dataTypes:[],schemaPath:Me.nil,topSchemaRef:m,errSchemaPath:r},y);e.mergeEvaluated(w),e.ok(y)}}};function f_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Me._)`${r.scopeValue("wrapper",{ref:t})}.validate`}fr.getValidate=f_;function hi(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Yr.default.this:Me.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Me._)`await ${(0,l_.callValidateCode)(e,t,u)}`),f(t),i||o.assign(h,!0)},m=>{o.if((0,Me._)`!(${m} instanceof ${s.ValidationError})`,()=>o.throw(m)),p(m),i||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,l_.callValidateCode)(e,t,u),()=>f(t),()=>p(t))}function p(h){let m=(0,Me._)`${h}.errors`;o.assign(Yr.default.vErrors,(0,Me._)`${Yr.default.vErrors} === null ? ${m} : ${Yr.default.vErrors}.concat(${m})`),o.assign(Yr.default.errors,(0,Me._)`${Yr.default.vErrors}.length`)}function f(h){var m;if(!s.opts.unevaluated)return;let y=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=pi.mergeEvaluated.props(o,y.props,s.props));else{let w=o.var("props",(0,Me._)`${h}.evaluated.props`);s.props=pi.mergeEvaluated.props(o,w,s.props,Me.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=pi.mergeEvaluated.items(o,y.items,s.items));else{let w=o.var("items",(0,Me._)`${h}.evaluated.items`);s.items=pi.mergeEvaluated.items(o,w,s.items,Me.Name)}}}fr.callRef=hi;fr.default=u1});var h_=k(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var l1=u_(),d1=p_(),f1=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",l1.default,d1.default];Ku.default=f1});var m_=k(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});var mi=M(),Ht=mi.operators,gi={maximum:{okStr:"<=",ok:Ht.LTE,fail:Ht.GT},minimum:{okStr:">=",ok:Ht.GTE,fail:Ht.LT},exclusiveMaximum:{okStr:"<",ok:Ht.LT,fail:Ht.GTE},exclusiveMinimum:{okStr:">",ok:Ht.GT,fail:Ht.LTE}},p1={message:({keyword:e,schemaCode:t})=>(0,mi.str)`must be ${gi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,mi._)`{comparison: ${gi[e].okStr}, limit: ${t}}`},h1={keyword:Object.keys(gi),type:"number",schemaType:"number",$data:!0,error:p1,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,mi._)`${r} ${gi[t].fail} ${n} || isNaN(${r})`)}};Ju.default=h1});var g_=k(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});var ao=M(),m1={message:({schemaCode:e})=>(0,ao.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ao._)`{multipleOf: ${e}}`},g1={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:m1,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,ao._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,ao._)`${i} !== parseInt(${i})`;e.fail$data((0,ao._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Wu.default=g1});var __=k(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});function y_(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}Gu.default=y_;y_.code='require("ajv/dist/runtime/ucs2length").default'});var b_=k(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});var pr=M(),y1=q(),_1=__(),b1={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,pr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,pr._)`{limit: ${e}}`},w1={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:b1,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?pr.operators.GT:pr.operators.LT,i=o.opts.unicode===!1?(0,pr._)`${r}.length`:(0,pr._)`${(0,y1.useFunc)(e.gen,_1.default)}(${r})`;e.fail$data((0,pr._)`${i} ${s} ${n}`)}};Xu.default=w1});var w_=k(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});var x1=He(),v1=q(),Qr=M(),$1={message:({schemaCode:e})=>(0,Qr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Qr._)`{pattern: ${e}}`},S1={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:$1,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Qr._)`new RegExp`:(0,v1.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,Qr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,Qr._)`!${l}`)}else{let c=(0,x1.usePattern)(e,o);e.fail$data((0,Qr._)`!${c}.test(${r})`)}}};Yu.default=S1});var x_=k(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});var co=M(),z1={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,co.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,co._)`{limit: ${e}}`},k1={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:z1,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?co.operators.GT:co.operators.LT;e.fail$data((0,co._)`Object.keys(${r}).length ${o} ${n}`)}};Qu.default=k1});var v_=k(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});var uo=He(),lo=M(),P1=q(),E1={message:({params:{missingProperty:e}})=>(0,lo.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,lo._)`{missingProperty: ${e}}`},T1={keyword:"required",type:"object",schemaType:"array",$data:!0,error:E1,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$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 f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let m of r)if(f?.[m]===void 0&&!h.has(m)){let y=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${m}" is not defined at "${y}" (strictRequired)`;(0,P1.checkStrictMode)(i,w,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(lo.nil,d);else for(let f of r)(0,uo.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>p(f,h)),e.ok(h)}else t.if((0,uo.checkMissingProp)(e,r,f)),(0,uo.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,uo.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function p(f,h){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(h,(0,uo.propertyInData)(t,o,f,a.ownProperties)),t.if((0,lo.not)(h),()=>{e.error(),t.break()})},lo.nil)}}};el.default=T1});var $_=k(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});var fo=M(),O1={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,fo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,fo._)`{limit: ${e}}`},R1={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:O1,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?fo.operators.GT:fo.operators.LT;e.fail$data((0,fo._)`${r}.length ${o} ${n}`)}};tl.default=R1});var yi=k(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});var S_=bu();S_.code='require("ajv/dist/runtime/equal").default';rl.default=S_});var z_=k(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});var nl=Gn(),xe=M(),A1=q(),I1=yi(),C1={message:({params:{i:e,j:t}})=>(0,xe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,xe._)`{i: ${e}, j: ${t}}`},N1={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:C1,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?(0,nl.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,xe._)`${i} === false`),e.ok(c);function l(){let h=t.let("i",(0,xe._)`${r}.length`),m=t.let("j");e.setParams({i:h,j:m}),t.assign(c,!0),t.if((0,xe._)`${h} > 1`,()=>(d()?p:f)(h,m))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,m){let y=t.name("item"),w=(0,nl.checkDataTypes)(u,y,a.opts.strictNumbers,nl.DataType.Wrong),v=t.const("indices",(0,xe._)`{}`);t.for((0,xe._)`;${h}--;`,()=>{t.let(y,(0,xe._)`${r}[${h}]`),t.if(w,(0,xe._)`continue`),u.length>1&&t.if((0,xe._)`typeof ${y} == "string"`,(0,xe._)`${y} += "_"`),t.if((0,xe._)`typeof ${v}[${y}] == "number"`,()=>{t.assign(m,(0,xe._)`${v}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,xe._)`${v}[${y}] = ${h}`)})}function f(h,m){let y=(0,A1.useFunc)(t,I1.default),w=t.name("outer");t.label(w).for((0,xe._)`;${h}--;`,()=>t.for((0,xe._)`${m} = ${h}; ${m}--;`,()=>t.if((0,xe._)`${y}(${r}[${h}], ${r}[${m}])`,()=>{e.error(),t.assign(c,!1).break(w)})))}}};ol.default=N1});var k_=k(il=>{"use strict";Object.defineProperty(il,"__esModule",{value:!0});var sl=M(),j1=q(),Z1=yi(),M1={message:"must be equal to constant",params:({schemaCode:e})=>(0,sl._)`{allowedValue: ${e}}`},D1={keyword:"const",$data:!0,error:M1,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,sl._)`!${(0,j1.useFunc)(t,Z1.default)}(${r}, ${o})`):e.fail((0,sl._)`${s} !== ${r}`)}};il.default=D1});var P_=k(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});var po=M(),L1=q(),U1=yi(),q1={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,po._)`{allowedValues: ${e}}`},F1={keyword:"enum",schemaType:"array",$data:!0,error:q1,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,L1.useFunc)(t,U1.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,po.or)(...o.map((h,m)=>p(f,m)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,po._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,h){let m=o[h];return typeof m=="object"&&m!==null?(0,po._)`${u()}(${r}, ${f}[${h}])`:(0,po._)`${r} === ${m}`}}};al.default=F1});var E_=k(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});var V1=m_(),B1=g_(),H1=b_(),K1=w_(),J1=x_(),W1=v_(),G1=$_(),X1=z_(),Y1=k_(),Q1=P_(),eP=[V1.default,B1.default,H1.default,K1.default,J1.default,W1.default,G1.default,X1.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Y1.default,Q1.default];cl.default=eP});var ll=k(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.validateAdditionalItems=void 0;var hr=M(),ul=q(),tP={message:({params:{len:e}})=>(0,hr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,hr._)`{limit: ${e}}`},rP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:tP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,ul.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}T_(e,n)}};function T_(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,hr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,hr._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,ul.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,hr._)`${a} <= ${t.length}`);r.if((0,hr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:ul.Type.Num},u),i.allErrors||r.if((0,hr.not)(u),()=>r.break())})}}ho.validateAdditionalItems=T_;ho.default=rP});var dl=k(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.validateTuple=void 0;var O_=M(),_i=q(),nP=He(),oP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return R_(e,"additionalItems",t);r.items=!0,!(0,_i.alwaysValidSchema)(r,t)&&e.ok((0,nP.validateArray)(e))}};function R_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=_i.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,O_._)`${s}.length`);r.forEach((d,p)=>{(0,_i.alwaysValidSchema)(a,d)||(n.if((0,O_._)`${u} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,h=r.length,m=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(p.strictTuples&&!m){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,_i.checkStrictMode)(a,y,p.strictTuples)}}}mo.validateTuple=R_;mo.default=oP});var A_=k(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});var sP=dl(),iP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,sP.validateTuple)(e,"items")};fl.default=iP});var C_=k(pl=>{"use strict";Object.defineProperty(pl,"__esModule",{value:!0});var I_=M(),aP=q(),cP=He(),uP=ll(),lP={message:({params:{len:e}})=>(0,I_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,I_._)`{limit: ${e}}`},dP={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:lP,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,aP.alwaysValidSchema)(n,t)&&(o?(0,uP.validateAdditionalItems)(e,o):e.ok((0,cP.validateArray)(e)))}};pl.default=dP});var N_=k(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});var Je=M(),bi=q(),fP={message:({params:{min:e,max:t}})=>t===void 0?(0,Je.str)`must contain at least ${e} valid item(s)`:(0,Je.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Je._)`{minContains: ${e}}`:(0,Je._)`{minContains: ${e}, maxContains: ${t}}`},pP={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:fP,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,Je._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,bi.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,bi.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,bi.alwaysValidSchema)(s,r)){let m=(0,Je._)`${l} >= ${i}`;a!==void 0&&(m=(0,Je._)`${m} && ${l} <= ${a}`),e.pass(m);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?f(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,Je._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let m=t.name("_valid"),y=t.let("count",0);f(m,()=>t.if(m,()=>h(y)))}function f(m,y){t.forRange("i",0,l,w=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:bi.Type.Num,compositeRule:!0},m),y()})}function h(m){t.code((0,Je._)`${m}++`),a===void 0?t.if((0,Je._)`${m} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,Je._)`${m} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,Je._)`${m} >= ${i}`,()=>t.assign(d,!0)))}}};hl.default=pP});var M_=k(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.validateSchemaDeps=at.validatePropertyDeps=at.error=void 0;var ml=M(),hP=q(),go=He();at.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,ml.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,ml._)`{property: ${e},
|
|
3
|
+
var Zb=Object.create;var ia=Object.defineProperty;var Db=Object.getOwnPropertyDescriptor;var Mb=Object.getOwnPropertyNames;var Lb=Object.getPrototypeOf,Ub=Object.prototype.hasOwnProperty;var E=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},aa=(e,t)=>{for(var r in t)ia(e,r,{get:t[r],enumerable:!0})},qb=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Mb(t))!Ub.call(e,o)&&o!==r&&ia(e,o,{get:()=>t[o],enumerable:!(n=Db(t,o))||n.enumerable});return e};var ca=(e,t,r)=>(r=e!=null?Zb(Lb(e)):{},qb(t||!e||!e.__esModule?ia(r,"default",{value:e,enumerable:!0}):r,e));var so=E(J=>{"use strict";Object.defineProperty(J,"__esModule",{value:!0});J.regexpCode=J.getEsmExportName=J.getProperty=J.safeStringify=J.stringify=J.strConcat=J.addCodeArg=J.str=J._=J.nil=J._Code=J.Name=J.IDENTIFIER=J._CodeOrName=void 0;var no=class{};J._CodeOrName=no;J.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var lr=class extends no{constructor(t){if(super(),!J.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}}};J.Name=lr;var Je=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,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof lr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};J._Code=Je;J.nil=new Je("");function iy(e,...t){let r=[e[0]],n=0;for(;n<t.length;)pu(r,t[n]),r.push(e[++n]);return new Je(r)}J._=iy;var fu=new Je("+");function ay(e,...t){let r=[oo(e[0])],n=0;for(;n<t.length;)r.push(fu),pu(r,t[n]),r.push(fu,oo(e[++n]));return yS(r),new Je(r)}J.str=ay;function pu(e,t){t instanceof Je?e.push(...t._items):t instanceof lr?e.push(t):e.push(wS(t))}J.addCodeArg=pu;function yS(e){let t=1;for(;t<e.length-1;){if(e[t]===fu){let r=_S(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function _S(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof lr||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 lr))return`"${e}${t.slice(1)}`}function bS(e,t){return t.emptyStr()?e:e.emptyStr()?t:ay`${e}${t}`}J.strConcat=bS;function wS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:oo(Array.isArray(e)?e.join(","):e)}function xS(e){return new Je(oo(e))}J.stringify=xS;function oo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}J.safeStringify=oo;function vS(e){return typeof e=="string"&&J.IDENTIFIER.test(e)?new Je(`.${e}`):iy`[${e}]`}J.getProperty=vS;function $S(e){if(typeof e=="string"&&J.IDENTIFIER.test(e))return new Je(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}J.getEsmExportName=$S;function SS(e){return new Je(e.toString())}J.regexpCode=SS});var gu=E(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.ValueScope=De.ValueScopeName=De.Scope=De.varKinds=De.UsedValueState=void 0;var Ze=so(),hu=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},li;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(li||(De.UsedValueState=li={}));De.varKinds={const:new Ze.Name("const"),let:new Ze.Name("let"),var:new Ze.Name("var")};var di=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Ze.Name?t:this.name(t)}name(t){return new Ze.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};De.Scope=di;var fi=class extends Ze.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Ze._)`.${new Ze.Name(r)}[${n}]`}};De.ValueScopeName=fi;var zS=(0,Ze._)`\n`,mu=class extends di{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?zS:Ze.nil}}get(){return this._scope}name(t){return new fi(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ze._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=Ze.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,li.Started);let l=r(u);if(l){let d=this.opts.es5?De.varKinds.var:De.varKinds.const;s=(0,Ze._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Ze._)`${s}${l}${this.opts._n}`;else throw new hu(u);c.set(u,li.Completed)})}return s}};De.ValueScope=mu});var L=E(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.or=U.and=U.not=U.CodeGen=U.operators=U.varKinds=U.ValueScopeName=U.ValueScope=U.Scope=U.Name=U.regexpCode=U.stringify=U.getProperty=U.nil=U.strConcat=U.str=U._=void 0;var F=so(),nt=gu(),Ht=so();Object.defineProperty(U,"_",{enumerable:!0,get:function(){return Ht._}});Object.defineProperty(U,"str",{enumerable:!0,get:function(){return Ht.str}});Object.defineProperty(U,"strConcat",{enumerable:!0,get:function(){return Ht.strConcat}});Object.defineProperty(U,"nil",{enumerable:!0,get:function(){return Ht.nil}});Object.defineProperty(U,"getProperty",{enumerable:!0,get:function(){return Ht.getProperty}});Object.defineProperty(U,"stringify",{enumerable:!0,get:function(){return Ht.stringify}});Object.defineProperty(U,"regexpCode",{enumerable:!0,get:function(){return Ht.regexpCode}});Object.defineProperty(U,"Name",{enumerable:!0,get:function(){return Ht.Name}});var gi=gu();Object.defineProperty(U,"Scope",{enumerable:!0,get:function(){return gi.Scope}});Object.defineProperty(U,"ValueScope",{enumerable:!0,get:function(){return gi.ValueScope}});Object.defineProperty(U,"ValueScopeName",{enumerable:!0,get:function(){return gi.ValueScopeName}});Object.defineProperty(U,"varKinds",{enumerable:!0,get:function(){return gi.varKinds}});U.operators={GT:new F._Code(">"),GTE:new F._Code(">="),LT:new F._Code("<"),LTE:new F._Code("<="),EQ:new F._Code("==="),NEQ:new F._Code("!=="),NOT:new F._Code("!"),OR:new F._Code("||"),AND:new F._Code("&&"),ADD:new F._Code("+")};var Et=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},yu=class extends Et{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?nt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=en(this.rhs,t,r)),this}get names(){return this.rhs instanceof F._CodeOrName?this.rhs.names:{}}},pi=class extends Et{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof F.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=en(this.rhs,t,r),this}get names(){let t=this.lhs instanceof F.Name?{}:{...this.lhs.names};return mi(t,this.rhs)}},_u=class extends pi{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},bu=class extends Et{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},wu=class extends Et{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xu=class extends Et{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},vu=class extends Et{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=en(this.code,t,r),this}get names(){return this.code instanceof F._CodeOrName?this.code.names:{}}},io=class extends Et{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(kS(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>pr(t,r.names),{})}},Tt=class extends io{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},$u=class extends io{},Qr=class extends Tt{};Qr.kind="else";var dr=class e extends Tt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Qr(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(cy(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=en(this.condition,t,r),this}get names(){let t=super.names;return mi(t,this.condition),this.else&&pr(t,this.else.names),t}};dr.kind="if";var fr=class extends Tt{};fr.kind="for";var Su=class extends fr{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=en(this.iteration,t,r),this}get names(){return pr(super.names,this.iteration.names)}},zu=class extends fr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?nt.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=mi(super.names,this.from);return mi(t,this.to)}},hi=class extends fr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}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=en(this.iterable,t,r),this}get names(){return pr(super.names,this.iterable.names)}},ao=class extends Tt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};ao.kind="func";var co=class extends io{render(t){return"return "+super.render(t)}};co.kind="return";var ku=class extends Tt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&pr(t,this.catch.names),this.finally&&pr(t,this.finally.names),t}},uo=class extends Tt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};uo.kind="catch";var lo=class extends Tt{render(t){return"finally"+super.render(t)}};lo.kind="finally";var Pu=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
+
`:""},this._extScope=t,this._scope=new nt.Scope({parent:t}),this._nodes=[new $u]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new yu(t,s,n)),s}const(t,r,n){return this._def(nt.varKinds.const,t,r,n)}let(t,r,n){return this._def(nt.varKinds.let,t,r,n)}var(t,r,n){return this._def(nt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new pi(t,r,n))}add(t,r){return this._leafNode(new _u(t,U.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==F.nil&&this._leafNode(new vu(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,F.addCodeArg)(r,o));return r.push("}"),new F._Code(r)}if(t,r,n){if(this._blockNode(new dr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new dr(t))}else(){return this._elseNode(new Qr)}endIf(){return this._endBlockNode(dr,Qr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Su(t),r)}forRange(t,r,n,o,s=this.opts.es5?nt.varKinds.var:nt.varKinds.let){let i=this._scope.toName(t);return this._for(new zu(s,i,r,n),()=>o(i))}forOf(t,r,n,o=nt.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof F.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,F._)`${i}.length`,a=>{this.var(s,(0,F._)`${i}[${a}]`),n(s)})}return this._for(new hi("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?nt.varKinds.var:nt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,F._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new hi("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(fr)}label(t){return this._leafNode(new bu(t))}break(t){return this._leafNode(new wu(t))}return(t){let r=new co;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(co)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new ku;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new uo(s),r(s)}return n&&(this._currNode=o.finally=new lo,this.code(n)),this._endBlockNode(uo,lo)}throw(t){return this._leafNode(new xu(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=F.nil,n,o){return this._blockNode(new ao(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ao)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof dr))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}};U.CodeGen=Pu;function pr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function mi(e,t){return t instanceof F._CodeOrName?pr(e,t.names):e}function en(e,t,r){if(e instanceof F.Name)return n(e);if(!o(e))return e;return new F._Code(e._items.reduce((s,i)=>(i instanceof F.Name&&(i=n(i)),i instanceof F._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof F._Code&&s._items.some(i=>i instanceof F.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function kS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function cy(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,F._)`!${Eu(e)}`}U.not=cy;var PS=uy(U.operators.AND);function ES(...e){return e.reduce(PS)}U.and=ES;var TS=uy(U.operators.OR);function OS(...e){return e.reduce(TS)}U.or=OS;function uy(e){return(t,r)=>t===F.nil?r:r===F.nil?t:(0,F._)`${Eu(t)} ${e} ${Eu(r)}`}function Eu(e){return e instanceof F.Name?e:(0,F._)`(${e})`}});var B=E(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 Q=L(),RS=so();function AS(e){let t={};for(let r of e)t[r]=!0;return t}q.toHash=AS;function CS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(fy(e,t),!py(t,e.self.RULES.all))}q.alwaysValidSchema=CS;function fy(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||gy(e,`unknown keyword: "${s}"`)}q.checkUnknownRules=fy;function py(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}q.schemaHasRules=py;function IS(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=IS;function NS({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Q._)`${r}`}return(0,Q._)`${e}${t}${(0,Q.getProperty)(n)}`}q.schemaRefOrVal=NS;function jS(e){return hy(decodeURIComponent(e))}q.unescapeFragment=jS;function ZS(e){return encodeURIComponent(Ou(e))}q.escapeFragment=ZS;function Ou(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}q.escapeJsonPointer=Ou;function hy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}q.unescapeJsonPointer=hy;function DS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}q.eachItem=DS;function ly({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof Q.Name?(s instanceof Q.Name?e(o,s,i):t(o,s,i),i):s instanceof Q.Name?(t(o,i,s),s):r(s,i);return a===Q.Name&&!(c instanceof Q.Name)?n(o,c):c}}q.mergeEvaluated={props:ly({mergeNames:(e,t,r)=>e.if((0,Q._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,Q._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,Q._)`${r} || {}`).code((0,Q._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,Q._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,Q._)`${r} || {}`),Ru(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:my}),items:ly({mergeNames:(e,t,r)=>e.if((0,Q._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,Q._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,Q._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,Q._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function my(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,Q._)`{}`);return t!==void 0&&Ru(e,r,t),r}q.evaluatedPropsToName=my;function Ru(e,t,r){Object.keys(r).forEach(n=>e.assign((0,Q._)`${t}${(0,Q.getProperty)(n)}`,!0))}q.setEvaluated=Ru;var dy={};function MS(e,t){return e.scopeValue("func",{ref:t,code:dy[t.code]||(dy[t.code]=new RS._Code(t.code))})}q.useFunc=MS;var Tu;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Tu||(q.Type=Tu={}));function LS(e,t,r){if(e instanceof Q.Name){let n=t===Tu.Num;return r?n?(0,Q._)`"[" + ${e} + "]"`:(0,Q._)`"['" + ${e} + "']"`:n?(0,Q._)`"/" + ${e}`:(0,Q._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Q.getProperty)(e).toString():"/"+Ou(e)}q.getErrorPath=LS;function gy(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=gy});var Ot=E(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});var ke=L(),US={data:new ke.Name("data"),valCxt:new ke.Name("valCxt"),instancePath:new ke.Name("instancePath"),parentData:new ke.Name("parentData"),parentDataProperty:new ke.Name("parentDataProperty"),rootData:new ke.Name("rootData"),dynamicAnchors:new ke.Name("dynamicAnchors"),vErrors:new ke.Name("vErrors"),errors:new ke.Name("errors"),this:new ke.Name("this"),self:new ke.Name("self"),scope:new ke.Name("scope"),json:new ke.Name("json"),jsonPos:new ke.Name("jsonPos"),jsonLen:new ke.Name("jsonLen"),jsonPart:new ke.Name("jsonPart")};Au.default=US});var fo=E(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.extendErrors=Pe.resetErrorsCount=Pe.reportExtraError=Pe.reportError=Pe.keyword$DataError=Pe.keywordError=void 0;var V=L(),yi=B(),Ae=Ot();Pe.keywordError={message:({keyword:e})=>(0,V.str)`must pass "${e}" keyword validation`};Pe.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,V.str)`"${e}" keyword must be ${t} ($data)`:(0,V.str)`"${e}" keyword is invalid ($data)`};function qS(e,t=Pe.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=by(e,t,r);n??(i||a)?yy(s,c):_y(o,(0,V._)`[${c}]`)}Pe.reportError=qS;function FS(e,t=Pe.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=by(e,t,r);yy(o,a),s||i||_y(n,Ae.default.vErrors)}Pe.reportExtraError=FS;function BS(e,t){e.assign(Ae.default.errors,t),e.if((0,V._)`${Ae.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,V._)`${Ae.default.vErrors}.length`,t),()=>e.assign(Ae.default.vErrors,null)))}Pe.resetErrorsCount=BS;function VS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,Ae.default.errors,a=>{e.const(i,(0,V._)`${Ae.default.vErrors}[${a}]`),e.if((0,V._)`${i}.instancePath === undefined`,()=>e.assign((0,V._)`${i}.instancePath`,(0,V.strConcat)(Ae.default.instancePath,s.errorPath))),e.assign((0,V._)`${i}.schemaPath`,(0,V.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,V._)`${i}.schema`,r),e.assign((0,V._)`${i}.data`,n))})}Pe.extendErrors=VS;function yy(e,t){let r=e.const("err",t);e.if((0,V._)`${Ae.default.vErrors} === null`,()=>e.assign(Ae.default.vErrors,(0,V._)`[${r}]`),(0,V._)`${Ae.default.vErrors}.push(${r})`),e.code((0,V._)`${Ae.default.errors}++`)}function _y(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,V._)`new ${e.ValidationError}(${t})`):(r.assign((0,V._)`${n}.errors`,t),r.return(!1))}var hr={keyword:new V.Name("keyword"),schemaPath:new V.Name("schemaPath"),params:new V.Name("params"),propertyName:new V.Name("propertyName"),message:new V.Name("message"),schema:new V.Name("schema"),parentSchema:new V.Name("parentSchema")};function by(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,V._)`{}`:HS(e,t,r)}function HS(e,t,r={}){let{gen:n,it:o}=e,s=[KS(o,r),JS(e,r)];return WS(e,t,s),n.object(...s)}function KS({errorPath:e},{instancePath:t}){let r=t?(0,V.str)`${e}${(0,yi.getErrorPath)(t,yi.Type.Str)}`:e;return[Ae.default.instancePath,(0,V.strConcat)(Ae.default.instancePath,r)]}function JS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,V.str)`${t}/${e}`;return r&&(o=(0,V.str)`${o}${(0,yi.getErrorPath)(r,yi.Type.Str)}`),[hr.schemaPath,o]}function WS(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([hr.keyword,o],[hr.params,typeof t=="function"?t(e):t||(0,V._)`{}`]),c.messages&&n.push([hr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([hr.schema,i],[hr.parentSchema,(0,V._)`${l}${d}`],[Ae.default.data,s]),u&&n.push([hr.propertyName,u])}});var xy=E(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.boolOrEmptySchema=tn.topBoolOrEmptySchema=void 0;var GS=fo(),XS=L(),YS=Ot(),QS={message:"boolean schema is false"};function ez(e){let{gen:t,schema:r,validateName:n}=e;r===!1?wy(e,!1):typeof r=="object"&&r.$async===!0?t.return(YS.default.data):(t.assign((0,XS._)`${n}.errors`,null),t.return(!0))}tn.topBoolOrEmptySchema=ez;function tz(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),wy(e)):r.var(t,!0)}tn.boolOrEmptySchema=tz;function wy(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,GS.reportError)(o,QS,void 0,t)}});var Cu=E(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.getRules=rn.isJSONType=void 0;var rz=["string","number","integer","boolean","null","object","array"],nz=new Set(rz);function oz(e){return typeof e=="string"&&nz.has(e)}rn.isJSONType=oz;function sz(){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:{}}}rn.getRules=sz});var Iu=E(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.shouldUseRule=Kt.shouldUseGroup=Kt.schemaHasRulesForType=void 0;function iz({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&vy(e,n)}Kt.schemaHasRulesForType=iz;function vy(e,t){return t.rules.some(r=>$y(e,r))}Kt.shouldUseGroup=vy;function $y(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Kt.shouldUseRule=$y});var po=E(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.reportTypeError=Ee.checkDataTypes=Ee.checkDataType=Ee.coerceAndCheckDataType=Ee.getJSONTypes=Ee.getSchemaTypes=Ee.DataType=void 0;var az=Cu(),cz=Iu(),uz=fo(),M=L(),Sy=B(),nn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(nn||(Ee.DataType=nn={}));function lz(e){let t=zy(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}Ee.getSchemaTypes=lz;function zy(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(az.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ee.getJSONTypes=zy;function dz(e,t){let{gen:r,data:n,opts:o}=e,s=fz(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,cz.schemaHasRulesForType)(e,t[0]));if(i){let a=ju(t,n,o.strictNumbers,nn.Wrong);r.if(a,()=>{s.length?pz(e,t,s):Zu(e)})}return i}Ee.coerceAndCheckDataType=dz;var ky=new Set(["string","number","integer","boolean","null"]);function fz(e,t){return t?e.filter(r=>ky.has(r)||t==="array"&&r==="array"):[]}function pz(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,M._)`typeof ${o}`),a=n.let("coerced",(0,M._)`undefined`);s.coerceTypes==="array"&&n.if((0,M._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,M._)`${o}[0]`).assign(i,(0,M._)`typeof ${o}`).if(ju(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,M._)`${a} !== undefined`);for(let u of r)(ky.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Zu(e),n.endIf(),n.if((0,M._)`${a} !== undefined`,()=>{n.assign(o,a),hz(e,a)});function c(u){switch(u){case"string":n.elseIf((0,M._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,M._)`"" + ${o}`).elseIf((0,M._)`${o} === null`).assign(a,(0,M._)`""`);return;case"number":n.elseIf((0,M._)`${i} == "boolean" || ${o} === null
|
|
5
|
+
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,M._)`+${o}`);return;case"integer":n.elseIf((0,M._)`${i} === "boolean" || ${o} === null
|
|
6
|
+
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,M._)`+${o}`);return;case"boolean":n.elseIf((0,M._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,M._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,M._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,M._)`${i} === "string" || ${i} === "number"
|
|
7
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,M._)`[${o}]`)}}}function hz({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,M._)`${t} !== undefined`,()=>e.assign((0,M._)`${t}[${r}]`,n))}function Nu(e,t,r,n=nn.Correct){let o=n===nn.Correct?M.operators.EQ:M.operators.NEQ,s;switch(e){case"null":return(0,M._)`${t} ${o} null`;case"array":s=(0,M._)`Array.isArray(${t})`;break;case"object":s=(0,M._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,M._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,M._)`typeof ${t} ${o} ${e}`}return n===nn.Correct?s:(0,M.not)(s);function i(a=M.nil){return(0,M.and)((0,M._)`typeof ${t} == "number"`,a,r?(0,M._)`isFinite(${t})`:M.nil)}}Ee.checkDataType=Nu;function ju(e,t,r,n){if(e.length===1)return Nu(e[0],t,r,n);let o,s=(0,Sy.toHash)(e);if(s.array&&s.object){let i=(0,M._)`typeof ${t} != "object"`;o=s.null?i:(0,M._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=M.nil;s.number&&delete s.integer;for(let i in s)o=(0,M.and)(o,Nu(i,t,r,n));return o}Ee.checkDataTypes=ju;var mz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,M._)`{type: ${e}}`:(0,M._)`{type: ${t}}`};function Zu(e){let t=gz(e);(0,uz.reportError)(t,mz)}Ee.reportTypeError=Zu;function gz(e){let{gen:t,data:r,schema:n}=e,o=(0,Sy.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Ey=E(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.assignDefaults=void 0;var on=L(),yz=B();function _z(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Py(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Py(e,s,o.default))}_i.assignDefaults=_z;function Py(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,on._)`${s}${(0,on.getProperty)(t)}`;if(o){(0,yz.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,on._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,on._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,on._)`${a} = ${(0,on.stringify)(r)}`)}});var We=E(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.validateUnion=G.validateArray=G.usePattern=G.callValidateCode=G.schemaProperties=G.allSchemaProperties=G.noPropertyInData=G.propertyInData=G.isOwnProperty=G.hasPropFunc=G.reportMissingProp=G.checkMissingProp=G.checkReportMissingProp=void 0;var ne=L(),Du=B(),Jt=Ot(),bz=B();function wz(e,t){let{gen:r,data:n,it:o}=e;r.if(Lu(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ne._)`${t}`},!0),e.error()})}G.checkReportMissingProp=wz;function xz({gen:e,data:t,it:{opts:r}},n,o){return(0,ne.or)(...n.map(s=>(0,ne.and)(Lu(e,t,s,r.ownProperties),(0,ne._)`${o} = ${s}`)))}G.checkMissingProp=xz;function vz(e,t){e.setParams({missingProperty:t},!0),e.error()}G.reportMissingProp=vz;function Ty(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ne._)`Object.prototype.hasOwnProperty`})}G.hasPropFunc=Ty;function Mu(e,t,r){return(0,ne._)`${Ty(e)}.call(${t}, ${r})`}G.isOwnProperty=Mu;function $z(e,t,r,n){let o=(0,ne._)`${t}${(0,ne.getProperty)(r)} !== undefined`;return n?(0,ne._)`${o} && ${Mu(e,t,r)}`:o}G.propertyInData=$z;function Lu(e,t,r,n){let o=(0,ne._)`${t}${(0,ne.getProperty)(r)} === undefined`;return n?(0,ne.or)(o,(0,ne.not)(Mu(e,t,r))):o}G.noPropertyInData=Lu;function Oy(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}G.allSchemaProperties=Oy;function Sz(e,t){return Oy(t).filter(r=>!(0,Du.alwaysValidSchema)(e,t[r]))}G.schemaProperties=Sz;function zz({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,ne._)`${e}, ${t}, ${n}${o}`:t,d=[[Jt.default.instancePath,(0,ne.strConcat)(Jt.default.instancePath,s)],[Jt.default.parentData,i.parentData],[Jt.default.parentDataProperty,i.parentDataProperty],[Jt.default.rootData,Jt.default.rootData]];i.opts.dynamicRef&&d.push([Jt.default.dynamicAnchors,Jt.default.dynamicAnchors]);let p=(0,ne._)`${l}, ${r.object(...d)}`;return c!==ne.nil?(0,ne._)`${a}.call(${c}, ${p})`:(0,ne._)`${a}(${p})`}G.callValidateCode=zz;var kz=(0,ne._)`new RegExp`;function Pz({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ne._)`${o.code==="new RegExp"?kz:(0,bz.useFunc)(e,o)}(${r}, ${n})`})}G.usePattern=Pz;function Ez(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.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,ne._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Du.Type.Num},s),t.if((0,ne.not)(s),a)})}}G.validateArray=Ez;function Tz(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Du.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,ne._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,ne.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}G.validateUnion=Tz});var Cy=E(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.validateKeywordUsage=ft.validSchemaType=ft.funcKeywordCode=ft.macroKeywordCode=void 0;var Ce=L(),mr=Ot(),Oz=We(),Rz=fo();function Az(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Ay(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:Ce.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}ft.macroKeywordCode=Az;function Cz(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;Nz(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Ay(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)m(),t.modifying&&Ry(e),y(()=>e.error());else{let w=t.async?f():h();t.modifying&&Ry(e),y(()=>Iz(e,w))}}function f(){let w=n.let("ruleErrs",null);return n.try(()=>m((0,Ce._)`await `),v=>n.assign(d,!1).if((0,Ce._)`${v} instanceof ${c.ValidationError}`,()=>n.assign(w,(0,Ce._)`${v}.errors`),()=>n.throw(v))),w}function h(){let w=(0,Ce._)`${l}.errors`;return n.assign(w,null),m(Ce.nil),w}function m(w=t.async?(0,Ce._)`await `:Ce.nil){let v=c.opts.passContext?mr.default.this:mr.default.self,S=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,Ce._)`${w}${(0,Oz.callValidateCode)(e,l,v,S)}`,t.modifying)}function y(w){var v;n.if((0,Ce.not)((v=t.valid)!==null&&v!==void 0?v:d),w)}}ft.funcKeywordCode=Cz;function Ry(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ce._)`${n.parentData}[${n.parentDataProperty}]`))}function Iz(e,t){let{gen:r}=e;r.if((0,Ce._)`Array.isArray(${t})`,()=>{r.assign(mr.default.vErrors,(0,Ce._)`${mr.default.vErrors} === null ? ${t} : ${mr.default.vErrors}.concat(${t})`).assign(mr.default.errors,(0,Ce._)`${mr.default.vErrors}.length`),(0,Rz.extendErrors)(e)},()=>e.error())}function Nz({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Ay(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,Ce.stringify)(r)})}function jz(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}ft.validSchemaType=jz;function Zz({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}ft.validateKeywordUsage=Zz});var Ny=E(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.extendSubschemaMode=Wt.extendSubschemaData=Wt.getSubschema=void 0;var pt=L(),Iy=B();function Dz(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==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,pt._)`${e.schemaPath}${(0,pt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,pt._)`${e.schemaPath}${(0,pt.getProperty)(t)}${(0,pt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Iy.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Wt.getSubschema=Dz;function Mz(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==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,p=a.let("data",(0,pt._)`${t.data}${(0,pt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,pt.str)`${u}${(0,Iy.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,pt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof pt.Name?o:a.let("data",o,!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]}}Wt.extendSubschemaData=Mz;function Lz(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Wt.extendSubschemaMode=Lz});var Uu=E((Jj,jy)=>{"use strict";jy.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))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),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Dy=E((Wj,Zy)=>{"use strict";var Gt=Zy.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};bi(t,n,o,e,"",e)};Gt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Gt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Gt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Gt.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 bi(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Gt.arrayKeywords)for(var p=0;p<d.length;p++)bi(e,t,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p)}else if(l in Gt.propsKeywords){if(d&&typeof d=="object")for(var f in d)bi(e,t,r,d[f],o+"/"+l+"/"+Uz(f),s,o,l,n,f)}else(l in Gt.keywords||e.allKeys&&!(l in Gt.skipKeywords))&&bi(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Uz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ho=E(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.getSchemaRefs=Me.resolveUrl=Me.normalizeId=Me._getFullPath=Me.getFullPath=Me.inlineRef=void 0;var qz=B(),Fz=Uu(),Bz=Dy(),Vz=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Hz(e,t=!0){return typeof e=="boolean"?!0:t===!0?!qu(e):t?My(e)<=t:!1}Me.inlineRef=Hz;var Kz=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qu(e){for(let t in e){if(Kz.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(qu)||typeof r=="object"&&qu(r))return!0}return!1}function My(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!Vz.has(r)&&(typeof e[r]=="object"&&(0,qz.eachItem)(e[r],n=>t+=My(n)),t===1/0))return 1/0}return t}function Ly(e,t="",r){r!==!1&&(t=sn(t));let n=e.parse(t);return Uy(e,n)}Me.getFullPath=Ly;function Uy(e,t){return e.serialize(t).split("#")[0]+"#"}Me._getFullPath=Uy;var Jz=/#\/?$/;function sn(e){return e?e.replace(Jz,""):""}Me.normalizeId=sn;function Wz(e,t,r){return r=sn(r),e.resolve(t,r)}Me.resolveUrl=Wz;var Gz=/^[a-z_][-a-z0-9._]*$/i;function Xz(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=sn(e[r]||t),s={"":o},i=Ly(n,o,!1),a={},c=new Set;return Bz(e,{allKeys:!0},(d,p,f,h)=>{if(h===void 0)return;let m=i+p,y=s[h];typeof d[r]=="string"&&(y=w.call(this,d[r])),v.call(this,d.$anchor),v.call(this,d.$dynamicAnchor),s[p]=y;function w(S){let T=this.opts.uriResolver.resolve;if(S=sn(y?T(y,S):S),c.has(S))throw l(S);c.add(S);let _=this.refs[S];return typeof _=="string"&&(_=this.refs[_]),typeof _=="object"?u(d,_.schema,S):S!==sn(m)&&(S[0]==="#"?(u(d,a[S],S),a[S]=d):this.refs[S]=m),S}function v(S){if(typeof S=="string"){if(!Gz.test(S))throw new Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),a;function u(d,p,f){if(p!==void 0&&!Fz(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Me.getSchemaRefs=Xz});var yo=E(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.getData=Xt.KeywordCxt=Xt.validateFunctionCode=void 0;var Hy=xy(),qy=po(),Bu=Iu(),wi=po(),Yz=Ey(),go=Cy(),Fu=Ny(),C=L(),Z=Ot(),Qz=ho(),Rt=B(),mo=fo();function ek(e){if(Wy(e)&&(Gy(e),Jy(e))){nk(e);return}Ky(e,()=>(0,Hy.topBoolOrEmptySchema)(e))}Xt.validateFunctionCode=ek;function Ky({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,C._)`${Z.default.data}, ${Z.default.valCxt}`,n.$async,()=>{e.code((0,C._)`"use strict"; ${Fy(r,o)}`),rk(e,o),e.code(s)}):e.func(t,(0,C._)`${Z.default.data}, ${tk(o)}`,n.$async,()=>e.code(Fy(r,o)).code(s))}function tk(e){return(0,C._)`{${Z.default.instancePath}="", ${Z.default.parentData}, ${Z.default.parentDataProperty}, ${Z.default.rootData}=${Z.default.data}${e.dynamicRef?(0,C._)`, ${Z.default.dynamicAnchors}={}`:C.nil}}={}`}function rk(e,t){e.if(Z.default.valCxt,()=>{e.var(Z.default.instancePath,(0,C._)`${Z.default.valCxt}.${Z.default.instancePath}`),e.var(Z.default.parentData,(0,C._)`${Z.default.valCxt}.${Z.default.parentData}`),e.var(Z.default.parentDataProperty,(0,C._)`${Z.default.valCxt}.${Z.default.parentDataProperty}`),e.var(Z.default.rootData,(0,C._)`${Z.default.valCxt}.${Z.default.rootData}`),t.dynamicRef&&e.var(Z.default.dynamicAnchors,(0,C._)`${Z.default.valCxt}.${Z.default.dynamicAnchors}`)},()=>{e.var(Z.default.instancePath,(0,C._)`""`),e.var(Z.default.parentData,(0,C._)`undefined`),e.var(Z.default.parentDataProperty,(0,C._)`undefined`),e.var(Z.default.rootData,Z.default.data),t.dynamicRef&&e.var(Z.default.dynamicAnchors,(0,C._)`{}`)})}function nk(e){let{schema:t,opts:r,gen:n}=e;Ky(e,()=>{r.$comment&&t.$comment&&Yy(e),ck(e),n.let(Z.default.vErrors,null),n.let(Z.default.errors,0),r.unevaluated&&ok(e),Xy(e),dk(e)})}function ok(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,C._)`${r}.evaluated`),t.if((0,C._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,C._)`${e.evaluated}.props`,(0,C._)`undefined`)),t.if((0,C._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,C._)`${e.evaluated}.items`,(0,C._)`undefined`))}function Fy(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,C._)`/*# sourceURL=${r} */`:C.nil}function sk(e,t){if(Wy(e)&&(Gy(e),Jy(e))){ik(e,t);return}(0,Hy.boolOrEmptySchema)(e,t)}function Jy({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 Wy(e){return typeof e.schema!="boolean"}function ik(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Yy(e),uk(e),lk(e);let s=n.const("_errs",Z.default.errors);Xy(e,s),n.var(t,(0,C._)`${s} === ${Z.default.errors}`)}function Gy(e){(0,Rt.checkUnknownRules)(e),ak(e)}function Xy(e,t){if(e.opts.jtd)return By(e,[],!1,t);let r=(0,qy.getSchemaTypes)(e.schema),n=(0,qy.coerceAndCheckDataType)(e,r);By(e,r,!n,t)}function ak(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Rt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function ck(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Rt.checkStrictMode)(e,"default is ignored in the schema root")}function uk(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,Qz.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function lk(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Yy({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,C._)`${Z.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,C.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,C._)`${Z.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function dk(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,C._)`${Z.default.errors} === 0`,()=>t.return(Z.default.data),()=>t.throw((0,C._)`new ${o}(${Z.default.vErrors})`)):(t.assign((0,C._)`${n}.errors`,Z.default.vErrors),s.unevaluated&&fk(e),t.return((0,C._)`${Z.default.errors} === 0`))}function fk({gen:e,evaluated:t,props:r,items:n}){r instanceof C.Name&&e.assign((0,C._)`${t}.props`,r),n instanceof C.Name&&e.assign((0,C._)`${t}.items`,n)}function By(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Rt.schemaHasRulesButRef)(s,l))){o.block(()=>e_(e,"$ref",l.all.$ref.definition));return}c.jtd||pk(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Bu.shouldUseGroup)(s,p)&&(p.type?(o.if((0,wi.checkDataType)(p.type,i,c.strictNumbers)),Vy(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,wi.reportTypeError)(e)),o.endIf()):Vy(e,p),a||o.if((0,C._)`${Z.default.errors} === ${n||0}`))}}function Vy(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,Yz.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Bu.shouldUseRule)(n,s)&&e_(e,s.keyword,s.definition,t.type)})}function pk(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(hk(e,t),e.opts.allowUnionTypes||mk(e,t),gk(e,e.dataTypes))}function hk(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Qy(e.dataTypes,r)||Vu(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),_k(e,t)}}function mk(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Vu(e,"use allowUnionTypes to allow union type keyword")}function gk(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Bu.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>yk(t,i))&&Vu(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function yk(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Qy(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function _k(e,t){let r=[];for(let n of e.dataTypes)Qy(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Vu(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Rt.checkStrictMode)(e,t,e.opts.strictTypes)}var xi=class{constructor(t,r,n){if((0,go.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Rt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",t_(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,go.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",Z.default.errors))}result(t,r,n){this.failResult((0,C.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,C.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,C._)`${r} !== undefined && (${(0,C.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?mo.reportExtraError:mo.reportError)(this,this.def.error,r)}$dataError(){(0,mo.reportError)(this,this.def.$dataError||mo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,mo.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=C.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=C.nil,r=C.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,C.or)((0,C._)`${o} === undefined`,r)),t!==C.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==C.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,C.or)(i(),a());function i(){if(n.length){if(!(r instanceof C.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,C._)`${(0,wi.checkDataTypes)(c,r,s.opts.strictNumbers,wi.DataType.Wrong)}`}return C.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,C._)`!${c}(${r})`}return C.nil}}subschema(t,r){let n=(0,Fu.getSubschema)(this.it,t);(0,Fu.extendSubschemaData)(n,this.it,t),(0,Fu.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return sk(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Rt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Rt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,C.Name)),!0}};Xt.KeywordCxt=xi;function e_(e,t,r,n){let o=new xi(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,go.funcKeywordCode)(o,r):"macro"in r?(0,go.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,go.funcKeywordCode)(o,r)}var bk=/^\/(?:[^~]|~0|~1)*$/,wk=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function t_(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return Z.default.rootData;if(e[0]==="/"){if(!bk.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=Z.default.rootData}else{let u=wk.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,C._)`${s}${(0,C.getProperty)((0,Rt.unescapeJsonPointer)(u))}`,i=(0,C._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Xt.getData=t_});var vi=E(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var Hu=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Ku.default=Hu});var _o=E(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});var Ju=ho(),Wu=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Ju.resolveUrl)(t,r,n),this.missingSchema=(0,Ju.normalizeId)((0,Ju.getFullPath)(t,this.missingRef))}};Gu.default=Wu});var Si=E(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.resolveSchema=Ge.getCompilingSchema=Ge.resolveRef=Ge.compileSchema=Ge.SchemaEnv=void 0;var ot=L(),xk=vi(),gr=Ot(),st=ho(),r_=B(),vk=yo(),an=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,st.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Ge.SchemaEnv=an;function Yu(e){let t=n_.call(this,e);if(t)return t;let r=(0,st.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new ot.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:xk.default,code:(0,ot._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:gr.default.data,parentData:gr.default.parentData,parentDataProperty:gr.default.parentDataProperty,dataNames:[gr.default.data],dataPathArr:[ot.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,ot.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ot.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ot._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,vk.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(gr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${gr.default.self}`,`${gr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:m}=u;f.evaluated={props:h instanceof ot.Name?void 0:h,items:m instanceof ot.Name?void 0:m,dynamicProps:h instanceof ot.Name,dynamicItems:m instanceof ot.Name},f.source&&(f.source.evaluated=(0,ot.stringify)(f.evaluated))}return e.validate=f,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)}}Ge.compileSchema=Yu;function $k(e,t,r){var n;r=(0,st.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=kk.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new an({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=Sk.call(this,s)}Ge.resolveRef=$k;function Sk(e){return(0,st.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Yu.call(this,e)}function n_(e){for(let t of this._compilations)if(zk(t,e))return t}Ge.getCompilingSchema=n_;function zk(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function kk(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||$i.call(this,e,t)}function $i(e,t){let r=this.opts.uriResolver.parse(t),n=(0,st._getFullPath)(this.opts.uriResolver,r),o=(0,st.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Xu.call(this,r,e);let s=(0,st.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=$i.call(this,e,i);return typeof a?.schema!="object"?void 0:Xu.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Yu.call(this,i),s===(0,st.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,st.resolveUrl)(this.opts.uriResolver,o,u)),new an({schema:a,schemaId:c,root:e,baseId:o})}return Xu.call(this,r,i)}}Ge.resolveSchema=$i;var Pk=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xu(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,r_.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Pk.has(a)&&u&&(t=(0,st.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,r_.schemaHasRulesButRef)(r,this.RULES)){let a=(0,st.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=$i.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new an({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var o_=E((t4,Ek)=>{Ek.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 ol=E((r4,d_)=>{"use strict";var Tk=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),el=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),Ok=RegExp.prototype.test.bind(/^\d*$/u),yr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),tl=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),i_=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),rl=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Rk=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Le=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Le[t]="%"+e[t>>4]+e[t&15]}function Te(e){return e<2048?Le[192|e>>6]+Le[128|e&63]:e<65536?Le[224|e>>12]+Le[128|e>>6&63]+Le[128|e&63]:Le[240|e>>18]+Le[128|e>>12&63]+Le[128|e>>6&63]+Le[128|e&63]}function Ak(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Ck=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Ik=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Nk=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),jk=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Zk(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Nk(e[t])){if(e[t]==="%"&&t+2<e.length&&yr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function s_(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)e[a]==="0"?(n===-1&&(n=a),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function Dk(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let c=o[a];if(c==="")return;if(c.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!el(c))return;s+=2;continue}if(!Ck(c))return;o[a]=parseInt(c,16).toString(16),s++}if(t===-1)return s!==8?void 0:s_(o);if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return s_(i)}function Qu(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&Ik(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Mk(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!Zk(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=Dk(n);return i===void 0?{host:e,isIPV6:!1,error:!0}:{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function Mk(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Lk(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===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(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var Uk={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},qk=/[@/?#:]/g,Fk=/[@/?#]/g;function a_(e,t){let r=t?Fk:qk;return r.lastIndex=0,e.replace(r,n=>Uk[n])}function c_(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(yr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&tl(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function Bk(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(yr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));i!=="."&&tl(i)?t+=i:t+="%"+s,r+=2;continue}}if(i_(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=l_(o)?n:Le[o];else if(o<55296||o>57343)t+=Te(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Te(65536+(o-55296<<10)+(s-56320)),r++):t+=Te(65533)}else t+=Te(65533)}}return t}function Vk(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(yr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/"&&(n=!1),i_(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Le[i];else if(i<55296||i>57343)r+=Te(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);a>=56320&&a<=57343?(r+=Te(65536+(i-55296<<10)+(a-56320)),o++):r+=Te(65533)}else r+=Te(65533)}}return r}function nl(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(yr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Le[s];else if(s<55296||s>57343)r+=Te(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);i>=56320&&i<=57343?(r+=Te(65536+(s-55296<<10)+(i-56320)),n++):r+=Te(65533)}else r+=Te(65533)}}return r}function u_(e){return nl(e,Rk)}function Hk(e){return nl(e,rl)}function Kk(e){return nl(e,rl)}function l_(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function Jk(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(yr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));tl(i)?t+=i:t+="%"+s,r+=2;continue}}if(rl(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=l_(o)?n:Le[o];else if(o<55296||o>57343)t+=Te(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);s>=56320&&s<=57343?(t+=Te(65536+(o-55296<<10)+(s-56320)),r++):t+=Te(65533)}else t+=Te(65533)}}return t}function Wk(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(yr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Gk(e){let t=[];if(e.userinfo!==void 0&&(t.push(u_(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!el(r)){let n=Qu(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=c_(r,!0),n=Qu(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=a_(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Ok(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}d_.exports={nonSimpleDomain:jk,recomposeAuthority:Gk,reescapeHostDelimiters:a_,normalizePercentEncoding:c_,normalizePathEncoding:Bk,serializePathEncoding:Vk,normalizeQueryFragmentEncoding:Jk,encodeUserinfo:u_,encodeQuery:Hk,encodeFragment:Kk,escapePreservingEscapes:Wk,removeDotSegments:Lk,isIPv4:el,isUUID:Tk,normalizeIPv6:Qu,stringArrayToHexStripped:Ak}});var g_=E((n4,m_)=>{"use strict";var{isUUID:Xk}=ol(),Yk=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,Qk=["http","https","ws","wss","urn","urn:uuid"];function e1(e){return Qk.indexOf(e)!==-1}function sl(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 f_(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function p_(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 t1(e){return e.secure=sl(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function r1(e){if((e.port===(sl(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=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function n1(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Yk);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=il(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function o1(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=il(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function s1(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Xk(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function i1(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var h_={scheme:"http",domainHost:!0,parse:f_,serialize:p_},a1={scheme:"https",domainHost:h_.domainHost,parse:f_,serialize:p_},zi={scheme:"ws",domainHost:!0,parse:t1,serialize:r1},c1={scheme:"wss",domainHost:zi.domainHost,parse:zi.parse,serialize:zi.serialize},u1={scheme:"urn",parse:n1,serialize:o1,skipNormalize:!0},l1={scheme:"urn:uuid",parse:s1,serialize:i1,skipNormalize:!0},ki={http:h_,https:a1,ws:zi,wss:c1,urn:u1,"urn:uuid":l1};Object.setPrototypeOf(ki,null);function il(e){return e&&(ki[e]||ki[e.toLowerCase()])||void 0}m_.exports={wsIsSecure:sl,SCHEMES:ki,isValidSchemeName:e1,getSchemeHandler:il}});var T_=E((o4,Ti)=>{"use strict";var{normalizeIPv6:x_,removeDotSegments:wo,recomposeAuthority:d1,normalizePercentEncoding:al,normalizePathEncoding:f1,serializePathEncoding:y_,normalizeQueryFragmentEncoding:__,encodeQuery:p1,encodeFragment:h1,reescapeHostDelimiters:m1,isIPv4:v_,nonSimpleDomain:g1}=ol(),{SCHEMES:$_,getSchemeHandler:cl}=g_(),S_=/^[A-Za-z][A-Za-z0-9+.-]*$/u,z_="URI scheme is malformed.";function b_(e){let t=unescape(String(e));if(!S_.test(t))throw new TypeError(z_);return t}function y1(e,t){return typeof e=="string"?e=z1(e,t):typeof e=="object"&&(e=Ei(_r(e,t),t)),e}function _1(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:c,malformedScheme:u}=Pi(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:h,malformedScheme:m}=Pi(t,n);if(s||d||i||p||a||f||c||h||u||m)throw new Error(o.error||l.error||"URI is malformed.");let y=k_(o,l,n,!0),w=cl(r&&r.scheme||y.scheme),v=y.host,S=v!==void 0&&v!==""&&(v_(v)||x_(v).isIPV6);P_(y,r||{},w,S);let T=v&&v.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(v);if(y.error&&!T)throw new Error(y.error);return n.skipEscape=!0,_r(y,n)}function k_(e,t,r,n){let o={};return n||(e=Ei(_r(e,r),r),t=Ei(_r(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=wo(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=wo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=wo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=wo(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function b1(e,t,r){let n=w_(e,r),o=w_(t,r);return n!==void 0&&o!==void 0&&n===o}function _r(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=b_(r.scheme));let s=cl(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=!n.skipEscape&&r.scheme===void 0&&!i;r.path!==void 0&&(n.skipEscape?r.path=al(r.path):r.path=y_(r.path,a)),n.reference!=="suffix"&&r.scheme&&(r.scheme=b_(r.scheme),o.push(r.scheme,":"));let c=d1(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(u=wo(u)),a&&(u=y_(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",p1(r.query)),r.fragment!==void 0&&o.push("#",h1(r.fragment)),o.join("")}var w1=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,x1=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,v1=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function $1(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 bo(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function ul(e){return e[0]==="["&&e[e.length-1]==="]"}function S1(e){let t=e[4];return bo(e[3])||t!==void 0&&!ul(t)&&bo(t)||bo(e[6])||bo(e[7])||bo(e[8])}function P_(e,t,r,n){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!ul(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&g1(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function Pi(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(x1);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let p=e.match(v1);if(p!==null){let h=p[1],m=h.replace(/[\t\n\r]/g,"");m.length>=2&&(m.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):h.length!==m.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let f=e.match(w1);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let y=unescape(n.scheme);S_.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||z_,u=!0)}s=S1(f),s&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let h=$1(n,f);if(h!==void 0&&(n.error=n.error||h,o=!0),n.host)if(v_(n.host)===!1){let w=ul(n.host),v=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=x_(n.host);l=S.isIPV6||S.isIPVFuture===!0,c=v&&(!w||S.error===!0),n.host=l?S.host:S.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else l=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let m=cl(r.scheme||n.scheme);if(c||(a=P_(n,r,m,l)),e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:al(n.host,!0);l||(y=al(y.toLowerCase())),n.host=m1(y,l)}(!m||m&&!m.skipNormalize)&&(n.path&&(n.path=f1(n.path)),n.query&&(n.query=__(n.query)),n.fragment&&(n.fragment=__(n.fragment))),m&&m.parse&&(m.parse(n,r),m===$_.urn&&n.nid===void 0&&(i=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}}function Ei(e,t){return Pi(e,t).parsed}function z1(e,t){return E_(e,t).normalized}function E_(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=Pi(e,t);return{normalized:n||o||s||i||a?e:_r(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function w_(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:_r(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}=E_(r,t);return o||s||i||a||c?void 0:n}var ll={SCHEMES:$_,normalize:y1,resolve:_1,resolveComponent:k_,equal:b1,serialize:_r,parse:Ei};Ti.exports=ll;Ti.exports.default=ll;Ti.exports.fastUri=ll});var R_=E(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});var O_=T_();O_.code='require("ajv/dist/runtime/uri").default';dl.default=O_});var M_=E($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 k1=yo();Object.defineProperty($e,"KeywordCxt",{enumerable:!0,get:function(){return k1.KeywordCxt}});var cn=L();Object.defineProperty($e,"_",{enumerable:!0,get:function(){return cn._}});Object.defineProperty($e,"str",{enumerable:!0,get:function(){return cn.str}});Object.defineProperty($e,"stringify",{enumerable:!0,get:function(){return cn.stringify}});Object.defineProperty($e,"nil",{enumerable:!0,get:function(){return cn.nil}});Object.defineProperty($e,"Name",{enumerable:!0,get:function(){return cn.Name}});Object.defineProperty($e,"CodeGen",{enumerable:!0,get:function(){return cn.CodeGen}});var P1=vi(),j_=_o(),E1=Cu(),xo=Si(),T1=L(),vo=ho(),Oi=po(),pl=B(),A_=o_(),O1=R_(),Z_=(e,t)=>new RegExp(e,t);Z_.code="new RegExp";var R1=["removeAdditional","useDefaults","coerceTypes"],A1=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),C1={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."},I1={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},C_=200;function N1(e){var t,r,n,o,s,i,a,c,u,l,d,p,f,h,m,y,w,v,S,T,_,x,$,P,O;let D=e.strict,se=(t=e.code)===null||t===void 0?void 0:t.optimize,ye=se===!0||se===void 0?1:se||0,yt=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Z_,ct=(o=e.uriResolver)!==null&&o!==void 0?o:O1.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:D)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:D)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:D)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:D)!==null&&p!==void 0?p:"log",strictRequired:(h=(f=e.strictRequired)!==null&&f!==void 0?f:D)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:ye,regExp:yt}:{optimize:ye,regExp:yt},loopRequired:(m=e.loopRequired)!==null&&m!==void 0?m:C_,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:C_,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(v=e.messages)!==null&&v!==void 0?v:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(T=e.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(_=e.addUsedSchema)!==null&&_!==void 0?_:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:($=e.validateFormats)!==null&&$!==void 0?$:!0,unicodeRegExp:(P=e.unicodeRegExp)!==null&&P!==void 0?P:!0,int32range:(O=e.int32range)!==null&&O!==void 0?O:!0,uriResolver:ct}}var $o=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,...N1(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new T1.ValueScope({scope:{},prefixes:A1,es5:r,lines:n}),this.logger=U1(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,E1.getRules)(),I_.call(this,C1,t,"NOT SUPPORTED"),I_.call(this,I1,t,"DEPRECATED","warn"),this._metaOpts=M1.call(this),t.formats&&Z1.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&D1.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),j1.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=A_;n==="id"&&(o={...A_},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof j_.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]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);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,vo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=N_.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new xo.SchemaEnv({schema:{},schemaId:n});if(r=xo.resolveSchema.call(this,o,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=N_.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,vo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(F1.call(this,n,r),!r)return(0,pl.eachItem)(n,s=>fl.call(this,s)),this;V1.call(this,r);let o={...r,type:(0,Oi.getJSONTypes)(r.type),schemaType:(0,Oi.getJSONTypes)(r.schemaType)};return(0,pl.eachItem)(n,o.type.length===0?s=>fl.call(this,s,o):s=>o.type.forEach(i=>fl.call(this,s,o,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 n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=D_(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=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;n=(0,vo.normalizeId)(i||n);let u=vo.getSchemaRefs.call(this,t,n);return c=new xo.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&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):xo.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{xo.compileSchema.call(this,t)}finally{this.opts=r}}};$o.ValidationError=P1.default;$o.MissingRefError=j_.default;$e.default=$o;function I_(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function N_(e){return e=(0,vo.normalizeId)(e),this.schemas[e]||this.refs[e]}function j1(){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 Z1(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function D1(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 M1(){let e={...this.opts};for(let t of R1)delete e[t];return e}var L1={log(){},warn(){},error(){}};function U1(e){if(e===!1)return L1;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 q1=/^[a-z_$][a-z0-9_$:-]*$/i;function F1(e,t){let{RULES:r}=this;if((0,pl.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!q1.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function fl(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?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,Oi.getJSONTypes)(t.type),schemaType:(0,Oi.getJSONTypes)(t.schemaType)}};t.before?B1.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function B1(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function V1(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=D_(t)),e.validateSchema=this.compile(t,!0))}var H1={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function D_(e){return{anyOf:[e,H1]}}});var L_=E(hl=>{"use strict";Object.defineProperty(hl,"__esModule",{value:!0});var K1={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};hl.default=K1});var B_=E(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0});br.callRef=br.getValidate=void 0;var J1=_o(),U_=We(),Ue=L(),un=Ot(),q_=Si(),Ri=B(),W1={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=q_.resolveRef.call(c,u,o,r);if(l===void 0)throw new J1.default(n.opts.uriResolver,o,r);if(l instanceof q_.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return Ai(e,i,s,s.$async);let h=t.scopeValue("root",{ref:u});return Ai(e,(0,Ue._)`${h}.validate`,u,u.$async)}function p(h){let m=F_(e,h);Ai(e,m,h,h.$async)}function f(h){let m=t.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Ue.stringify)(h)}:{ref:h}),y=t.name("valid"),w=e.subschema({schema:h,dataTypes:[],schemaPath:Ue.nil,topSchemaRef:m,errSchemaPath:r},y);e.mergeEvaluated(w),e.ok(y)}}};function F_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ue._)`${r.scopeValue("wrapper",{ref:t})}.validate`}br.getValidate=F_;function Ai(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?un.default.this:Ue.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Ue._)`await ${(0,U_.callValidateCode)(e,t,u)}`),f(t),i||o.assign(h,!0)},m=>{o.if((0,Ue._)`!(${m} instanceof ${s.ValidationError})`,()=>o.throw(m)),p(m),i||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,U_.callValidateCode)(e,t,u),()=>f(t),()=>p(t))}function p(h){let m=(0,Ue._)`${h}.errors`;o.assign(un.default.vErrors,(0,Ue._)`${un.default.vErrors} === null ? ${m} : ${un.default.vErrors}.concat(${m})`),o.assign(un.default.errors,(0,Ue._)`${un.default.vErrors}.length`)}function f(h){var m;if(!s.opts.unevaluated)return;let y=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=Ri.mergeEvaluated.props(o,y.props,s.props));else{let w=o.var("props",(0,Ue._)`${h}.evaluated.props`);s.props=Ri.mergeEvaluated.props(o,w,s.props,Ue.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=Ri.mergeEvaluated.items(o,y.items,s.items));else{let w=o.var("items",(0,Ue._)`${h}.evaluated.items`);s.items=Ri.mergeEvaluated.items(o,w,s.items,Ue.Name)}}}br.callRef=Ai;br.default=W1});var V_=E(ml=>{"use strict";Object.defineProperty(ml,"__esModule",{value:!0});var G1=L_(),X1=B_(),Y1=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",G1.default,X1.default];ml.default=Y1});var H_=E(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});var Ci=L(),Yt=Ci.operators,Ii={maximum:{okStr:"<=",ok:Yt.LTE,fail:Yt.GT},minimum:{okStr:">=",ok:Yt.GTE,fail:Yt.LT},exclusiveMaximum:{okStr:"<",ok:Yt.LT,fail:Yt.GTE},exclusiveMinimum:{okStr:">",ok:Yt.GT,fail:Yt.LTE}},Q1={message:({keyword:e,schemaCode:t})=>(0,Ci.str)`must be ${Ii[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ci._)`{comparison: ${Ii[e].okStr}, limit: ${t}}`},eP={keyword:Object.keys(Ii),type:"number",schemaType:"number",$data:!0,error:Q1,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Ci._)`${r} ${Ii[t].fail} ${n} || isNaN(${r})`)}};gl.default=eP});var K_=E(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});var So=L(),tP={message:({schemaCode:e})=>(0,So.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,So._)`{multipleOf: ${e}}`},rP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:tP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,So._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,So._)`${i} !== parseInt(${i})`;e.fail$data((0,So._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};yl.default=rP});var W_=E(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});function J_(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}_l.default=J_;J_.code='require("ajv/dist/runtime/ucs2length").default'});var G_=E(bl=>{"use strict";Object.defineProperty(bl,"__esModule",{value:!0});var wr=L(),nP=B(),oP=W_(),sP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,wr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,wr._)`{limit: ${e}}`},iP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:sP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?wr.operators.GT:wr.operators.LT,i=o.opts.unicode===!1?(0,wr._)`${r}.length`:(0,wr._)`${(0,nP.useFunc)(e.gen,oP.default)}(${r})`;e.fail$data((0,wr._)`${i} ${s} ${n}`)}};bl.default=iP});var X_=E(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});var aP=We(),cP=B(),ln=L(),uP={message:({schemaCode:e})=>(0,ln.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,ln._)`{pattern: ${e}}`},lP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:uP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,ln._)`new RegExp`:(0,cP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,ln._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,ln._)`!${l}`)}else{let c=(0,aP.usePattern)(e,o);e.fail$data((0,ln._)`!${c}.test(${r})`)}}};wl.default=lP});var Y_=E(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});var zo=L(),dP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,zo.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,zo._)`{limit: ${e}}`},fP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:dP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?zo.operators.GT:zo.operators.LT;e.fail$data((0,zo._)`Object.keys(${r}).length ${o} ${n}`)}};xl.default=fP});var Q_=E(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var ko=We(),Po=L(),pP=B(),hP={message:({params:{missingProperty:e}})=>(0,Po.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Po._)`{missingProperty: ${e}}`},mP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:hP,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$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 f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let m of r)if(f?.[m]===void 0&&!h.has(m)){let y=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${m}" is not defined at "${y}" (strictRequired)`;(0,pP.checkStrictMode)(i,w,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Po.nil,d);else for(let f of r)(0,ko.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let h=t.let("valid",!0);e.block$data(h,()=>p(f,h)),e.ok(h)}else t.if((0,ko.checkMissingProp)(e,r,f)),(0,ko.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,ko.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function p(f,h){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(h,(0,ko.propertyInData)(t,o,f,a.ownProperties)),t.if((0,Po.not)(h),()=>{e.error(),t.break()})},Po.nil)}}};vl.default=mP});var e0=E($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});var Eo=L(),gP={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}}`},yP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:gP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Eo.operators.GT:Eo.operators.LT;e.fail$data((0,Eo._)`${r}.length ${o} ${n}`)}};$l.default=yP});var Ni=E(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});var t0=Uu();t0.code='require("ajv/dist/runtime/equal").default';Sl.default=t0});var r0=E(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});var zl=po(),Se=L(),_P=B(),bP=Ni(),wP={message:({params:{i:e,j:t}})=>(0,Se.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Se._)`{i: ${e}, j: ${t}}`},xP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:wP,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?(0,zl.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,Se._)`${i} === false`),e.ok(c);function l(){let h=t.let("i",(0,Se._)`${r}.length`),m=t.let("j");e.setParams({i:h,j:m}),t.assign(c,!0),t.if((0,Se._)`${h} > 1`,()=>(d()?p:f)(h,m))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,m){let y=t.name("item"),w=(0,zl.checkDataTypes)(u,y,a.opts.strictNumbers,zl.DataType.Wrong),v=t.const("indices",(0,Se._)`{}`);t.for((0,Se._)`;${h}--;`,()=>{t.let(y,(0,Se._)`${r}[${h}]`),t.if(w,(0,Se._)`continue`),u.length>1&&t.if((0,Se._)`typeof ${y} == "string"`,(0,Se._)`${y} += "_"`),t.if((0,Se._)`typeof ${v}[${y}] == "number"`,()=>{t.assign(m,(0,Se._)`${v}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Se._)`${v}[${y}] = ${h}`)})}function f(h,m){let y=(0,_P.useFunc)(t,bP.default),w=t.name("outer");t.label(w).for((0,Se._)`;${h}--;`,()=>t.for((0,Se._)`${m} = ${h}; ${m}--;`,()=>t.if((0,Se._)`${y}(${r}[${h}], ${r}[${m}])`,()=>{e.error(),t.assign(c,!1).break(w)})))}}};kl.default=xP});var n0=E(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});var Pl=L(),vP=B(),$P=Ni(),SP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Pl._)`{allowedValue: ${e}}`},zP={keyword:"const",$data:!0,error:SP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,Pl._)`!${(0,vP.useFunc)(t,$P.default)}(${r}, ${o})`):e.fail((0,Pl._)`${s} !== ${r}`)}};El.default=zP});var o0=E(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});var To=L(),kP=B(),PP=Ni(),EP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,To._)`{allowedValues: ${e}}`},TP={keyword:"enum",schemaType:"array",$data:!0,error:EP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,kP.useFunc)(t,PP.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,To.or)(...o.map((h,m)=>p(f,m)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,To._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,h){let m=o[h];return typeof m=="object"&&m!==null?(0,To._)`${u()}(${r}, ${f}[${h}])`:(0,To._)`${r} === ${m}`}}};Tl.default=TP});var s0=E(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});var OP=H_(),RP=K_(),AP=G_(),CP=X_(),IP=Y_(),NP=Q_(),jP=e0(),ZP=r0(),DP=n0(),MP=o0(),LP=[OP.default,RP.default,AP.default,CP.default,IP.default,NP.default,jP.default,ZP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},DP.default,MP.default];Ol.default=LP});var Al=E(Oo=>{"use strict";Object.defineProperty(Oo,"__esModule",{value:!0});Oo.validateAdditionalItems=void 0;var xr=L(),Rl=B(),UP={message:({params:{len:e}})=>(0,xr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,xr._)`{limit: ${e}}`},qP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:UP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Rl.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}i0(e,n)}};function i0(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,xr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,xr._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Rl.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,xr._)`${a} <= ${t.length}`);r.if((0,xr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:Rl.Type.Num},u),i.allErrors||r.if((0,xr.not)(u),()=>r.break())})}}Oo.validateAdditionalItems=i0;Oo.default=qP});var Cl=E(Ro=>{"use strict";Object.defineProperty(Ro,"__esModule",{value:!0});Ro.validateTuple=void 0;var a0=L(),ji=B(),FP=We(),BP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return c0(e,"additionalItems",t);r.items=!0,!(0,ji.alwaysValidSchema)(r,t)&&e.ok((0,FP.validateArray)(e))}};function c0(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=ji.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,a0._)`${s}.length`);r.forEach((d,p)=>{(0,ji.alwaysValidSchema)(a,d)||(n.if((0,a0._)`${u} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,h=r.length,m=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(p.strictTuples&&!m){let y=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,ji.checkStrictMode)(a,y,p.strictTuples)}}}Ro.validateTuple=c0;Ro.default=BP});var u0=E(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});var VP=Cl(),HP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,VP.validateTuple)(e,"items")};Il.default=HP});var d0=E(Nl=>{"use strict";Object.defineProperty(Nl,"__esModule",{value:!0});var l0=L(),KP=B(),JP=We(),WP=Al(),GP={message:({params:{len:e}})=>(0,l0.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,l0._)`{limit: ${e}}`},XP={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:GP,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,KP.alwaysValidSchema)(n,t)&&(o?(0,WP.validateAdditionalItems)(e,o):e.ok((0,JP.validateArray)(e)))}};Nl.default=XP});var f0=E(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});var Xe=L(),Zi=B(),YP={message:({params:{min:e,max:t}})=>t===void 0?(0,Xe.str)`must contain at least ${e} valid item(s)`:(0,Xe.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Xe._)`{minContains: ${e}}`:(0,Xe._)`{minContains: ${e}, maxContains: ${t}}`},QP={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:YP,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,Xe._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Zi.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Zi.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Zi.alwaysValidSchema)(s,r)){let m=(0,Xe._)`${l} >= ${i}`;a!==void 0&&(m=(0,Xe._)`${m} && ${l} <= ${a}`),e.pass(m);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?f(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,Xe._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let m=t.name("_valid"),y=t.let("count",0);f(m,()=>t.if(m,()=>h(y)))}function f(m,y){t.forRange("i",0,l,w=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:Zi.Type.Num,compositeRule:!0},m),y()})}function h(m){t.code((0,Xe._)`${m}++`),a===void 0?t.if((0,Xe._)`${m} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,Xe._)`${m} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,Xe._)`${m} >= ${i}`,()=>t.assign(d,!0)))}}};jl.default=QP});var m0=E(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.validateSchemaDeps=ht.validatePropertyDeps=ht.error=void 0;var Zl=L(),eE=B(),Ao=We();ht.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Zl.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Zl._)`{property: ${e},
|
|
8
8
|
missingProperty: ${n},
|
|
9
9
|
depsCount: ${t},
|
|
10
|
-
deps: ${r}}`};var mP={keyword:"dependencies",type:"object",schemaType:"object",error:at.error,code(e){let[t,r]=gP(e);j_(e,t),Z_(e,r)}};function gP({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function j_(e,t=e.schema){let{gen:r,data:n,it:o}=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,go.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,go.checkReportMissingProp)(e,u)}):(r.if((0,ml._)`${c} && (${(0,go.checkMissingProp)(e,a,s)})`),(0,go.reportMissingProp)(e,s),r.else())}}at.validatePropertyDeps=j_;function Z_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,hP.alwaysValidSchema)(s,t[a])||(r.if((0,go.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}at.validateSchemaDeps=Z_;at.default=mP});var L_=k(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});var D_=M(),yP=q(),_P={message:"property name must be valid",params:({params:e})=>(0,D_._)`{propertyName: ${e.propertyName}}`},bP={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:_P,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,yP.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,D_.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};gl.default=bP});var _l=k(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});var wi=He(),rt=M(),wP=St(),xi=q(),xP={message:"must NOT have additional properties",params:({params:e})=>(0,rt._)`{additionalProperty: ${e.additionalProperty}}`},vP={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:xP,code(e){let{gen:t,schema:r,parentSchema:n,data:o,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,xi.alwaysValidSchema)(i,r))return;let u=(0,wi.allSchemaProperties)(n.properties),l=(0,wi.allSchemaProperties)(n.patternProperties);d(),e.ok((0,rt._)`${s} === ${wP.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?h(y):t.if(p(y),()=>h(y))})}function p(y){let w;if(u.length>8){let v=(0,xi.schemaRefOrVal)(i,n.properties,"properties");w=(0,wi.isOwnProperty)(t,v,y)}else u.length?w=(0,rt.or)(...u.map(v=>(0,rt._)`${y} === ${v}`)):w=rt.nil;return l.length&&(w=(0,rt.or)(w,...l.map(v=>(0,rt._)`${(0,wi.usePattern)(e,v)}.test(${y})`))),(0,rt.not)(w)}function f(y){t.code((0,rt._)`delete ${o}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,xi.alwaysValidSchema)(i,r)){let w=t.name("valid");c.removeAdditional==="failing"?(m(y,w,!1),t.if((0,rt.not)(w),()=>{e.reset(),f(y)})):(m(y,w),a||t.if((0,rt.not)(w),()=>t.break()))}}function m(y,w,v){let z={keyword:"additionalProperties",dataProp:y,dataPropType:xi.Type.Str};v===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(z,w)}}};yl.default=vP});var F_=k(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});var $P=eo(),U_=He(),bl=q(),q_=_l(),SP={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&q_.default.code(new $P.KeywordCxt(s,q_.default,"additionalProperties"));let i=(0,U_.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=bl.mergeEvaluated.props(t,(0,bl.toHash)(i),s.props));let a=i.filter(d=>!(0,bl.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,U_.propertyInData)(t,o,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)}}};wl.default=SP});var K_=k(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});var V_=He(),vi=M(),B_=q(),H_=q(),zP={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,V_.allSchemaProperties)(r),c=a.filter(m=>(0,B_.alwaysValidSchema)(s,r[m]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof vi.Name)&&(s.props=(0,H_.evaluatedPropsToName)(t,s.props));let{props:d}=s;p();function p(){for(let m of a)u&&f(m),s.allErrors?h(m):(t.var(l,!0),h(m),t.if(l))}function f(m){for(let y in u)new RegExp(m).test(y)&&(0,B_.checkStrictMode)(s,`property ${y} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,y=>{t.if((0,vi._)`${(0,V_.usePattern)(e,m)}.test(${y})`,()=>{let w=c.includes(m);w||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:y,dataPropType:H_.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,vi._)`${d}[${y}]`,!0):!w&&!s.allErrors&&t.if((0,vi.not)(l),()=>t.break())})})}}};xl.default=zP});var J_=k(vl=>{"use strict";Object.defineProperty(vl,"__esModule",{value:!0});var kP=q(),PP={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,kP.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};vl.default=PP});var W_=k($l=>{"use strict";Object.defineProperty($l,"__esModule",{value:!0});var EP=He(),TP={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:EP.validateUnion,error:{message:"must match a schema in anyOf"}};$l.default=TP});var G_=k(Sl=>{"use strict";Object.defineProperty(Sl,"__esModule",{value:!0});var $i=M(),OP=q(),RP={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,$i._)`{passingSchemas: ${e.passing}}`},AP={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:RP,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.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 p;(0,OP.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,$i._)`${c} && ${i}`).assign(i,!1).assign(a,(0,$i._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),p&&e.mergeEvaluated(p,$i.Name)})})}}};Sl.default=AP});var X_=k(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});var IP=q(),CP={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,IP.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};zl.default=CP});var e0=k(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});var Si=M(),Q_=q(),NP={message:({params:e})=>(0,Si.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Si._)`{failingKeyword: ${e.ifClause}}`},jP={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:NP,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Q_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Y_(n,"then"),s=Y_(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,Si.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 p=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(p,i),d?t.assign(d,(0,Si._)`${l}`):e.setParams({ifClause:l})}}}};function Y_(e,t){let r=e.schema[t];return r!==void 0&&!(0,Q_.alwaysValidSchema)(e,r)}kl.default=jP});var t0=k(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});var ZP=q(),MP={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,ZP.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Pl.default=MP});var r0=k(El=>{"use strict";Object.defineProperty(El,"__esModule",{value:!0});var DP=ll(),LP=A_(),UP=dl(),qP=C_(),FP=N_(),VP=M_(),BP=L_(),HP=_l(),KP=F_(),JP=K_(),WP=J_(),GP=W_(),XP=G_(),YP=X_(),QP=e0(),eE=t0();function tE(e=!1){let t=[WP.default,GP.default,XP.default,YP.default,QP.default,eE.default,BP.default,HP.default,VP.default,KP.default,JP.default];return e?t.push(LP.default,qP.default):t.push(DP.default,UP.default),t.push(FP.default),t}El.default=tE});var n0=k(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});var le=M(),rE={message:({schemaCode:e})=>(0,le.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,le._)`{format: ${e}}`},nE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:rE,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?p():f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,le._)`${h}[${i}]`),y=r.let("fType"),w=r.let("format");r.if((0,le._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(y,(0,le._)`${m}.type || "string"`).assign(w,(0,le._)`${m}.validate`),()=>r.assign(y,(0,le._)`"string"`).assign(w,m)),e.fail$data((0,le.or)(v(),z()));function v(){return c.strictSchema===!1?le.nil:(0,le._)`${i} && !${w}`}function z(){let A=l.$async?(0,le._)`(${m}.async ? await ${w}(${n}) : ${w}(${n}))`:(0,le._)`${w}(${n})`,b=(0,le._)`(typeof ${w} == "function" ? ${A} : ${w}.test(${n}))`;return(0,le._)`${w} && ${w} !== true && ${y} === ${t} && !${b}`}}function f(){let h=d.formats[s];if(!h){v();return}if(h===!0)return;let[m,y,w]=z(h);m===t&&e.pass(A());function v(){if(c.strictSchema===!1){d.logger.warn(b());return}throw new Error(b());function b(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function z(b){let x=b instanceof RegExp?(0,le.regexpCode)(b):c.code.formats?(0,le._)`${c.code.formats}${(0,le.getProperty)(s)}`:void 0,T=r.scopeValue("formats",{key:s,ref:b,code:x});return typeof b=="object"&&!(b instanceof RegExp)?[b.type||"string",b.validate,(0,le._)`${T}.validate`]:["string",b,T]}function A(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,le._)`await ${w}(${n})`}return typeof y=="function"?(0,le._)`${w}(${n})`:(0,le._)`${w}.test(${n})`}}}};Tl.default=nE});var o0=k(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});var oE=n0(),sE=[oE.default];Ol.default=sE});var s0=k(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.contentVocabulary=en.metadataVocabulary=void 0;en.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];en.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var a0=k(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});var iE=h_(),aE=E_(),cE=r0(),uE=o0(),i0=s0(),lE=[iE.default,aE.default,(0,cE.default)(),uE.default,i0.metadataVocabulary,i0.contentVocabulary];Rl.default=lE});var u0=k(zi=>{"use strict";Object.defineProperty(zi,"__esModule",{value:!0});zi.DiscrError=void 0;var c0;(function(e){e.Tag="tag",e.Mapping="mapping"})(c0||(zi.DiscrError=c0={}))});var d0=k(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});var tn=M(),Al=u0(),l0=ii(),dE=to(),fE=q(),pE={message:({params:{discrError:e,tagName:t}})=>e===Al.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,tn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},hE={keyword:"discriminator",type:"object",schemaType:"object",error:pE,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.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,tn._)`${r}${(0,tn.getProperty)(a)}`);t.if((0,tn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Al.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=p();t.if(!1);for(let h in f)t.elseIf((0,tn._)`${u} === ${h}`),t.assign(c,d(f[h]));t.else(),e.error(!1,{discrError:Al.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(f){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(m,tn.Name),h}function p(){var f;let h={},m=w(o),y=!0;for(let A=0;A<i.length;A++){let b=i[A];if(b?.$ref&&!(0,fE.schemaHasRulesButRef)(b,s.self.RULES)){let T=b.$ref;if(b=l0.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,T),b instanceof l0.SchemaEnv&&(b=b.schema),b===void 0)throw new dE.default(s.opts.uriResolver,s.baseId,T)}let x=(f=b?.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(m||w(b)),v(x,A)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function w({required:A}){return Array.isArray(A)&&A.includes(a)}function v(A,b){if(A.const)z(A.const,b);else if(A.enum)for(let x of A.enum)z(x,b);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(A,b){if(typeof A!="string"||A in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[A]=b}}}};Il.default=hE});var f0=k((G4,mE)=>{mE.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 Nl=k((ne,Cl)=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.MissingRefError=ne.ValidationError=ne.CodeGen=ne.Name=ne.nil=ne.stringify=ne.str=ne._=ne.KeywordCxt=ne.Ajv=void 0;var gE=c_(),yE=a0(),_E=d0(),p0=f0(),bE=["/properties"],ki="http://json-schema.org/draft-07/schema",rn=class extends gE.default{_addVocabularies(){super._addVocabularies(),yE.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(_E.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(p0,bE):p0;this.addMetaSchema(t,ki,!1),this.refs["http://json-schema.org/schema"]=ki}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ki)?ki:void 0)}};ne.Ajv=rn;Cl.exports=ne=rn;Cl.exports.Ajv=rn;Object.defineProperty(ne,"__esModule",{value:!0});ne.default=rn;var wE=eo();Object.defineProperty(ne,"KeywordCxt",{enumerable:!0,get:function(){return wE.KeywordCxt}});var nn=M();Object.defineProperty(ne,"_",{enumerable:!0,get:function(){return nn._}});Object.defineProperty(ne,"str",{enumerable:!0,get:function(){return nn.str}});Object.defineProperty(ne,"stringify",{enumerable:!0,get:function(){return nn.stringify}});Object.defineProperty(ne,"nil",{enumerable:!0,get:function(){return nn.nil}});Object.defineProperty(ne,"Name",{enumerable:!0,get:function(){return nn.Name}});Object.defineProperty(ne,"CodeGen",{enumerable:!0,get:function(){return nn.CodeGen}});var xE=oi();Object.defineProperty(ne,"ValidationError",{enumerable:!0,get:function(){return xE.default}});var vE=to();Object.defineProperty(ne,"MissingRefError",{enumerable:!0,get:function(){return vE.default}})});var x0=k(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.formatNames=ut.fastFormats=ut.fullFormats=void 0;function ct(e,t){return{validate:e,compare:t}}ut.fullFormats={date:ct(y0,Dl),time:ct(Zl(!0),Ll),"date-time":ct(h0(!0),b0),"iso-time":ct(Zl(),_0),"iso-date-time":ct(h0(),w0),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:EE,"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:NE,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:TE,int32:{type:"number",validate:AE},int64:{type:"number",validate:IE},float:{type:"number",validate:g0},double:{type:"number",validate:g0},password:!0,binary:!0};ut.fastFormats={...ut.fullFormats,date:ct(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Dl),time:ct(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ll),"date-time":ct(/^\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,b0),"iso-time":ct(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,_0),"iso-date-time":ct(/^\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,w0),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};ut.formatNames=Object.keys(ut.fullFormats);function $E(e){return e%4===0&&(e%100!==0||e%400===0)}var SE=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,zE=[0,31,28,31,30,31,30,31,31,30,31,30,31];function y0(e){let t=SE.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&$E(r)?29:zE[n])}function Dl(e,t){if(e&&t)return e>t?1:e<t?-1:0}var jl=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Zl(e){return function(r){let n=jl.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ll(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function _0(e,t){if(!(e&&t))return;let r=jl.exec(e),n=jl.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var Ml=/t|\s/i;function h0(e){let t=Zl(e);return function(n){let o=n.split(Ml);return o.length===2&&y0(o[0])&&t(o[1])}}function b0(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function w0(e,t){if(!(e&&t))return;let[r,n]=e.split(Ml),[o,s]=t.split(Ml),i=Dl(r,o);if(i!==void 0)return i||Ll(n,s)}var kE=/\/|:/,PE=/^(?:[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 EE(e){return kE.test(e)&&PE.test(e)}var m0=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function TE(e){return m0.lastIndex=0,m0.test(e)}var OE=-(2**31),RE=2**31-1;function AE(e){return Number.isInteger(e)&&e<=RE&&e>=OE}function IE(e){return Number.isInteger(e)}function g0(){return!0}var CE=/[^\\]\\Z/;function NE(e){if(CE.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var v0=k(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.formatLimitDefinition=void 0;var jE=Nl(),nt=M(),Kt=nt.operators,Pi={formatMaximum:{okStr:"<=",ok:Kt.LTE,fail:Kt.GT},formatMinimum:{okStr:">=",ok:Kt.GTE,fail:Kt.LT},formatExclusiveMaximum:{okStr:"<",ok:Kt.LT,fail:Kt.GTE},formatExclusiveMinimum:{okStr:">",ok:Kt.GT,fail:Kt.LTE}},ZE={message:({keyword:e,schemaCode:t})=>(0,nt.str)`should be ${Pi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,nt._)`{comparison: ${Pi[e].okStr}, limit: ${t}}`};on.formatLimitDefinition={keyword:Object.keys(Pi),type:"string",schemaType:"string",$data:!0,error:ZE,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new jE.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,nt._)`${p}[${c.schemaCode}]`);e.fail$data((0,nt.or)((0,nt._)`typeof ${f} != "object"`,(0,nt._)`${f} instanceof RegExp`,(0,nt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,nt._)`${i.code.formats}${(0,nt.getProperty)(p)}`:void 0});e.fail$data(d(h))}function d(p){return(0,nt._)`${p}.compare(${r}, ${n}) ${Pi[o].fail} 0`}},dependencies:["format"]};var ME=e=>(e.addKeyword(on.formatLimitDefinition),e);on.default=ME});var k0=k((yo,z0)=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});var sn=x0(),DE=v0(),Ul=M(),$0=new Ul.Name("fullFormats"),LE=new Ul.Name("fastFormats"),ql=(e,t={keywords:!0})=>{if(Array.isArray(t))return S0(e,t,sn.fullFormats,$0),e;let[r,n]=t.mode==="fast"?[sn.fastFormats,LE]:[sn.fullFormats,$0],o=t.formats||sn.formatNames;return S0(e,o,r,n),t.keywords&&(0,DE.default)(e),e};ql.get=(e,t="full")=>{let n=(t==="fast"?sn.fastFormats:sn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function S0(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Ul._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}z0.exports=yo=ql;Object.defineProperty(yo,"__esModule",{value:!0});yo.default=ql});var A0=k(Fl=>{"use strict";var T0=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,FE=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,O0=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,VE=/\\([\u000b\u0020-\u00ff])/g,BE=/([\\"])/g,R0=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Fl.format=HE;Fl.parse=KE;function HE(e){if(!e||typeof e!="object")throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R0.test(r))throw new TypeError("invalid type");var n=r;if(t&&typeof t=="object")for(var o,s=Object.keys(t).sort(),i=0;i<s.length;i++){if(o=s[i],!O0.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+WE(t[o])}return n}function KE(e){if(!e)throw new TypeError("argument string is required");var t=typeof e=="object"?JE(e):e;if(typeof t!="string")throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!R0.test(n))throw new TypeError("invalid media type");var o=new GE(n.toLowerCase());if(r!==-1){var s,i,a;for(T0.lastIndex=r;i=T0.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(VE,"$1"))),o.parameters[s]=a}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}function JE(e){var t;if(typeof e.getHeader=="function"?t=e.getHeader("content-type"):typeof e.headers=="object"&&(t=e.headers&&e.headers["content-type"]),typeof t!="string")throw new TypeError("content-type header is missing from object");return t}function WE(e){var t=String(e);if(O0.test(t))return t;if(t.length>0&&!FE.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(BE,"\\$1")+'"'}function GE(e){this.parameters=Object.create(null),this.type=e}});import{webcrypto as tO}from"node:crypto";import{hostname as rO}from"node:os";import{parseArgs as nO}from"node:util";var C={};oa(C,{BIGINT_FORMAT_RANGES:()=>Jo,CONSTANT_CATCH:()=>jd,Class:()=>ca,NUMBER_FORMAT_RANGES:()=>hn,aborted:()=>We,allowsEval:()=>pa,assert:()=>Lb,assertEqual:()=>jb,assertIs:()=>Mb,assertNever:()=>Db,assertNotEqual:()=>Zb,assignProp:()=>De,attachSchema:()=>Go,base64ToUint8Array:()=>Cd,base64urlToUint8Array:()=>sw,cached:()=>kr,captureStackTrace:()=>Ho,cleanEnum:()=>ow,cleanRegex:()=>pn,clone:()=>qe,cloneDef:()=>Fb,codePointLength:()=>mn,constantCatch:()=>Zd,createTransparentProxy:()=>Wb,defineLazy:()=>Pd,defineLazyInternal:()=>V,derived:()=>uw,esc:()=>da,escapeRegex:()=>mt,explicitlyAborted:()=>ga,extend:()=>Yb,finalizeIssue:()=>Ge,floatSafeRemainder:()=>la,getElementAtPath:()=>Vb,getEnumValues:()=>Sr,getLengthableOrigin:()=>gn,getParsedType:()=>Jb,getSizableOrigin:()=>Id,hexToUint8Array:()=>aw,hide:()=>Xo,installLazyProp:()=>pw,isObject:()=>er,isPlainObject:()=>At,issue:()=>Er,joinValues:()=>Bo,jsonStringifyReplacer:()=>zr,members:()=>_a,merge:()=>ew,mergeDefs:()=>ht,normalizeParams:()=>R,nullish:()=>ua,numKeys:()=>Kb,objectClone:()=>Ub,omit:()=>Xb,optionalKeys:()=>ma,own:()=>Rt,parsedType:()=>ya,partial:()=>tw,pick:()=>Gb,prefixIssues:()=>gt,primitiveTypes:()=>Rd,promiseAllObject:()=>Bb,propertyKeyTypes:()=>ha,randomString:()=>Hb,rawShape:()=>Pr,required:()=>rw,safeExtend:()=>Qb,shallowClone:()=>Od,slugify:()=>fa,stringifyPrimitive:()=>Ko,toZod:()=>kd,uint8ArrayToBase64:()=>Nd,uint8ArrayToBase64url:()=>iw,uint8ArrayToHex:()=>cw,unwrapMessage:()=>$r});function jb(e){return e}function Zb(e){return e}function kd(){return e=>e}function Mb(e){}function Db(e){throw new Error("Unexpected value in exhaustive check")}function Lb(e){}function Sr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Bo(e,t="|"){return e.map(r=>Ko(r)).join(t)}function zr(e,t){return typeof t=="bigint"?t.toString():t}var aa=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function kr(e){return new aa(e)}function ua(e){return e==null}function pn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function la(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var zd=Symbol("evaluating");function Pd(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==zd)return n===void 0&&(n=zd,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ub(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function De(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Pr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function pt(e){return Pr(e._zod.def)??e._zod.def.shape}function Ed(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return De(this,t,n),n},enumerable:!0,configurable:!0})}function Td(e,t,r){t in e?De(e,t,r):e[t]=r}function Qt(e,t,r,n){let o=pt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);i.enumerable&&(i.get?Ed(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a}):Td(e,s,n?n(i.value,s):i.value))}}function qb(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Ed(e,r,()=>t[r]):Td(e,r,n.value))}}function ht(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Fb(e){return ht(e._zod.def)}function Vb(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Bb(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function Hb(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function da(e){return JSON.stringify(e)}function fa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ho="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function er(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var pa=kr(()=>{if(Re.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function At(e){if(er(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(er(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Od(e){return At(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Kb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Jb=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}`)}},ha=new Set(["string","number","symbol"]),Rd=new Set(["string","number","bigint","boolean","symbol","undefined"]);function mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qe(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function 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 Wb(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Ko(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ma(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var hn={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]},Jo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Gb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return Qt(s,e,Wo(e,t)),qe(e,ht(r,{shape:s,checks:[]}))}function Wo(e,t){let r=pt(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Xb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Wo(e,t)),i={};return Qt(i,e,Reflect.ownKeys(pt(e)).filter(a=>!s.has(a))),qe(e,ht(r,{shape:i,checks:[]}))}function Yb(e,t){if(!At(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=pt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return qe(e,ht(e._zod.def,{shape:Ad(e,t)}))}function Ad(e,t){let r={};return Qt(r,e,Reflect.ownKeys(pt(e))),qb(r,t),r}function Qb(e,t){if(!At(t))throw new Error("Invalid input to safeExtend: expected a plain object");return qe(e,ht(e._zod.def,{shape:Ad(e,t)}))}function ew(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Qt(r,e,Reflect.ownKeys(pt(e))),Qt(r,t,Reflect.ownKeys(pt(t)));let n=ht(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return qe(e,n)}function tw(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Wo(t,r)):void 0,c={};return Qt(c,t,Reflect.ownKeys(pt(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),qe(t,ht(t._zod.def,{shape:c,checks:[]}))}function rw(e,t,r){let n=r?new Set(Wo(t,r)):void 0,o={};return Qt(o,t,Reflect.ownKeys(pt(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),qe(t,ht(t._zod.def,{shape:o}))}function We(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 ga(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 gt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function $r(e){return typeof e=="string"?e:e?.message}function Go(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Ge(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:$r(e.inst?._zod.def?.error?.(e))??$r(s?.(e))??$r(t?.error?.(e))??$r(r.customError?.(e))??$r(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function Id(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var nw=/[\uD800-\uDBFF]/;function mn(e){let t=e.length;if(!nw.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function gn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ya(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 Er(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function ow(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Cd(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Nd(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function sw(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Cd(t+r)}function iw(e){return Nd(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function aw(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function cw(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ca=class{constructor(...t){}};function _a(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):lw(e,r,n.value)}}function Rt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Xo(e,t,r){return Rt(e,t,r,!1)}function uw(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Rt(this,r,n(this))},set(o){Rt(this,r,o)}})}return t}function lw(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Rt(this,t,r.bind(this))},set(n){Rt(this,t,n)}})}function dw(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ia,Ot=!1,fw={configurable:!0,get(){Ot=!0}};function V(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ia!==e._zod){ia=void 0;return}ia=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,fw);let o=Ot;Ot=!1;try{let s=r(this);return Ot?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),Ot=Ot||o,s}catch(s){throw delete this[t],Ot=Ot||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function pw(e,t,r,n){let o=dw(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var jd="~constantCatch";function Zd(e){let t=()=>e;return t[jd]=!0,t}var Md,wa=Object.freeze({status:"aborted"}),ba={value:void 0,enumerable:!1},Dd="captureStackTrace"in Error?Error:null;function hw(e){let t=Dd;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Dd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function _(e,t,r,n){let o={};function s(p){this.def=p,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(p,f){if(p._zod){if(p._zod.traits.has(e))return}else{ba.value=new s(f);try{Object.defineProperty(p,"_zod",ba)}finally{ba.value=void 0}}if(p._zod.traits.add(e),t(p,f),a){let m=Object.getPrototypeOf(p),y=p._zod.constr.prototype,w=m;for(;w&&w!==y;)w=Object.getPrototypeOf(w);let v=w??m;a.has(v)||(a.add(v),_a(v,i))}let h=d.prototype;for(let m in h)Object.prototype.hasOwnProperty.call(h,m)&&(m in p||(p[m]=h[m].bind(p)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(p){let f=n?.Parent?hw(l):this;c(f,p);let h=f._zod.deferred;if(h){for(let y of h)y();f._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;return m&&m(f),f}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var 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"}};(Md=globalThis).__zod_globalConfig??(Md.__zod_globalConfig={});var Re=globalThis.__zod_globalConfig;function Ae(e){return e&&Object.assign(Re,e),Re}function mw(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,zr,2)),e.message}function gw(e){this._zod.message=e}var yw={get:mw,set:gw,enumerable:!0,configurable:!0},va={value:void 0,enumerable:!1},Ld=new WeakSet([Object.prototype,Error.prototype]),Ud=(e,t)=>{e.name="$ZodError",va.value=t,Object.defineProperty(e,"issues",va),va.value=void 0,Object.defineProperty(e,"message",yw);let r=Object.getPrototypeOf(e);Ld.has(r)||(Ld.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},qd=_("$ZodError",Ud),Fd=_("$ZodError",Ud,void 0,{Parent:Error});function _w(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function $a(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?_w(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Sa(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({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],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[l];d&&p._errors.push(t(i)),c=p,u++}}}};return n(e),r}function Yo(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Qo=e=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Xe;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>Ge(u,i,Ae())));throw Ho(c,s?.callee??t),c}return a.value};return t};var es=e=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>Ge(u,i,Ae())));throw Ho(c,s?.callee??t),c}return a.value};return t};var yn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Xe;return s.issues.length?Vd(e,s.issues,o):{success:!0,data:s.value}},za=yn(Fd);function Vd(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Ge(o,r,Ae()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var ts=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?Vd(e,s.issues,o):{success:!0,data:s.value}};var ww=Symbol.for("zod.compile.invalid"),xw=Symbol.for("zod.compile.fallback"),rs=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ww)return!0;if(n.definite===!0&&r===void 0)return!1}return vw(e,t,r)});function vw(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o?(n[xw]=!0,s=o({value:t,issues:[]},n)):s=e._zod.run({value:t,issues:[]},n),s instanceof Promise)throw new Xe;return s.issues.length===0}var ns=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},Bd=e=>{let t=Qo(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,Yo(r,i))};return r};var Hd=e=>{let t=Qo(e),r=(n,o,s,i)=>t(n,o,s,Yo(r,i));return r};var Kd=e=>{let t=es(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Yo(r,i))};return r};var Jd=e=>{let t=es(e),r=async(n,o,s,i)=>await t(n,o,s,Yo(r,i));return r};var Wd=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return yn(e)(t,r,o)};var Gd=e=>(t,r,n)=>yn(e)(t,r,n);var Xd=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ts(e)(t,r,o)};var Yd=e=>async(t,r,n)=>ts(e)(t,r,n);var Qd=/^[cC][0-9a-z]{6,}$/,ef=/^[0-9a-z]+$/,tf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,rf=/^[0-9a-vA-V]{20}$/,nf=/^[A-Za-z0-9]{27}$/,of=/^[a-zA-Z0-9_-]{21}$/;function sf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var af=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var cf=/^([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})$/,Pa=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 uf=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var $w="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function lf(){return new RegExp($w,"u")}var df=/^(?:(?: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])$/,ff=/^(([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 pf=/^((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])$/,hf=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var yf=/^https?$/,_f=/^\+[1-9]\d{6,14}$/;var bf="(?:(?:\\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])))";function Sw(e){return new RegExp(`^${e}$`)}var wf=Sw(bf);function ka(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function xf(e){return new RegExp(`^${ka(e)}$`)}function vf(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${ka({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${ka({precision:e.precision})}`:r;return new RegExp(`^${bf}T(?:${n})$`)}var $f=/^[\s\S]{0,}$/;var Sf=/^-?\d+n?$/,Ea=/^-?\d+$/,_n=/^-?\d+(?:\.\d+)?$/,zf=/^(?:true|false)$/i,kf=/^null$/i;var Pf=/^[^A-Z]*$/,Ef=/^[^a-z]*$/;var me=_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ta=e=>{let t=e.value;return!ua(t)&&t.length!==void 0},os={number:"number",bigint:"bigint",object:"date"},Oa=_("$ZodCheckLessThan",(e,t)=>{me.init(e,t);let r=os[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:os[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ra=_("$ZodCheckGreaterThan",(e,t)=>{me.init(e,t);let r=os[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:os[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Tf=_("$ZodCheckMultipleOf",(e,t)=>{me.init(e,t),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"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):la(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})}}),Of=_("$ZodCheckNumberFormat",(e,t)=>{me.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=hn[t.format];e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,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:n,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:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,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 Rf=_("$ZodCheckMaxLength",(e,t)=>{var r;me.init(e,t),(r=e._zod.def).when??(r.when=Ta),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>t.maximum?mn(o):s)<=t.maximum)return;let a=gn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Af=_("$ZodCheckMinLength",(e,t)=>{var r;me.init(e,t),(r=e._zod.def).when??(r.when=Ta),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>=t.minimum&&s<t.minimum*2?mn(o):s)>=t.minimum)return;let a=gn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),If=_("$ZodCheckLengthEquals",(e,t)=>{var r;me.init(e,t),(r=e._zod.def).when??(r.when=Ta),e._zod.check=n=>{let o=n.value,s=o.length,i=typeof o=="string"&&s>=t.length&&s<=t.length*2?mn(o):s;if(i===t.length)return;let a=gn(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bn=_("$ZodCheckStringFormat",(e,t)=>{var r,n;me.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Cf=_("$ZodCheckRegex",(e,t)=>{bn.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})}}),Nf=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Pf),bn.init(e,t)}),jf=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ef),bn.init(e,t)}),Zf=_("$ZodCheckIncludes",(e,t)=>{me.init(e,t);let r=mt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Mf=_("$ZodCheckStartsWith",(e,t)=>{me.init(e,t);let r=new RegExp(`^${mt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Df=_("$ZodCheckEndsWith",(e,t)=>{me.init(e,t);let r=new RegExp(`.*${mt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Lf=_("$ZodCheckOverwrite",(e,t)=>{me.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ss=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
10
|
+
deps: ${r}}`};var tE={keyword:"dependencies",type:"object",schemaType:"object",error:ht.error,code(e){let[t,r]=rE(e);p0(e,t),h0(e,r)}};function rE({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function p0(e,t=e.schema){let{gen:r,data:n,it:o}=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,Ao.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Ao.checkReportMissingProp)(e,u)}):(r.if((0,Zl._)`${c} && (${(0,Ao.checkMissingProp)(e,a,s)})`),(0,Ao.reportMissingProp)(e,s),r.else())}}ht.validatePropertyDeps=p0;function h0(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,eE.alwaysValidSchema)(s,t[a])||(r.if((0,Ao.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}ht.validateSchemaDeps=h0;ht.default=tE});var y0=E(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});var g0=L(),nE=B(),oE={message:"property name must be valid",params:({params:e})=>(0,g0._)`{propertyName: ${e.propertyName}}`},sE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:oE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,nE.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,g0.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};Dl.default=sE});var Ll=E(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:!0});var Di=We(),it=L(),iE=Ot(),Mi=B(),aE={message:"must NOT have additional properties",params:({params:e})=>(0,it._)`{additionalProperty: ${e.additionalProperty}}`},cE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:aE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,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,Mi.alwaysValidSchema)(i,r))return;let u=(0,Di.allSchemaProperties)(n.properties),l=(0,Di.allSchemaProperties)(n.patternProperties);d(),e.ok((0,it._)`${s} === ${iE.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?h(y):t.if(p(y),()=>h(y))})}function p(y){let w;if(u.length>8){let v=(0,Mi.schemaRefOrVal)(i,n.properties,"properties");w=(0,Di.isOwnProperty)(t,v,y)}else u.length?w=(0,it.or)(...u.map(v=>(0,it._)`${y} === ${v}`)):w=it.nil;return l.length&&(w=(0,it.or)(w,...l.map(v=>(0,it._)`${(0,Di.usePattern)(e,v)}.test(${y})`))),(0,it.not)(w)}function f(y){t.code((0,it._)`delete ${o}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Mi.alwaysValidSchema)(i,r)){let w=t.name("valid");c.removeAdditional==="failing"?(m(y,w,!1),t.if((0,it.not)(w),()=>{e.reset(),f(y)})):(m(y,w),a||t.if((0,it.not)(w),()=>t.break()))}}function m(y,w,v){let S={keyword:"additionalProperties",dataProp:y,dataPropType:Mi.Type.Str};v===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(S,w)}}};Ml.default=cE});var w0=E(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});var uE=yo(),_0=We(),Ul=B(),b0=Ll(),lE={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&b0.default.code(new uE.KeywordCxt(s,b0.default,"additionalProperties"));let i=(0,_0.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ul.mergeEvaluated.props(t,(0,Ul.toHash)(i),s.props));let a=i.filter(d=>!(0,Ul.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,_0.propertyInData)(t,o,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)}}};ql.default=lE});var S0=E(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});var x0=We(),Li=L(),v0=B(),$0=B(),dE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,x0.allSchemaProperties)(r),c=a.filter(m=>(0,v0.alwaysValidSchema)(s,r[m]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof Li.Name)&&(s.props=(0,$0.evaluatedPropsToName)(t,s.props));let{props:d}=s;p();function p(){for(let m of a)u&&f(m),s.allErrors?h(m):(t.var(l,!0),h(m),t.if(l))}function f(m){for(let y in u)new RegExp(m).test(y)&&(0,v0.checkStrictMode)(s,`property ${y} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,y=>{t.if((0,Li._)`${(0,x0.usePattern)(e,m)}.test(${y})`,()=>{let w=c.includes(m);w||e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:y,dataPropType:$0.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,Li._)`${d}[${y}]`,!0):!w&&!s.allErrors&&t.if((0,Li.not)(l),()=>t.break())})})}}};Fl.default=dE});var z0=E(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});var fE=B(),pE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,fE.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Bl.default=pE});var k0=E(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});var hE=We(),mE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hE.validateUnion,error:{message:"must match a schema in anyOf"}};Vl.default=mE});var P0=E(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});var Ui=L(),gE=B(),yE={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Ui._)`{passingSchemas: ${e.passing}}`},_E={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:yE,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.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 p;(0,gE.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Ui._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Ui._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),p&&e.mergeEvaluated(p,Ui.Name)})})}}};Hl.default=_E});var E0=E(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});var bE=B(),wE={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,bE.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Kl.default=wE});var R0=E(Jl=>{"use strict";Object.defineProperty(Jl,"__esModule",{value:!0});var qi=L(),O0=B(),xE={message:({params:e})=>(0,qi.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,qi._)`{failingKeyword: ${e.ifClause}}`},vE={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:xE,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,O0.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=T0(n,"then"),s=T0(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,qi.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 p=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(p,i),d?t.assign(d,(0,qi._)`${l}`):e.setParams({ifClause:l})}}}};function T0(e,t){let r=e.schema[t];return r!==void 0&&!(0,O0.alwaysValidSchema)(e,r)}Jl.default=vE});var A0=E(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});var $E=B(),SE={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,$E.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Wl.default=SE});var C0=E(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});var zE=Al(),kE=u0(),PE=Cl(),EE=d0(),TE=f0(),OE=m0(),RE=y0(),AE=Ll(),CE=w0(),IE=S0(),NE=z0(),jE=k0(),ZE=P0(),DE=E0(),ME=R0(),LE=A0();function UE(e=!1){let t=[NE.default,jE.default,ZE.default,DE.default,ME.default,LE.default,RE.default,AE.default,OE.default,CE.default,IE.default];return e?t.push(kE.default,EE.default):t.push(zE.default,PE.default),t.push(TE.default),t}Gl.default=UE});var I0=E(Xl=>{"use strict";Object.defineProperty(Xl,"__esModule",{value:!0});var de=L(),qE={message:({schemaCode:e})=>(0,de.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,de._)`{format: ${e}}`},FE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:qE,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?p():f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,de._)`${h}[${i}]`),y=r.let("fType"),w=r.let("format");r.if((0,de._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(y,(0,de._)`${m}.type || "string"`).assign(w,(0,de._)`${m}.validate`),()=>r.assign(y,(0,de._)`"string"`).assign(w,m)),e.fail$data((0,de.or)(v(),S()));function v(){return c.strictSchema===!1?de.nil:(0,de._)`${i} && !${w}`}function S(){let T=l.$async?(0,de._)`(${m}.async ? await ${w}(${n}) : ${w}(${n}))`:(0,de._)`${w}(${n})`,_=(0,de._)`(typeof ${w} == "function" ? ${T} : ${w}.test(${n}))`;return(0,de._)`${w} && ${w} !== true && ${y} === ${t} && !${_}`}}function f(){let h=d.formats[s];if(!h){v();return}if(h===!0)return;let[m,y,w]=S(h);m===t&&e.pass(T());function v(){if(c.strictSchema===!1){d.logger.warn(_());return}throw new Error(_());function _(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function S(_){let x=_ instanceof RegExp?(0,de.regexpCode)(_):c.code.formats?(0,de._)`${c.code.formats}${(0,de.getProperty)(s)}`:void 0,$=r.scopeValue("formats",{key:s,ref:_,code:x});return typeof _=="object"&&!(_ instanceof RegExp)?[_.type||"string",_.validate,(0,de._)`${$}.validate`]:["string",_,$]}function T(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,de._)`await ${w}(${n})`}return typeof y=="function"?(0,de._)`${w}(${n})`:(0,de._)`${w}.test(${n})`}}}};Xl.default=FE});var N0=E(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});var BE=I0(),VE=[BE.default];Yl.default=VE});var j0=E(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.contentVocabulary=dn.metadataVocabulary=void 0;dn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];dn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var D0=E(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});var HE=V_(),KE=s0(),JE=C0(),WE=N0(),Z0=j0(),GE=[HE.default,KE.default,(0,JE.default)(),WE.default,Z0.metadataVocabulary,Z0.contentVocabulary];Ql.default=GE});var L0=E(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});Fi.DiscrError=void 0;var M0;(function(e){e.Tag="tag",e.Mapping="mapping"})(M0||(Fi.DiscrError=M0={}))});var q0=E(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});var fn=L(),ed=L0(),U0=Si(),XE=_o(),YE=B(),QE={message:({params:{discrError:e,tagName:t}})=>e===ed.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,fn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},eT={keyword:"discriminator",type:"object",schemaType:"object",error:QE,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.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,fn._)`${r}${(0,fn.getProperty)(a)}`);t.if((0,fn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:ed.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=p();t.if(!1);for(let h in f)t.elseIf((0,fn._)`${u} === ${h}`),t.assign(c,d(f[h]));t.else(),e.error(!1,{discrError:ed.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(f){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(m,fn.Name),h}function p(){var f;let h={},m=w(o),y=!0;for(let T=0;T<i.length;T++){let _=i[T];if(_?.$ref&&!(0,YE.schemaHasRulesButRef)(_,s.self.RULES)){let $=_.$ref;if(_=U0.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,$),_ instanceof U0.SchemaEnv&&(_=_.schema),_===void 0)throw new XE.default(s.opts.uriResolver,s.baseId,$)}let x=(f=_?.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(m||w(_)),v(x,T)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return h;function w({required:T}){return Array.isArray(T)&&T.includes(a)}function v(T,_){if(T.const)S(T.const,_);else if(T.enum)for(let x of T.enum)S(x,_);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(T,_){if(typeof T!="string"||T in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[T]=_}}}};td.default=eT});var F0=E((H4,tT)=>{tT.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 nd=E((oe,rd)=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.MissingRefError=oe.ValidationError=oe.CodeGen=oe.Name=oe.nil=oe.stringify=oe.str=oe._=oe.KeywordCxt=oe.Ajv=void 0;var rT=M_(),nT=D0(),oT=q0(),B0=F0(),sT=["/properties"],Bi="http://json-schema.org/draft-07/schema",pn=class extends rT.default{_addVocabularies(){super._addVocabularies(),nT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(oT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(B0,sT):B0;this.addMetaSchema(t,Bi,!1),this.refs["http://json-schema.org/schema"]=Bi}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Bi)?Bi:void 0)}};oe.Ajv=pn;rd.exports=oe=pn;rd.exports.Ajv=pn;Object.defineProperty(oe,"__esModule",{value:!0});oe.default=pn;var iT=yo();Object.defineProperty(oe,"KeywordCxt",{enumerable:!0,get:function(){return iT.KeywordCxt}});var hn=L();Object.defineProperty(oe,"_",{enumerable:!0,get:function(){return hn._}});Object.defineProperty(oe,"str",{enumerable:!0,get:function(){return hn.str}});Object.defineProperty(oe,"stringify",{enumerable:!0,get:function(){return hn.stringify}});Object.defineProperty(oe,"nil",{enumerable:!0,get:function(){return hn.nil}});Object.defineProperty(oe,"Name",{enumerable:!0,get:function(){return hn.Name}});Object.defineProperty(oe,"CodeGen",{enumerable:!0,get:function(){return hn.CodeGen}});var aT=vi();Object.defineProperty(oe,"ValidationError",{enumerable:!0,get:function(){return aT.default}});var cT=_o();Object.defineProperty(oe,"MissingRefError",{enumerable:!0,get:function(){return cT.default}})});var Y0=E(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.formatNames=gt.fastFormats=gt.fullFormats=void 0;function mt(e,t){return{validate:e,compare:t}}gt.fullFormats={date:mt(J0,ad),time:mt(sd(!0),cd),"date-time":mt(V0(!0),G0),"iso-time":mt(sd(),W0),"iso-date-time":mt(V0(),X0),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:hT,"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:xT,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:mT,int32:{type:"number",validate:_T},int64:{type:"number",validate:bT},float:{type:"number",validate:K0},double:{type:"number",validate:K0},password:!0,binary:!0};gt.fastFormats={...gt.fullFormats,date:mt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,ad),time:mt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,cd),"date-time":mt(/^\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,G0),"iso-time":mt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,W0),"iso-date-time":mt(/^\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,X0),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};gt.formatNames=Object.keys(gt.fullFormats);function uT(e){return e%4===0&&(e%100!==0||e%400===0)}var lT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function J0(e){let t=lT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&uT(r)?29:dT[n])}function ad(e,t){if(e&&t)return e>t?1:e<t?-1:0}var od=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function sd(e){return function(r){let n=od.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function cd(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function W0(e,t){if(!(e&&t))return;let r=od.exec(e),n=od.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var id=/t|\s/i;function V0(e){let t=sd(e);return function(n){let o=n.split(id);return o.length===2&&J0(o[0])&&t(o[1])}}function G0(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function X0(e,t){if(!(e&&t))return;let[r,n]=e.split(id),[o,s]=t.split(id),i=ad(r,o);if(i!==void 0)return i||cd(n,s)}var fT=/\/|:/,pT=/^(?:[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 hT(e){return fT.test(e)&&pT.test(e)}var H0=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function mT(e){return H0.lastIndex=0,H0.test(e)}var gT=-(2**31),yT=2**31-1;function _T(e){return Number.isInteger(e)&&e<=yT&&e>=gT}function bT(e){return Number.isInteger(e)}function K0(){return!0}var wT=/[^\\]\\Z/;function xT(e){if(wT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Q0=E(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.formatLimitDefinition=void 0;var vT=nd(),at=L(),Qt=at.operators,Vi={formatMaximum:{okStr:"<=",ok:Qt.LTE,fail:Qt.GT},formatMinimum:{okStr:">=",ok:Qt.GTE,fail:Qt.LT},formatExclusiveMaximum:{okStr:"<",ok:Qt.LT,fail:Qt.GTE},formatExclusiveMinimum:{okStr:">",ok:Qt.GT,fail:Qt.LTE}},$T={message:({keyword:e,schemaCode:t})=>(0,at.str)`should be ${Vi[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,at._)`{comparison: ${Vi[e].okStr}, limit: ${t}}`};mn.formatLimitDefinition={keyword:Object.keys(Vi),type:"string",schemaType:"string",$data:!0,error:$T,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new vT.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,at._)`${p}[${c.schemaCode}]`);e.fail$data((0,at.or)((0,at._)`typeof ${f} != "object"`,(0,at._)`${f} instanceof RegExp`,(0,at._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,at._)`${i.code.formats}${(0,at.getProperty)(p)}`:void 0});e.fail$data(d(h))}function d(p){return(0,at._)`${p}.compare(${r}, ${n}) ${Vi[o].fail} 0`}},dependencies:["format"]};var ST=e=>(e.addKeyword(mn.formatLimitDefinition),e);mn.default=ST});var nb=E((Co,rb)=>{"use strict";Object.defineProperty(Co,"__esModule",{value:!0});var gn=Y0(),zT=Q0(),ud=L(),eb=new ud.Name("fullFormats"),kT=new ud.Name("fastFormats"),ld=(e,t={keywords:!0})=>{if(Array.isArray(t))return tb(e,t,gn.fullFormats,eb),e;let[r,n]=t.mode==="fast"?[gn.fastFormats,kT]:[gn.fullFormats,eb],o=t.formats||gn.formatNames;return tb(e,o,r,n),t.keywords&&(0,zT.default)(e),e};ld.get=(e,t="full")=>{let n=(t==="fast"?gn.fastFormats:gn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function tb(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,ud._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}rb.exports=Co=ld;Object.defineProperty(Co,"__esModule",{value:!0});Co.default=ld});var ub=E(dd=>{"use strict";var ib=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,TT=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,ab=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,OT=/\\([\u000b\u0020-\u00ff])/g,RT=/([\\"])/g,cb=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;dd.format=AT;dd.parse=CT;function AT(e){if(!e||typeof e!="object")throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!cb.test(r))throw new TypeError("invalid type");var n=r;if(t&&typeof t=="object")for(var o,s=Object.keys(t).sort(),i=0;i<s.length;i++){if(o=s[i],!ab.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+NT(t[o])}return n}function CT(e){if(!e)throw new TypeError("argument string is required");var t=typeof e=="object"?IT(e):e;if(typeof t!="string")throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!cb.test(n))throw new TypeError("invalid media type");var o=new jT(n.toLowerCase());if(r!==-1){var s,i,a;for(ib.lastIndex=r;i=ib.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(OT,"$1"))),o.parameters[s]=a}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}function IT(e){var t;if(typeof e.getHeader=="function"?t=e.getHeader("content-type"):typeof e.headers=="object"&&(t=e.headers&&e.headers["content-type"]),typeof t!="string")throw new TypeError("content-type header is missing from object");return t}function NT(e){var t=String(e);if(ab.test(t))return t;if(t.length>0&&!TT.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(RT,"\\$1")+'"'}function jT(e){this.parameters=Object.create(null),this.type=e}});import{webcrypto as _O}from"node:crypto";import{parseArgs as bO}from"node:util";import{spawnSync as gw}from"node:child_process";import{createInterface as yw}from"node:readline/promises";function ua(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var Jo=e=>e?`"${e}" `:"";function Fb(e,t=""){if(typeof e!="boolean")throw new TypeError(Jo(t)+"expected boolean, got type="+typeof e);return e}function Wo(e,t=""){if(typeof e!="number")throw new TypeError(Jo(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Jo(t)+"expected integer >= 0, got "+e);return e}function me(e,t,r=""){if(ua(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Wo(t,"length");let n=ua(e),o=t!==void 0?` of length ${t}`:"",s=n?`length=${e.length}`:`type=${typeof e}`,i=Jo(r)+"expected Uint8Array"+o+", got "+s;throw n?new RangeError(i):new TypeError(i)}function Go(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Bb(e,t){me(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function la(e,t){if(Bb(e,t),!Or(e))throw new Error("invalid output, must be aligned")}function zd(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function _t(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ut(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Er(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Tr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function da(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}var ue=Tr?e=>e:e=>da(e)>>>0;function Vb(e){for(let t=0;t<e.length;t++)e[t]=da(e[t]);return e}var bn=Tr?e=>e:Vb;function kd(e,t){if(e=me(e),t=me(t),e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function fa(e,t,r){let n=t,o=r||(()=>[]),s=(a,c)=>n(c,...o(a)).update(a).digest(),i=n(new Uint8Array(e),...o(new Uint8Array(0)));return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.create=(a,...c)=>n(a,...c),s}var Pd=(e,t)=>{function r(n,...o){if(me(n,void 0,"key"),e.nonceLength!==void 0){let d=o[0];me(d,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let s=e.tagLength,i=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let d=i;d<o.length;d++)if(ua(o[d]))throw new Error("AAD not supported")}e.withAAD&&o[i]!==void 0&&me(o[i],void 0,"AAD");let a=t(n,...o),c=(d,p)=>{if(p!==void 0){if(d!==2)throw new Error("cipher output not supported");me(p,void 0,"output")}},u=!1;return{encrypt(d,p){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,me(d,void 0,"data"),c(a.encrypt.length,p),a.encrypt(d,p)},decrypt(d,p){if(me(d,void 0,"data"),s&&d.length<s)throw new Error('"ciphertext" expected length >= tagLength='+s);return c(a.decrypt.length,p),a.decrypt(d,p)}}}return Object.assign(r,e),r};function Ed(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if(me(t,e,"output"),r&&!Or(t))throw new Error("invalid output, must be aligned");return t}function Td(e,t,r){Wo(e),Wo(t),Fb(r);let n=new Uint8Array(16),o=Er(n);return o.setBigUint64(0,BigInt(t),r),o.setBigUint64(8,BigInt(e),r),n}function Or(e){return e.byteOffset%4===0}function tr(e){return Uint8Array.from(me(e))}var rr=16,Od=new Uint8Array(16),wn=_t(Od),Hb=225,Kb=(e,t,r,n)=>{let o=n&1;return{s3:r<<31|n>>>1,s2:t<<31|r>>>1,s1:e<<31|t>>>1,s0:e>>>1^Hb<<24&-(o&1)}},Xo=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;var Jb=e=>e>64*1024?8:e>1024?4:2,pa=class{blockLen=rr;outputLen=rr;s0=0;s1=0;s2=0;s3=0;finished=!1;destroyed=!1;t;W;windowSize;constructor(t,r){me(t,16,"key"),t=tr(t);let n=Er(t),o=n.getUint32(0,!1),s=n.getUint32(4,!1),i=n.getUint32(8,!1),a=n.getUint32(12,!1),c=[];for(let h=0;h<128;h++)c.push({s0:Xo(o),s1:Xo(s),s2:Xo(i),s3:Xo(a)}),{s0:o,s1:s,s2:i,s3:a}=Kb(o,s,i,a);let u=Jb(r||1024);if(![1,2,4,8].includes(u))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=u;let d=128/u,p=this.windowSize=2**u,f=[];for(let h=0;h<d;h++)for(let m=0;m<p;m++){let y=0,w=0,v=0,S=0;for(let T=0;T<u;T++){if(!(m>>>u-T-1&1))continue;let{s0:x,s1:$,s2:P,s3:O}=c[u*h+T];y^=x,w^=$,v^=P,S^=O}f.push({s0:y,s1:w,s2:v,s3:S})}this.t=f}_updateBlock(t,r,n,o){t^=this.s0,r^=this.s1,n^=this.s2,o^=this.s3;let{W:s,t:i,windowSize:a}=this,c=0,u=0,l=0,d=0,p=(1<<s)-1,f=0;for(let h of[t,r,n,o])for(let m=0;m<4;m++){let y=h>>>8*m&255;for(let w=8/s-1;w>=0;w--){let v=y>>>s*w&p,{s0:S,s1:T,s2:_,s3:x}=i[f*a+v];c^=S,u^=T,l^=_,d^=x,f+=1}}this.s0=c,this.s1=u,this.s2=l,this.s3=d}update(t){Go(this),me(t),t=tr(t);let r=_t(t),n=Math.floor(t.length/rr),o=t.length%rr;for(let s=0;s<n;s++)this._updateBlock(ue(r[s*4+0]),ue(r[s*4+1]),ue(r[s*4+2]),ue(r[s*4+3]));return o&&(Od.set(t.subarray(n*rr)),this._updateBlock(ue(wn[0]),ue(wn[1]),ue(wn[2]),ue(wn[3])),ut(wn)),this}destroy(){this.destroyed=!0;let{t}=this;for(let r of t)r.s0=0,r.s1=0,r.s2=0,r.s3=0}digestInto(t){Go(this),la(t,this),this.finished=!0;let{s0:r,s1:n,s2:o,s3:s}=this,i=_t(t);i[0]=r,i[1]=n,i[2]=o,i[3]=s,Tr||bn(i.subarray(0,rr/4))}digest(){let t=new Uint8Array(rr);return this.digestInto(t),this.destroy(),t}};var ha=fa(16,(e,t)=>new pa(e,t),e=>[e.length]);var ga=16,Wb=4,Yo=new Uint8Array(ga);var Gb=283;function Xb(e){if(![16,24,32].includes(e.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+e.length)}function ya(e){return e<<1^Gb&-(e>>7)}function Rd(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(t&1),e=ya(e);return r}var Yb=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=ya(n))e[r]=n;let t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=(n^n>>4^n>>5^n>>6^n>>7^99)&255}return ut(e),t})();var Qb=e=>e<<24|e>>>8,ma=e=>e<<8|e>>>24;function ew(e,t){if(e.length!==256)throw new Error("wrong sbox length");let r=new Uint32Array(256).map((u,l)=>t(e[l])),n=r.map(ma),o=n.map(ma),s=o.map(ma),i=new Uint32Array(256*256),a=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let u=0;u<256;u++)for(let l=0;l<256;l++){let d=u*256+l;i[d]=r[u]^n[l],a[d]=o[u]^s[l],c[d]=e[u]<<8|e[l]}return{sbox:e,sbox2:c,T0:r,T1:n,T2:o,T3:s,T01:i,T23:a}}var Cd=ew(Yb,e=>Rd(e,3)<<24|e<<16|e<<8|Rd(e,2));var tw=(()=>{let e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=ya(r))e[t]=r;return e})();function rw(e){me(e);let t=e.length;Xb(e);let{sbox2:r}=Cd,n=[];(!Tr||!Or(e))&&n.push(e=tr(e));let o=bn(_t(e)),s=o.length,i=c=>xn(r,c,c,c,c),a=new Uint32Array(t+28);a.set(o);for(let c=s;c<a.length;c++){let u=a[c-1];c%s===0?u=i(Qb(u))^tw[c/s-1]:s>6&&c%s===4&&(u=i(u)),a[c]=a[c-s]^u}return ut(...n),a}function Qo(e,t,r,n,o,s){return e[r<<8&65280|n>>>8&255]^t[o>>>8&65280|s>>>24&255]}function xn(e,t,r,n,o){return e[t&255|r&65280]|e[n>>>16&255|o>>>16&65280]<<16}function Ad(e,t,r,n,o){let{sbox2:s,T01:i,T23:a}=Cd,c=0;t^=e[c++],r^=e[c++],n^=e[c++],o^=e[c++];let u=e.length/4-2;for(let h=0;h<u;h++){let m=e[c++]^Qo(i,a,t,r,n,o),y=e[c++]^Qo(i,a,r,n,o,t),w=e[c++]^Qo(i,a,n,o,t,r),v=e[c++]^Qo(i,a,o,t,r,n);t=m,r=y,n=w,o=v}let l=e[c++]^xn(s,t,r,n,o),d=e[c++]^xn(s,r,n,o,t),p=e[c++]^xn(s,n,o,t,r),f=e[c++]^xn(s,o,t,r,n);return{s0:l,s1:d,s2:p,s3:f}}function es(e,t,r,n,o){me(r,ga,"nonce"),me(n),o=Ed(n.length,o);let s=r,i=_t(s),a=Er(s),c=_t(n),u=_t(o),l=t?0:12,d=n.length,p=a.getUint32(l,t);for(let h=0;h+4<=c.length;h+=4){let{s0:m,s1:y,s2:w,s3:v}=Ad(e,ue(i[0]),ue(i[1]),ue(i[2]),ue(i[3]));u[h+0]=c[h+0]^ue(m),u[h+1]=c[h+1]^ue(y),u[h+2]=c[h+2]^ue(w),u[h+3]=c[h+3]^ue(v),p=p+1>>>0,a.setUint32(l,p,t)}let f=ga*Math.floor(c.length/Wb);if(f<d){let{s0:h,s1:m,s2:y,s3:w}=Ad(e,ue(i[0]),ue(i[1]),ue(i[2]),ue(i[3])),v=new Uint32Array([h,m,y,w]);bn(v);let S=zd(v);for(let T=f,_=0;T<d;T++,_++)o[T]=n[T]^S[_];ut(v)}return o}function nw(e,t,r,n,o){let s=o?o.length:0,i=e.create(r,n.length+s);o&&i.update(o);let a=Td(8*n.length,8*s,t);i.update(n),i.update(a);let c=i.digest();return ut(a),c}var _a=Pd({blockSize:16,nonceLength:12,tagLength:16,withAAD:!0,varSizeNonce:!0},function(t,r,n){if(r.length<8)throw new Error("aes/gcm: invalid nonce length");let o=16;function s(a,c,u){let l=nw(ha,!1,a,u,n);for(let d=0;d<c.length;d++)l[d]^=c[d];return l}function i(){let a=rw(t),c=Yo.slice(),u=Yo.slice();if(es(a,!1,u,u,c),r.length===12)u.set(r);else{let d=Yo.slice();Er(d).setBigUint64(8,BigInt(r.length*8),!1);let f=ha.create(c).update(r).update(d);f.digestInto(u),f.destroy()}let l=es(a,!1,u,Yo);return{xk:a,authKey:c,counter:u,tagMask:l}}return{encrypt(a){let{xk:c,authKey:u,counter:l,tagMask:d}=i(),p=new Uint8Array(a.length+o),f=[c,u,l,d];Or(a)||f.push(a=tr(a)),es(c,!1,l,a,p.subarray(0,a.length));let h=s(u,d,p.subarray(0,p.length-o));return f.push(h),p.set(h,a.length),ut(...f),p},decrypt(a){let{xk:c,authKey:u,counter:l,tagMask:d}=i(),p=[c,u,d,l];Or(a)||p.push(a=tr(a));let f=a.subarray(0,-o),h=a.subarray(-o),m=s(u,d,f);if(p.push(m),!kd(m,h))throw ut(...p),new Error("aes-gcm: invalid tag");let y=es(c,!1,l,f);return ut(...p),y}}});function Id(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var ba=e=>e?`"${e}" `:"";function vn(e,t=""){if(typeof e!="number")throw new TypeError(ba(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(ba(t)+"expected integer >= 0, got "+e);return e}function It(e,t,r=""){if(Id(e)&&(t===void 0||e.length===t))return e;t!==void 0&&vn(t,"length");let n=Id(e),o=t!==void 0?` of length ${t}`:"",s=n?`length=${e.length}`:`type=${typeof e}`,i=ba(r)+"expected Uint8Array"+o+", got "+s;throw n?new RangeError(i):new TypeError(i)}function $n(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("expected hash wrapped by utils.createHasher");if(vn(e.outputLen),vn(e.blockLen),e.outputLen<1||e.blockLen<1)throw new Error("hash blockLen / outputLen must be >= 1")}var ow=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},Nd=(e,t)=>{ow(e,t);let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)throw new TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${t}.__proto__" is not allowed`)};function Rr(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function ts(e,t){It(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function lt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function rs(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ye(e,t){return e<<32-t|e>>>t}function sw(e,t,r="opts"){return Nd(e,"defaults"),t!==void 0&&Nd(t,r),Object.assign(Object.create(null),e,t)}function jd(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=sw({},t,"info");let r=(o,s)=>e(s).update(o).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=o=>e(o),Object.assign(r,t),Object.freeze(r)}var Zd=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var ns=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if($n(t),It(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("expected Hash instance");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?t.create().update(r).digest():r);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=t.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),lt(o)}update(t){return Rr(this),this.iHash.update(t),this}digestInto(t){Rr(this),ts(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a,canXOF:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=a,t.canXOF=c,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Sn=(()=>{let e=((t,r,n)=>new ns(t,r).update(n).digest());return e.create=(t,r)=>new ns(t,r),e})();var zn=Uint8Array.of(0),iw=Uint8Array.of();function aw(e,t,r,n=32,o){$n(e),vn(n,"length"),It(t,void 0,"prk");let s=e.outputLen;if(t.length<s)throw new Error('"prk" must be at least HashLen octets');if(n>255*s)throw new Error("Length must be <= 255*HashLen");let i=Math.ceil(n/s);if(r===void 0?r=iw:It(r,void 0,"info"),!i)return o&<(t),new Uint8Array;let a=o&&i===1?t:new Uint8Array(i*s),{iHash:c,oHash:u}=Sn.create(e,t),l=o?t:new Uint8Array(s),d=i>1?o?.iHash||e.create():void 0;for(let f=0;f<i-1;f++){zn[0]=f+1;let h=c._cloneInto(d);f&&h.update(l),h.update(r).update(zn).digestInto(l),u._cloneInto(d).update(l).digestInto(l),a.set(l,s*f)}if(zn[0]=i,i>1&&c.update(l),c.update(r).update(zn).digestInto(l),u.update(l).digestInto(l),a.set(l,s*(i-1)),c.destroy(),u.destroy(),d?.destroy(),l!==a&<(l),lt(zn),n===a.length)return a;let p=a.slice(0,n);return lt(a),p}var wa=(e,t,r,n,o)=>{$n(e),r===void 0&&(r=new Uint8Array(e.outputLen));let s=Sn.create(e,r).update(t);return aw(e,s.digest(),n,o,s)};var cw=e=>e/2**32|0,uw=e=>e>>>0;function Dd(e,t,r,n){let o=cw(r),s=uw(r);e.setUint32(t,n?s:o,n),e.setUint32(t+4,n?o:s,n)}function Md(e,t,r){return e&t^~e&r}function Ld(e,t,r){return e&t^e&r^t&r}var os=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,o){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=rs(this.buffer)}update(t){Rr(this),It(t);let{view:r,buffer:n,blockLen:o}=this,s=t.length,i=!1;for(let a=0;a<s;){let c=Math.min(o-this.pos,s-a);if(c===o){let u=rs(t);for(;o<=s-a;a+=o)this.process(u,a);i=!0;continue}n.set(a===0&&c===s?t:t.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===o&&(this.process(r,0),this.pos=0,i=!0)}return this.length+=t.length,i&&this.roundClean(),this}digestInto(t){Rr(this),ts(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;r[i++]=128,r.fill(0,i),this.padOffset>o-i&&(this.process(n,0),r.fill(0)),Dd(n,o-8,this.length*8,s),this.process(n,0),this.roundClean();let a=t===r?n:rs(t),c=this.outputLen,u=c/4,l=this.get();if(c%4||u>l.length)throw new Error("invalid outputLen");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneIntoMeta(t){let{buffer:r,length:n,finished:o,destroyed:s,pos:i}=this;return t.destroyed=s,t.finished=o,t.length=n,t.pos=i,i&&t.buffer.set(r),t}clone(){return this._cloneInto()}},Ud=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var lw=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Nt=new Uint32Array(64),xa=class extends os{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(t,r){super(64,t,8,!1),this.A=r[0]|0,this.B=r[1]|0,this.C=r[2]|0,this.D=r[3]|0,this.E=r[4]|0,this.F=r[5]|0,this.G=r[6]|0,this.H=r[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,r,n,o,s,i,a,c]}set(t,r,n,o,s,i,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}_cloneInto(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,r){for(let d=0;d<16;d++,r+=4)Nt[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){let p=Nt[d-15],f=Nt[d-2],h=Ye(p,7)^Ye(p,18)^p>>>3,m=Ye(f,17)^Ye(f,19)^f>>>10;Nt[d]=m+Nt[d-7]+h+Nt[d-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){let p=Ye(a,6)^Ye(a,11)^Ye(a,25),f=l+p+Md(a,c,u)+lw[d]+Nt[d]|0,m=(Ye(n,2)^Ye(n,13)^Ye(n,22))+Ld(n,o,s)|0;l=u,u=c,c=a,a=i+f|0,i=s,s=o,o=n,n=f+m|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,o,s,i,a,c,u,l)}roundClean(){lt(Nt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),lt(this.buffer)}},va=class extends xa{constructor(){super(32,Ud)}};var ss=jd(()=>new va,Zd(1));var kn=new TextEncoder,dw=new TextDecoder,fw="ape1",qd=/^ape1\.([A-Za-z0-9_-]{16})\.([A-Za-z0-9_-]+)$/,pw=/^[A-Za-z0-9_-]{43}$/,hw=/^jb_live_[A-Za-z0-9]{40}$/;function is(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function $a(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4)),r=new Uint8Array(new ArrayBuffer(t.length));for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Fd(){return is(globalThis.crypto.getRandomValues(new Uint8Array(32)))}var Sa=e=>pw.test(e),Bd=e=>typeof e=="string"&&qd.test(e);function Vd(e){let t=e.trim();if(Sa(t))return{token:null,key:t};let[r,n,...o]=t.split(".");if(!hw.test(r)||o.length||n!==void 0&&!Sa(n))throw new Error("Not a valid Jotbus token or connection string");return{token:r,key:n??null}}var za=(e,t)=>`${e}.${t}`;async function Pn(e){if(!Sa(e))throw new Error("Invalid workspace key");let t=$a(e),r=new Uint8Array(32),n=wa(ss,t,r,kn.encode("agentpad/v1/enc"),32),o=wa(ss,t,r,kn.encode("agentpad/v1/check"),32),s=is(Sn(ss,o,kn.encode("agentpad/v1/key-check"))),i=a=>kn.encode(`agentpad/v1/${a}`);return{check:s,async encrypt(a,c){let u=globalThis.crypto.getRandomValues(new Uint8Array(12)),l=_a(n,u,i(a)).encrypt(kn.encode(JSON.stringify(c)));return`${fw}.${is(u)}.${is(l)}`},async decrypt(a,c){let u=qd.exec(c);if(!u)throw new Error("Not an encrypted message");let l=_a(n,$a(u[1]),i(a)).decrypt($a(u[2])),d=JSON.parse(dw.decode(l));if(typeof d?.c!="string")throw new Error("Malformed message");return d}}}var mw=/jb1_([A-Za-z0-9]{24})\.([A-Za-z0-9_-]{43})(?![A-Za-z0-9_-])/,Hd=(e,t)=>`${e}.${t}`;function Kd(e){let t=mw.exec(e.trim());return t?{invite:`jb1_${t[1]}`,key:t[2]}:null}var nr="0.3.0",or="https://app.jotbus.com",as=`${or}/mcp`;var _w=!!(process.stdin.isTTY&&process.stdout.isTTY),Ar=e=>t=>process.stdout.isTTY&&!process.env.NO_COLOR?`\x1B[${e}m${t}\x1B[0m`:t,En=Ar("1"),dt=Ar("2"),ka=Ar("32"),Wd=Ar("36"),bw=Ar("33"),ge=(e="")=>process.stdout.write(`${e}
|
|
11
|
+
`);function cs(e){process.stderr.write(`${Ar("31")("\u2717")} ${e}
|
|
12
|
+
`),process.exit(1)}async function Gd(e,t,r){let n;try{n=await fetch(`${e.origin}/anon/${t}`,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":"jotbus-cli"},body:JSON.stringify(r)})}catch(s){cs(`Couldn't reach ${e.origin} (${s.message}).`)}let o=await n.json().catch(()=>({}));return n.ok||cs(o.error??`Request failed (${n.status}).`),o}function Xd(e){return Math.max(0,Math.round((new Date(e).getTime()-Date.now())/6e4))}var Yd=e=>new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),sr=(e,t)=>gw(e,t,{stdio:"pipe",encoding:"utf8",timeout:3e4}),ww=e=>sr(e,["--version"]).status===0,Jd=[{name:"Claude Code",bin:"claude",exists:()=>sr("claude",["mcp","get","jotbus"]).status===0,remove:()=>sr("claude",["mcp","remove","jotbus","-s","user"]).status===0,add:(e,t)=>sr("claude",["mcp","add","--scope","user","jotbus","-e",`JOTBUS_TOKEN=${e}`,"--","npx",...t]).status===0,manual:(e,t)=>`claude mcp add --scope user jotbus -e JOTBUS_TOKEN=${e} -- npx ${t.join(" ")}`},{name:"Codex",bin:"codex",exists:()=>/\bjotbus\b/.test(sr("codex",["mcp","list"]).stdout??""),remove:()=>sr("codex",["mcp","remove","jotbus"]).status===0,add:(e,t)=>sr("codex",["mcp","add","jotbus","--env",`JOTBUS_TOKEN=${e}`,"--","npx",...t]).status===0,manual:(e,t)=>`codex mcp add jotbus --env JOTBUS_TOKEN=${e} -- npx ${t.join(" ")}`}];async function xw(e,t){if(!_w)return t;let r=yw({input:process.stdin,output:process.stdout}),n=(await r.question(`${e} ${dt(t?"[Y/n]":"[y/N]")} `)).trim().toLowerCase();return r.close(),n===""?t:n.startsWith("y")}async function Qd(e,t){let r=["-y","jotbus@latest",...e.origin===or?[]:["--url",`${e.origin}/mcp`]],n=Jd.filter(s=>ww(s.bin)),o=[];if(!e.install||n.length===0){ge(En("Add it to your agent:"));for(let s of Jd)ge(` ${dt(s.name+":")} ${s.manual(t,r)}`);return ge(` ${dt("Other MCP clients:")} command "npx ${r.join(" ")}" with env JOTBUS_TOKEN=${t}`),o}for(let s of n){if(s.exists()){if(!(e.yes||await xw(`${s.name} already has a Jotbus connection. Replace it with this workspace?`,!1))){ge(dt(` Skipped ${s.name}. To switch later, run: npx jotbus@latest join \u2026 --yes (or remove its "jotbus" server and add: ${s.manual(t,r)})`));continue}s.remove()}s.add(t,r)?(o.push(s.name),ge(`${ka("\u2713")} Added to ${s.name}`)):ge(`${bw("!")} Couldn't add to ${s.name} automatically. Run:
|
|
13
|
+
${s.manual(t,r)}`)}return o}function ef(e){ge(),ge(En("Then tell your agent:")),ge(` ${Wd('"Use Jotbus to collaborate."')}`),e.includes("Claude Code")?ge(dt(" (Start a new Claude Code session so it picks up the new connection.)")):e.length&&ge(dt(" (Restart your agent so it picks up the new connection.)"))}async function Pa(e){let t=Fd(),r=await Pn(t),n=await Gd(e,"workspaces",{key_check:r.check}),o=Hd(n.invite,t);ge(`${ka("\u2713")} Created temporary workspace ${En(n.name)} ${dt(`(end-to-end encrypted, expires in ${Xd(n.expires_at)} minutes at ${Yd(n.expires_at)})`)}`);let s=await Qd(e,za(n.token,t));ge(),ge(En("Connect another machine or person:"));let i=e.origin===or?"":` --origin ${e.origin}`;ge(` ${Wd(`npx jotbus@latest join ${o}${i}`)}`),ge(dt(` or share this link: ${e.origin}/join#${o}`)),ge(dt(" No account needed. Up to 3 connected clients. The invite includes the encryption key, so share it privately.")),ef(s)}async function tf(e,t){let r=t?Kd(t):null;r||cs("Usage: npx jotbus join <invite> (the jb1_\u2026 invite or join link you were sent)");let n=await Pn(r.key),o=await Gd(e,"join",{invite:r.invite});o.key_check!==n.check&&cs("This invite's encryption key doesn't match the workspace. Ask for a fresh invite."),ge(`${ka("\u2713")} Joined ${En(o.name)} ${dt(`(end-to-end encrypted, expires in ${Xd(o.expires_at)} minutes at ${Yd(o.expires_at)})`)}`);let s=await Qd(e,za(o.token,r.key));ef(s)}import{webcrypto as mO}from"node:crypto";import{hostname as gO}from"node:os";var j={};aa(j,{BIGINT_FORMAT_RANGES:()=>fs,CONSTANT_CATCH:()=>hf,Class:()=>Oa,NUMBER_FORMAT_RANGES:()=>On,aborted:()=>Qe,allowsEval:()=>Na,assert:()=>kw,assertEqual:()=>vw,assertIs:()=>Sw,assertNever:()=>zw,assertNotEqual:()=>$w,assignProp:()=>qe,attachSchema:()=>hs,base64ToUint8Array:()=>ff,base64urlToUint8Array:()=>Vw,cached:()=>jr,captureStackTrace:()=>ls,cleanEnum:()=>Bw,cleanRegex:()=>Tn,clone:()=>Ve,cloneDef:()=>Tw,codePointLength:()=>Rn,constantCatch:()=>mf,createTransparentProxy:()=>Nw,defineLazy:()=>of,defineLazyInternal:()=>H,derived:()=>Ww,esc:()=>Ca,escapeRegex:()=>xt,explicitlyAborted:()=>Da,extend:()=>Dw,finalizeIssue:()=>et,floatSafeRemainder:()=>Aa,getElementAtPath:()=>Ow,getEnumValues:()=>Ir,getLengthableOrigin:()=>An,getParsedType:()=>Iw,getSizableOrigin:()=>df,hexToUint8Array:()=>Kw,hide:()=>ms,installLazyProp:()=>Qw,isObject:()=>ar,isPlainObject:()=>Dt,issue:()=>Dr,joinValues:()=>us,jsonStringifyReplacer:()=>Nr,members:()=>La,merge:()=>Lw,mergeDefs:()=>wt,normalizeParams:()=>I,nullish:()=>Ra,numKeys:()=>Cw,objectClone:()=>Pw,omit:()=>Zw,optionalKeys:()=>Za,own:()=>Zt,parsedType:()=>Ma,partial:()=>Uw,pick:()=>jw,prefixIssues:()=>vt,primitiveTypes:()=>uf,promiseAllObject:()=>Rw,propertyKeyTypes:()=>ja,randomString:()=>Aw,rawShape:()=>Zr,required:()=>qw,safeExtend:()=>Mw,shallowClone:()=>cf,slugify:()=>Ia,stringifyPrimitive:()=>ds,toZod:()=>nf,uint8ArrayToBase64:()=>pf,uint8ArrayToBase64url:()=>Hw,uint8ArrayToHex:()=>Jw,unwrapMessage:()=>Cr});function vw(e){return e}function $w(e){return e}function nf(){return e=>e}function Sw(e){}function zw(e){throw new Error("Unexpected value in exhaustive check")}function kw(e){}function Ir(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function us(e,t="|"){return e.map(r=>ds(r)).join(t)}function Nr(e,t){return typeof t=="bigint"?t.toString():t}var Ta=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function jr(e){return new Ta(e)}function Ra(e){return e==null}function Tn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Aa(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var rf=Symbol("evaluating");function of(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==rf)return n===void 0&&(n=rf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Pw(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function qe(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Zr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function bt(e){return Zr(e._zod.def)??e._zod.def.shape}function sf(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return qe(this,t,n),n},enumerable:!0,configurable:!0})}function af(e,t,r){t in e?qe(e,t,r):e[t]=r}function ir(e,t,r,n){let o=bt(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);i.enumerable&&(i.get?sf(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a}):af(e,s,n?n(i.value,s):i.value))}}function Ew(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?sf(e,r,()=>t[r]):af(e,r,n.value))}}function wt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Tw(e){return wt(e._zod.def)}function Ow(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Rw(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function Aw(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ca(e){return JSON.stringify(e)}function Ia(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ls="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Na=jr(()=>{if(Ie.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Dt(e){if(ar(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ar(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cf(e){return Dt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Cw(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Iw=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}`)}},ja=new Set(["string","number","symbol"]),uf=new Set(["string","number","bigint","boolean","symbol","undefined"]);function xt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ve(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function I(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 Nw(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function ds(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Za(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var On={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},fs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function jw(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return ir(s,e,ps(e,t)),Ve(e,wt(r,{shape:s,checks:[]}))}function ps(e,t){let r=bt(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Zw(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(ps(e,t)),i={};return ir(i,e,Reflect.ownKeys(bt(e)).filter(a=>!s.has(a))),Ve(e,wt(r,{shape:i,checks:[]}))}function Dw(e,t){if(!Dt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=bt(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ve(e,wt(e._zod.def,{shape:lf(e,t)}))}function lf(e,t){let r={};return ir(r,e,Reflect.ownKeys(bt(e))),Ew(r,t),r}function Mw(e,t){if(!Dt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return Ve(e,wt(e._zod.def,{shape:lf(e,t)}))}function Lw(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ir(r,e,Reflect.ownKeys(bt(e))),ir(r,t,Reflect.ownKeys(bt(t)));let n=wt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ve(e,n)}function Uw(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(ps(t,r)):void 0,c={};return ir(c,t,Reflect.ownKeys(bt(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),Ve(t,wt(t._zod.def,{shape:c,checks:[]}))}function qw(e,t,r){let n=r?new Set(ps(t,r)):void 0,o={};return ir(o,t,Reflect.ownKeys(bt(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),Ve(t,wt(t._zod.def,{shape:o}))}function Qe(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 Da(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 vt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Cr(e){return typeof e=="string"?e:e?.message}function hs(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function et(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Cr(e.inst?._zod.def?.error?.(e))??Cr(s?.(e))??Cr(t?.error?.(e))??Cr(r.customError?.(e))??Cr(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=i,t?.reportInput&&(a.input=e.input),a}function df(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Fw=/[\uD800-\uDBFF]/;function Rn(e){let t=e.length;if(!Fw.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function An(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ma(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 Dr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Bw(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function ff(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function pf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Vw(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return ff(t+r)}function Hw(e){return pf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Kw(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Jw(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Oa=class{constructor(...t){}};function La(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Gw(e,r,n.value)}}function Zt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function ms(e,t,r){return Zt(e,t,r,!1)}function Ww(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Zt(this,r,n(this))},set(o){Zt(this,r,o)}})}return t}function Gw(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Zt(this,t,r.bind(this))},set(n){Zt(this,t,n)}})}function Xw(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Ea,jt=!1,Yw={configurable:!0,get(){jt=!0}};function H(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ea!==e._zod){Ea=void 0;return}Ea=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Yw);let o=jt;jt=!1;try{let s=r(this);return jt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),jt=jt||o,s}catch(s){throw delete this[t],jt=jt||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Qw(e,t,r,n){let o=Xw(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var hf="~constantCatch";function mf(e){let t=()=>e;return t[hf]=!0,t}var gf,qa=Object.freeze({status:"aborted"}),Ua={value:void 0,enumerable:!1},yf="captureStackTrace"in Error?Error:null;function ex(e){let t=yf;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return yf=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function b(e,t,r,n){let o={};function s(p){this.def=p,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function c(p,f){if(p._zod){if(p._zod.traits.has(e))return}else{Ua.value=new s(f);try{Object.defineProperty(p,"_zod",Ua)}finally{Ua.value=void 0}}if(p._zod.traits.add(e),t(p,f),a){let m=Object.getPrototypeOf(p),y=p._zod.constr.prototype,w=m;for(;w&&w!==y;)w=Object.getPrototypeOf(w);let v=w??m;a.has(v)||(a.add(v),La(v,i))}let h=d.prototype;for(let m in h)Object.prototype.hasOwnProperty.call(h,m)&&(m in p||(p[m]=h[m].bind(p)))}let u=n?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function d(p){let f=n?.Parent?ex(l):this;c(f,p);let h=f._zod.deferred;if(h){for(let y of h)y();f._zod.deferred=void 0}let m=globalThis.__zod_globalConfig?.postProcessor;return m&&m(f),f}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var tt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(gf=globalThis).__zod_globalConfig??(gf.__zod_globalConfig={});var Ie=globalThis.__zod_globalConfig;function Ne(e){return e&&Object.assign(Ie,e),Ie}function tx(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Nr,2)),e.message}function rx(e){this._zod.message=e}var nx={get:tx,set:rx,enumerable:!0,configurable:!0},Ba={value:void 0,enumerable:!1},_f=new WeakSet([Object.prototype,Error.prototype]),bf=(e,t)=>{e.name="$ZodError",Ba.value=t,Object.defineProperty(e,"issues",Ba),Ba.value=void 0,Object.defineProperty(e,"message",nx);let r=Object.getPrototypeOf(e);_f.has(r)||(_f.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},wf=b("$ZodError",bf),xf=b("$ZodError",bf,void 0,{Parent:Error});function ox(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function Va(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?ox(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ha(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({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],d=u===a.length-1;if(l==="_errors"){d&&c._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[l];d&&p._errors.push(t(i)),c=p,u++}}}};return n(e),r}function gs(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ys=e=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new tt;if(a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>et(u,i,Ne())));throw ls(c,s?.callee??t),c}return a.value};return t};var _s=e=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(s?.Err??e)(a.issues.map(u=>et(u,i,Ne())));throw ls(c,s?.callee??t),c}return a.value};return t};var Cn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new tt;return s.issues.length?vf(e,s.issues,o):{success:!0,data:s.value}},Ka=Cn(xf);function vf(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>et(o,r,Ne()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var bs=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?vf(e,s.issues,o):{success:!0,data:s.value}};var ix=Symbol.for("zod.compile.invalid"),ax=Symbol.for("zod.compile.fallback"),ws=((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ix)return!0;if(n.definite===!0&&r===void 0)return!1}return cx(e,t,r)});function cx(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o?(n[ax]=!0,s=o({value:t,issues:[]},n)):s=e._zod.run({value:t,issues:[]},n),s instanceof Promise)throw new tt;return s.issues.length===0}var xs=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},$f=e=>{let t=ys(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,gs(r,i))};return r};var Sf=e=>{let t=ys(e),r=(n,o,s,i)=>t(n,o,s,gs(r,i));return r};var zf=e=>{let t=_s(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,gs(r,i))};return r};var kf=e=>{let t=_s(e),r=async(n,o,s,i)=>await t(n,o,s,gs(r,i));return r};var Pf=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Cn(e)(t,r,o)};var Ef=e=>(t,r,n)=>Cn(e)(t,r,n);var Tf=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return bs(e)(t,r,o)};var Of=e=>async(t,r,n)=>bs(e)(t,r,n);var Rf=/^[cC][0-9a-z]{6,}$/,Af=/^[0-9a-z]+$/,Cf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,If=/^[0-9a-vA-V]{20}$/,Nf=/^[A-Za-z0-9]{27}$/,jf=/^[a-zA-Z0-9_-]{21}$/;function Zf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Df=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Mf=/^([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})$/,Wa=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 Lf=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var ux="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Uf(){return new RegExp(ux,"u")}var qf=/^(?:(?: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])$/,Ff=/^(([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 Bf=/^((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])$/,Vf=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Hf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Kf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Jf=/^https?$/,Wf=/^\+[1-9]\d{6,14}$/;var Gf="(?:(?:\\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])))";function lx(e){return new RegExp(`^${e}$`)}var Xf=lx(Gf);function Ja(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yf(e){return new RegExp(`^${Ja(e)}$`)}function Qf(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ja({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ja({precision:e.precision})}`:r;return new RegExp(`^${Gf}T(?:${n})$`)}var ep=/^[\s\S]{0,}$/;var tp=/^-?\d+n?$/,Ga=/^-?\d+$/,In=/^-?\d+(?:\.\d+)?$/,rp=/^(?:true|false)$/i,np=/^null$/i;var op=/^[^A-Z]*$/,sp=/^[^a-z]*$/;var _e=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Xa=e=>{let t=e.value;return!Ra(t)&&t.length!==void 0},vs={number:"number",bigint:"bigint",object:"date"},Ya=b("$ZodCheckLessThan",(e,t)=>{_e.init(e,t);let r=vs[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:vs[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qa=b("$ZodCheckGreaterThan",(e,t)=>{_e.init(e,t);let r=vs[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:vs[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ip=b("$ZodCheckMultipleOf",(e,t)=>{_e.init(e,t),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"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Aa(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})}}),ap=b("$ZodCheckNumberFormat",(e,t)=>{_e.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=On[t.format];e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,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:n,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:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,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 cp=b("$ZodCheckMaxLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Xa),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>t.maximum?Rn(o):s)<=t.maximum)return;let a=An(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),up=b("$ZodCheckMinLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Xa),e._zod.check=n=>{let o=n.value,s=o.length;if((typeof o=="string"&&s>=t.minimum&&s<t.minimum*2?Rn(o):s)>=t.minimum)return;let a=An(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lp=b("$ZodCheckLengthEquals",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=Xa),e._zod.check=n=>{let o=n.value,s=o.length,i=typeof o=="string"&&s>=t.length&&s<=t.length*2?Rn(o):s;if(i===t.length)return;let a=An(o),c=i>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nn=b("$ZodCheckStringFormat",(e,t)=>{var r,n;_e.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),dp=b("$ZodCheckRegex",(e,t)=>{Nn.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})}}),fp=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=op),Nn.init(e,t)}),pp=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=sp),Nn.init(e,t)}),hp=b("$ZodCheckIncludes",(e,t)=>{_e.init(e,t);let r=xt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),mp=b("$ZodCheckStartsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`^${xt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),gp=b("$ZodCheckEndsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`.*${xt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var yp=b("$ZodCheckOverwrite",(e,t)=>{_e.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var $s=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
11
14
|
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
12
15
|
${r.join(`
|
|
13
16
|
`)}
|
|
14
|
-
};`)(...Object.values(this.closed))}};var qf={major:4,minor:6,patch:5};var J=_("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qf;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=We(a),d;for(let p of c){if(p._zod.def.when){if(ga(a)||!p._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,h=p._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new Xe;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==f&&(Go(a.issues,f,e),l||(l=We(a,f)))});else{if(a.issues.length===f)continue;Go(a.issues,f,e),l||(l=We(a,f))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(We(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new Xe;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new Xe;return u.then(l=>s(l,o,c))}return s(u,o,c)}}},{get"~standard"(){return Xo(this,"~standard",Ia(this))},set"~standard"(e){Rt(this,"~standard",e)}}),Qf=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Ge(r,t,Ae()))}:{value:e.value};async function zw(e,t){let r={async:!0};return Qf(await e._zod.run({value:t,issues:[]},r),r)}function Ia(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Qf(n,r)}catch{}return zw(e,t)},vendor:"zod",version:1}}var us=_("$ZodString",(e,t)=>{J.init(e,t),e._zod.pattern=t.pattern??$f,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ee=_("$ZodStringFormat",(e,t)=>{bn.init(e,t),us.init(e,t)}),ep=_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cf),ee.init(e,t)}),tp=_("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Pa(n))}else t.pattern??(t.pattern=Pa());ee.init(e,t)}),rp=_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=uf),ee.init(e,t)}),np=1,as=2;function op(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function kw(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?op(e)||as:Pw(e,t)}function Pw(e,t){if(!t.normalize&&t.protocol?.source===yf.source&&!/^https?:\/\//i.test(e))return np;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??as}return new URL(e)}catch{return as}}var Ew=/[\t\n\r]/g;function Ff(e){return e.replace(Ew,"")}function Tw(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ow(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var sp=_("$ZodURL",(e,t)=>{ee.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=kw(n,t);if(o===np){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===as){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Ff(n);return}t.hostname&&!Tw(o,t.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&&!Ow(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:Ff(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ip=_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lf()),ee.init(e,t)}),ap=_("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?of:sf(t.length)),ee.init(e,t)}),cp=_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qd),ee.init(e,t)}),up=_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ef),ee.init(e,t)}),lp=_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tf),ee.init(e,t)}),dp=_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rf),ee.init(e,t)}),fp=_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nf),ee.init(e,t)}),pp=_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vf(t)),ee.init(e,t)}),hp=_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=wf),ee.init(e,t)}),mp=_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=xf(t)),ee.init(e,t)}),gp=_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=af),ee.init(e,t)}),yp=_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=df),ee.init(e,t)}),Rw=/^[0-9a-fA-F:.]+$/;function _p(e){return Rw.test(e)?op(`http://[${e}]`):!1}var bp=_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ff),ee.init(e,t),e._zod.check=r=>{_p(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var wp=_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pf),ee.init(e,t)});function Aw(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:_p(r)}var xp=_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hf),ee.init(e,t),e._zod.check=r=>{Aw(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function vp(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ca=/^[0-9a-zA-Z+/]*={0,2}$/,$p=_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ca),ee.init(e,t),e._zod.check=r=>{vp(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),ls=/^[A-Za-z0-9_-]*$/;function Iw(e){if(!ls.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return vp(r)}var Sp=_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ls),ee.init(e,t),e._zod.check=r=>{Iw(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),zp=_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_f),ee.init(e,t)});function Cw(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var kp=_("$ZodJWT",(e,t)=>{ee.init(e,t),e._zod.check=r=>{Cw(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Na=_("$ZodNumber",(e,t)=>{J.init(e,t),e._zod.pattern=_n,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Pp=_("$ZodNumberFormat",(e,t)=>{Of.init(e,t),Na.init(e,t)}),Ep=_("$ZodBoolean",(e,t)=>{J.init(e,t),e._zod.pattern=zf,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Tp=_("$ZodBigInt",(e,t)=>{J.init(e,t),e._zod.pattern=Sf,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var Op=_("$ZodNull",(e,t)=>{J.init(e,t),e._zod.pattern=kf,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Rp=_("$ZodAny",(e,t)=>{J.init(e,t),e._zod.parse=r=>r}),Ap=_("$ZodUnknown",(e,t)=>{J.init(e,t),e._zod.parse=r=>r}),Ip=_("$ZodNever",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var Cp=_("$ZodDate",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Vf(e,t,r){e.issues.length&&t.issues.push(...gt(r,e.issues)),t.value[r]=e.value}var Np=_("$ZodArray",(e,t)=>{J.init(e,t);let r=Re.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then(d=>Vf(d,n,c)));else if(Vf(l,n,c),a&&l.issues.length!==0&&We(l))break}return i.length?Promise.all(i).then(()=>n):n}});function cs(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!(!i&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...gt(r,e.issues))}if(!i&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var Nw=[];function jp(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Nw,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=ma(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function Zp(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,d=u.optin,p=u.optout,f=0;for(let h in t){if(i&&r.issues.length!==f){if(We(r,f))break;f=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}let m=u.run({value:t[h],issues:[]},n);m instanceof Promise?e.push(m.then(y=>cs(y,r,h,t,d,p))):cs(m,r,h,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var jw=_("$ZodObject",(e,t)=>{J.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=kr(()=>jp(t));V(e,"propValues",u=>{let l=u.def.shape,d={};for(let p in l){let f=l[p]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,p)||De(d,p,new Set);for(let h of f.values)d[p].add(h);f.optin!==void 0&&d[p].add(void 0)}}return d});let s=er,i=t.catchall,a,c=Re.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let p=[],f=a.shape,h=l?.abortEarly,m=u.issues.length;for(let y of a.allKeys){if(h&&u.issues.length!==m){if(We(u,m))break;m=u.issues.length}if(y==="__proto__")continue;let w=f[y],v=w._zod.optin,z=w._zod.optout,A=w._zod.run({value:d[y],issues:[]},l);A instanceof Promise?p.push(A.then(b=>cs(b,u,y,d,v,z))):cs(A,u,y,d,v,z)}return i?Zp(p,d,u,l,o.value,e,h===!0):p.length?Promise.all(p).then(()=>u):u}}),Mp=_("$ZodObjectJIT",(e,t)=>{jw.init(e,t);let r=e._zod.parse,n=kr(()=>jp(t)),o=Re.memoizer,s=f=>{let h=n.value,m=h.symbolKeys,y=new ss(["payload","ctx"],{shape:f,inst:e,memo:o,syms:m}),w=b=>`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`,v=(b,x)=>`
|
|
15
|
-
let ${
|
|
16
|
-
for (let i = 0; i < ${
|
|
17
|
-
const iss = ${
|
|
17
|
+
};`)(...Object.values(this.closed))}};var bp={major:4,minor:6,patch:5};var W=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bp;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,c,u)=>{if(a.memo)return a;let l=Qe(a),d;for(let p of c){if(p._zod.def.when){if(Da(a)||!p._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,h=p._zod.check(a);if(h instanceof Promise&&u?.async===!1)throw new tt;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,a.issues.length!==f&&(hs(a.issues,f,e),l||(l=Qe(a,f)))});else{if(a.issues.length===f)continue;hs(a.issues,f,e),l||(l=Qe(a,f))}}return d?d.then(()=>a):a},i=(a,c,u)=>{if(Qe(a))return a.aborted=!0,a;let l=s(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new tt;return l.then(d=>e._zod.parse(d,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,c)):i(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new tt;return u.then(l=>s(l,o,c))}return s(u,o,c)}}},{get"~standard"(){return ms(this,"~standard",tc(this))},set"~standard"(e){Zt(this,"~standard",e)}}),Op=(e,t)=>e.issues.length?{issues:e.issues.map(r=>et(r,t,Ne()))}:{value:e.value};async function dx(e,t){let r={async:!0};return Op(await e._zod.run({value:t,issues:[]},r),r)}function tc(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Op(n,r)}catch{}return dx(e,t)},vendor:"zod",version:1}}var Ps=b("$ZodString",(e,t)=>{W.init(e,t),e._zod.pattern=t.pattern??ep,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),te=b("$ZodStringFormat",(e,t)=>{Nn.init(e,t),Ps.init(e,t)}),Rp=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Mf),te.init(e,t)}),Ap=b("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wa(n))}else t.pattern??(t.pattern=Wa());te.init(e,t)}),Cp=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Lf),te.init(e,t)}),Ip=1,zs=2;function Np(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function fx(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Np(e)||zs:px(e,t)}function px(e,t){if(!t.normalize&&t.protocol?.source===Jf.source&&!/^https?:\/\//i.test(e))return Ip;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??zs}return new URL(e)}catch{return zs}}var hx=/[\t\n\r]/g;function wp(e){return e.replace(hx,"")}function mx(e,t){return t.lastIndex=0,t.test(e.hostname)}function gx(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var jp=b("$ZodURL",(e,t)=>{te.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=fx(n,t);if(o===Ip){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===zs){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=wp(n);return}t.hostname&&!mx(o,t.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&&!gx(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:wp(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Zp=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Uf()),te.init(e,t)}),Dp=b("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?jf:Zf(t.length)),te.init(e,t)}),Mp=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rf),te.init(e,t)}),Lp=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Af),te.init(e,t)}),Up=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Cf),te.init(e,t)}),qp=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=If),te.init(e,t)}),Fp=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Nf),te.init(e,t)}),Bp=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Qf(t)),te.init(e,t)}),Vp=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Xf),te.init(e,t)}),Hp=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yf(t)),te.init(e,t)}),Kp=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Df),te.init(e,t)}),Jp=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=qf),te.init(e,t)}),yx=/^[0-9a-fA-F:.]+$/;function Wp(e){return yx.test(e)?Np(`http://[${e}]`):!1}var Gp=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ff),te.init(e,t),e._zod.check=r=>{Wp(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Xp=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Bf),te.init(e,t)});function _x(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Wp(r)}var Yp=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vf),te.init(e,t),e._zod.check=r=>{_x(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Qp(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var rc=/^[0-9a-zA-Z+/]*={0,2}$/,eh=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rc),te.init(e,t),e._zod.check=r=>{Qp(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Es=/^[A-Za-z0-9_-]*$/;function bx(e){if(!Es.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Qp(r)}var th=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Es),te.init(e,t),e._zod.check=r=>{bx(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),rh=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wf),te.init(e,t)});function wx(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var nh=b("$ZodJWT",(e,t)=>{te.init(e,t),e._zod.check=r=>{wx(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var nc=b("$ZodNumber",(e,t)=>{W.init(e,t),e._zod.pattern=In,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),oh=b("$ZodNumberFormat",(e,t)=>{ap.init(e,t),nc.init(e,t)}),sh=b("$ZodBoolean",(e,t)=>{W.init(e,t),e._zod.pattern=rp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),ih=b("$ZodBigInt",(e,t)=>{W.init(e,t),e._zod.pattern=tp,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var ah=b("$ZodNull",(e,t)=>{W.init(e,t),e._zod.pattern=np,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),ch=b("$ZodAny",(e,t)=>{W.init(e,t),e._zod.parse=r=>r}),uh=b("$ZodUnknown",(e,t)=>{W.init(e,t),e._zod.parse=r=>r}),lh=b("$ZodNever",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var dh=b("$ZodDate",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,s=o instanceof Date;return s&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...s?{received:"Invalid Date"}:{},inst:e}),r}});function xp(e,t,r){e.issues.length&&t.issues.push(...vt(r,e.issues)),t.value[r]=e.value}var fh=b("$ZodArray",(e,t)=>{W.init(e,t);let r=Ie.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let c=0;c<s.length;c++){let u=s[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)i.push(l.then(d=>xp(d,n,c)));else if(xp(l,n,c),a&&l.issues.length!==0&&Qe(l))break}return i.length?Promise.all(i).then(()=>n):n}});function ks(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!(!i&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...vt(r,e.issues))}if(!i&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||o==="defaulted"&&!a)&&(t.value[r]=void 0):t.value[r]=e.value}}var xx=[];function ph(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:xx,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=Za(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function hh(e,t,r,n,o,s,i){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,d=u.optin,p=u.optout,f=0;for(let h in t){if(i&&r.issues.length!==f){if(Qe(r,f))break;f=r.issues.length}if(c.has(h))continue;if(h==="__proto__"){l==="never"&&a.push(h);continue}if(l==="never"){a.push(h);continue}let m=u.run({value:t[h],issues:[]},n);m instanceof Promise?e.push(m.then(y=>ks(y,r,h,t,d,p))):ks(m,r,h,t,d,p)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var vx=b("$ZodObject",(e,t)=>{W.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=jr(()=>ph(t));H(e,"propValues",u=>{let l=u.def.shape,d={};for(let p in l){let f=l[p]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,p)||qe(d,p,new Set);for(let h of f.values)d[p].add(h);f.optin!==void 0&&d[p].add(void 0)}}return d});let s=ar,i=t.catchall,a,c=Ie.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let d=u.value;if(!s(d))return u.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let p=[],f=a.shape,h=l?.abortEarly,m=u.issues.length;for(let y of a.allKeys){if(h&&u.issues.length!==m){if(Qe(u,m))break;m=u.issues.length}if(y==="__proto__")continue;let w=f[y],v=w._zod.optin,S=w._zod.optout,T=w._zod.run({value:d[y],issues:[]},l);T instanceof Promise?p.push(T.then(_=>ks(_,u,y,d,v,S))):ks(T,u,y,d,v,S)}return i?hh(p,d,u,l,o.value,e,h===!0):p.length?Promise.all(p).then(()=>u):u}}),mh=b("$ZodObjectJIT",(e,t)=>{vx.init(e,t);let r=e._zod.parse,n=jr(()=>ph(t)),o=Ie.memoizer,s=f=>{let h=n.value,m=h.symbolKeys,y=new $s(["payload","ctx"],{shape:f,inst:e,memo:o,syms:m}),w=_=>`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`,v=(_,x)=>`
|
|
18
|
+
let ${_}_ab = false;
|
|
19
|
+
for (let i = 0; i < ${_}.issues.length; i++) {
|
|
20
|
+
const iss = ${_}.issues[i];
|
|
18
21
|
iss.path = iss.path ? [${x}, ...iss.path] : [${x}];
|
|
19
22
|
payload.issues.push(iss);
|
|
20
|
-
if (iss.continue !== true) ${
|
|
23
|
+
if (iss.continue !== true) ${_}_ab = true;
|
|
21
24
|
}
|
|
22
|
-
if (${
|
|
25
|
+
if (${_}_ab && ctx && ctx.abortEarly) {
|
|
23
26
|
payload.value = newResult;
|
|
24
27
|
return payload;
|
|
25
|
-
}`;y.write("const input = payload.value;");let
|
|
26
|
-
const ${x}_present = ${
|
|
28
|
+
}`;y.write("const input = payload.value;");let S=Object.create(null),T=0;for(let _ of h.allKeys)S[_]=`key_${T++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let _ of h.allKeys){if(_==="__proto__")continue;let x=S[_],$=typeof _=="symbol"?`syms[${m.indexOf(_)}]`:Ca(_),P=`${$} in input`,O=f[_],D=O?._zod?.optin,se=D!==void 0,ye=O?._zod?.optout==="optional";if(y.write(`const ${x} = ${w($)};`),se&&ye){let yt=D==="optional"?`${x}_present`:`${x}.value !== undefined || ${x}_present`;y.write(`
|
|
29
|
+
const ${x}_present = ${P};
|
|
27
30
|
if (!${x}.issues.length || ${x}_present) {
|
|
28
|
-
if (${x}.issues.length) {${v(x
|
|
31
|
+
if (${x}.issues.length) {${v(x,$)}
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
if (${
|
|
32
|
-
newResult[${
|
|
34
|
+
if (${yt}) {
|
|
35
|
+
newResult[${$}] = ${x}.value;
|
|
33
36
|
}
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
`)}else
|
|
37
|
-
if (${x}.issues.length) {${v(x
|
|
39
|
+
`)}else se?(y.write(`
|
|
40
|
+
if (${x}.issues.length) {${v(x,$)}
|
|
38
41
|
}
|
|
39
|
-
`),
|
|
40
|
-
if (${x}.value !== undefined || ${
|
|
41
|
-
newResult[${
|
|
42
|
+
`),D==="defaulted"?y.write(`newResult[${$}] = ${x}.value;`):y.write(`
|
|
43
|
+
if (${x}.value !== undefined || ${P}) {
|
|
44
|
+
newResult[${$}] = ${x}.value;
|
|
42
45
|
}
|
|
43
46
|
`)):y.write(`
|
|
44
|
-
const ${x}_present = ${
|
|
45
|
-
if (${x}.issues.length) {${v(x
|
|
47
|
+
const ${x}_present = ${P};
|
|
48
|
+
if (${x}.issues.length) {${v(x,$)}
|
|
46
49
|
}
|
|
47
50
|
if (!${x}_present && !${x}.issues.length) {
|
|
48
51
|
payload.issues.push({
|
|
49
52
|
code: "invalid_type",
|
|
50
53
|
expected: "nonoptional",
|
|
51
54
|
input: undefined,
|
|
52
|
-
path: [${
|
|
55
|
+
path: [${$}]
|
|
53
56
|
});
|
|
54
57
|
if (ctx && ctx.abortEarly) {
|
|
55
58
|
payload.value = newResult;
|
|
@@ -58,35 +61,43 @@ ${r.join(`
|
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
if (${x}_present) {
|
|
61
|
-
newResult[${
|
|
64
|
+
newResult[${$}] = ${x}.value;
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},i,a=er,c=!Re.jitless,l=c&&pa.value,d=t.catchall,p;e._zod.parse=(f,h)=>{p??(p=n.value);let m=f.value;return a(m)?c&&l&&h?.async===!1&&h.jitless!==!0?(i||(i=s(t.shape)),f=i(f,h),d?Zp([],m,f,h,p,e,h?.abortEarly===!0):f):r(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function Bf(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!We(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Ge(i,n,Ae())))}),t)}var ja=_("$ZodUnion",(e,t)=>{J.init(e,t),V(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),V(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),V(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>pn(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);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=>Bf(a,n,e,o)):Bf(i,n,e,o)}});function Zw(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var Dp=_("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ja.init(e,t);let r=e._zod.parse;V(e,"propValues",o=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&i++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,u)||De(s,u,new Set);for(let d of l)s[u].add(d)}}return!o.def.unionFallback&&i>1&&s[o.def.discriminator]?.delete(void 0),s}),t.options.forEach((o,s)=>{let i=Pr(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let n=kr(()=>Zw(t));e._zod.parse=(o,s)=>{let i=o.value;if(!er(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||s.direction!=="backward")?c._zod.run(o,s):t.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o)}}),Lp=_("$ZodIntersection",(e,t)=>{J.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Hf(r,c,u)):Hf(r,s,i)}});function Aa(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(At(e)&&At(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=Aa(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Aa(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Hf(e,t,r){let n=new Map,o,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);s.has(p)||s.set(p,u),d=[p]}else return!1;for(let p of d)n.has(p)||n.set(p,{}),n.get(p)[l]=!0;return!0};for(let u of t.issues)i(u,"l")||e.issues.push(u);for(let u of r.issues)i(u,"r")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let c=Aa(t.value,r.value);if(!c.valid){if(We(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Up=_("$ZodRecord",(e,t)=>{J.init(e,t);let r=Re.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!At(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>Ge(h,o,Ae())),input:l,path:[l],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:s[l],issues:[]},o);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...gt(l,h.issues)),n.value[p]=h.value})):(f.issues.length&&n.issues.push(...gt(l,f.issues)),n.value[p]=f.value)}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;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(typeof u=="string"&&_n.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?n.value[u]=s[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>Ge(h,o,Ae())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:s[u],issues:[]},o);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...gt(u,h.issues)),n.value[p]=h.value})):(f.issues.length&&n.issues.push(...gt(u,f.issues)),n.value[p]=f.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>n):n}});var qp=_("$ZodEnum",(e,t)=>{J.init(e,t);let r=Sr(t.entries),n=new Set(r);e._zod.values=n,V(e,"pattern",o=>{let s=Sr(o.def.entries).filter(i=>ha.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>mt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),Fp=_("$ZodLiteral",(e,t)=>{J.init(e,t);let r=new Set(t.values);e._zod.values=r,V(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s=="string"?mt(s):s?mt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var Vp=_("$ZodTransform",(e,t)=>{J.init(e,t),e._zod.optin="optional",Re.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Xe;return r.value=o,r}});function Kf(e,t){return e.value=t.issues.length?void 0:t.value,e}var Za=_("$ZodOptional",(e,t)=>{J.init(e,t),V(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",V(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),V(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${pn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Kf(r,s)):Kf(r,o)}return t.innerType._zod.run(r,n)}}),Bp=_("$ZodExactOptional",(e,t)=>{Za.init(e,t),V(e,"values",r=>r.def.innerType._zod.values),V(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Hp=_("$ZodNullable",(e,t)=>{J.init(e,t),V(e,"optin",r=>r.def.innerType._zod.optin),V(e,"optout",r=>r.def.innerType._zod.optout),V(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${pn(n.source)}|null)$`):void 0}),V(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Kp=_("$ZodDefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",V(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Jf(s,t)):Jf(o,t)}});function Jf(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Jp=_("$ZodPrefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",V(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Wp=_("$ZodNonOptional",(e,t)=>{J.init(e,t),V(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Wf(s,e)):Wf(o,e)}});function Wf(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Gf(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Ge(o,n,Ae()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Gp=_("$ZodCatch",(e,t)=>{J.init(e,t),V(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),V(e,"optout",r=>r.def.innerType._zod.optout),V(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Gf(r,s,t,n)):Gf(r,o,t,n)}});var Ma=_("$ZodPipe",(e,t)=>{J.init(e,t),V(e,"values",r=>r.def.in._zod.values),V(e,"optin",r=>r.def.in._zod.optin),V(e,"optout",r=>r.def.out._zod.optout),V(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>is(i,t.in,n)):is(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>is(s,t.out,n)):is(o,t.out,n)}});function is(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Xp=_("$ZodPreprocess",(e,t)=>{Ma.init(e,t)}),Yp=_("$ZodReadonly",(e,t)=>{J.init(e,t),V(e,"propValues",r=>r.def.innerType._zod.propValues),V(e,"values",r=>r.def.innerType._zod.values),V(e,"optin",r=>r.def.innerType?._zod?.optin),V(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Xf):Xf(o)}});function Xf(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Qp=_("$ZodCustom",(e,t)=>{me.init(e,t),J.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Yf(s,r,n,e));Yf(o,r,n,e)}});function Yf(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Er(o))}}var La=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Ua="~memo",eh=[];function th(e){return e!==null&&typeof e=="object"}function Da(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var rh=new WeakMap,wn=0,ps=1,xn=2;function hs(e,t,r){let n=rh.get(e);if(n!==void 0)return n?xn:wn;if(t.has(e))return xn;t.add(e);let o=wn,s=l=>{if(o!==xn&&l?._zod){let d=hs(l,t,r);d>o&&(o=d)}},i=(l,d)=>{let p=wn;for(let f of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,f);if(d&&!h.enumerable)continue;let m=h.get?ps:h.value?._zod?hs(h.value,t,r):wn;m>p&&(p=m)}return p},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Pr(c);a(l?i(l,!0):ps),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?hs(l,t,!1):ps);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let p=d.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(let f of p)s(f)}}}return t.delete(e),Mw(e,o)}function Mw(e,t){return t!==ps&&rh.set(e,t===xn),t}function Dw(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var ds,fs=[],Lw={alloc(e,t,r){let n=ds;if(!n)return r;ds=void 0;let o={value:r,issues:null};return n.set(t.value,o),fs.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&Uw(s,o.value))throw new La;return r(o,s)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let w=hs(e,new Set,!1);if(w===wn)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,u);w===xn||n?r=!0:n=!0}let l=c.value;if(!th(l))return i(c,u);let d=u[Ua];d||(d={buckets:new WeakMap,backEdges:void 0},u[Ua]=d);let p;o===u?p=s:(p=Dw(d,e),o=u,s=p);let f=p.get(l);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...Da(f.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),c;ds=p;let h=fs.length,m=i(c,u);ds=void 0;let y=fs.length>h?fs.pop():void 0;return m instanceof Promise?m.then(w=>(y&&(y.issues=w.issues.length?Da(w.issues):eh),w)):(y&&(y.issues=m.issues.length?Da(m.issues):eh),m)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function qa(){return Lw}function Uw(e,t){let r=e[Ua]?.backEdges;return r!==void 0&&th(t)&&r.has(t)}var qw=()=>{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(s){return e[s]??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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):n[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=ya(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${Ko(s.values[0])}`:`Invalid option: expected one of ${Bo(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Bo(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(a=>`'${a}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function nh(){return{localeError:qw()}}var oh;var Fa=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function sh(){return new Fa}(oh=globalThis).__zod_globalRegistry??(oh.__zod_globalRegistry=sh());var It=globalThis.__zod_globalRegistry;function ms(e){return e.checks&&(e.checks=[...e.checks]),e}function ih(e,t){return new e(ms({type:"string",...R(t)}))}function ah(e,t){return new e(ms({type:"string",coerce:!0,...R(t)}))}function ch(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function uh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function lh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function dh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function fh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function ph(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function Va(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function hh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function mh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function gh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function yh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function _h(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function bh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function wh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function xh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function vh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function $h(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function Sh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function zh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function kh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function Ph(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function Eh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}function gs(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function ys(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function _s(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function bs(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function Th(e,t){return new e(ms({type:"number",checks:[],...R(t)}))}function Oh(e,t){return new e(ms({type:"number",coerce:!0,checks:[],...R(t)}))}function Rh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function Ah(e,t){return new e({type:"boolean",...R(t)})}function Ih(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function Ch(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function Nh(e,t){return new e({type:"null",...R(t)})}function jh(e){return new e({type:"any"})}function Zh(e){return new e({type:"unknown"})}function Mh(e,t){return new e({type:"never",...R(t)})}function Dh(e,t){return new e({type:"date",coerce:!0,...R(t)})}function Rr(e,t){return new Oa({check:"less_than",...R(t),value:e,inclusive:!1})}function yt(e,t){return new Oa({check:"less_than",...R(t),value:e,inclusive:!0})}function Ar(e,t){return new Ra({check:"greater_than",...R(t),value:e,inclusive:!1})}function _t(e,t){return new Ra({check:"greater_than",...R(t),value:e,inclusive:!0})}function vn(e,t){return new Tf({check:"multiple_of",...R(t),value:e})}function ws(e,t){return new Rf({check:"max_length",...R(t),maximum:e})}function Ir(e,t){return new Af({check:"min_length",...R(t),minimum:e})}function xs(e,t){return new If({check:"length_equals",...R(t),length:e})}function Ba(e,t){return new Cf({check:"string_format",format:"regex",...R(t),pattern:e})}function Ha(e){return new Nf({check:"string_format",format:"lowercase",...R(e)})}function Ka(e){return new jf({check:"string_format",format:"uppercase",...R(e)})}function Ja(e,t){return new Zf({check:"string_format",format:"includes",...R(t),includes:e})}function Wa(e,t){return new Mf({check:"string_format",format:"starts_with",...R(t),prefix:e})}function Ga(e,t){return new Df({check:"string_format",format:"ends_with",...R(t),suffix:e})}function Ct(e){return new Lf({check:"overwrite",tx:e})}function Xa(e){return Ct(t=>t.normalize(e))}function Ya(){return Ct(e=>e.trim())}function Qa(){return Ct(e=>e.toLowerCase())}function ec(){return Ct(e=>e.toUpperCase())}function tc(){return Ct(e=>fa(e))}function Lh(e,t,r){return new e({type:"array",element:t,...R(r)})}function Uh(e,t,r){let n=R(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function qh(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function Fh(e,t){let r=Fw(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Er(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Er(s))}},e(n.value,n)),t);return r}function Fw(e,t){let r=new me({check:"custom",...R(t)});return r._zod.check=e,r}function $n(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&De(e,n,r[n]);return e}function nc(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??It,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ye(e,t,r,n,o){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(o);return Object.assign(r,s),!0}function ue(e,t,r={path:[],schemaPath:[]}){var n;let o=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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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 p=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),ue(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&$n(i.schema,c),t.io==="input"&&Pe(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Vh(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function oc(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.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.`);n.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??(h=>h);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${Vh(f)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Vh(l)}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(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>
|
|
67
|
+
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},i,a=ar,c=!Ie.jitless,l=c&&Na.value,d=t.catchall,p;e._zod.parse=(f,h)=>{p??(p=n.value);let m=f.value;return a(m)?c&&l&&h?.async===!1&&h.jitless!==!0?(i||(i=s(t.shape)),f=i(f,h),d?hh([],m,f,h,p,e,h?.abortEarly===!0):f):r(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function vp(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!Qe(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>et(i,n,Ne())))}),t)}var oc=b("$ZodUnion",(e,t)=>{W.init(e,t),H(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),H(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),H(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),H(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Tn(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);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=>vp(a,n,e,o)):vp(i,n,e,o)}});function $x(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var gh=b("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,oc.init(e,t);let r=e._zod.parse;H(e,"propValues",o=>{let s={},i=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&i++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(s,u)||qe(s,u,new Set);for(let d of l)s[u].add(d)}}return!o.def.unionFallback&&i>1&&s[o.def.discriminator]?.delete(void 0),s}),t.options.forEach((o,s)=>{let i=Zr(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let n=jr(()=>$x(t));e._zod.parse=(o,s)=>{let i=o.value;if(!ar(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],c=n.value.get(a);return c&&(a!==void 0||s.direction!=="backward")?c._zod.run(o,s):t.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(u=>n.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),o)}}),yh=b("$ZodIntersection",(e,t)=>{W.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>$p(r,c,u)):$p(r,s,i)}});function ec(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(Dt(e)&&Dt(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=ec(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=ec(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function $p(e,t,r){let n=new Map,o,s=new Map,i=(u,l)=>{let d;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),d=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let p=String(u.path[0]);s.has(p)||s.set(p,u),d=[p]}else return!1;for(let p of d)n.has(p)||n.set(p,{}),n.get(p)[l]=!0;return!0};for(let u of t.issues)i(u,"l")||e.issues.push(u);for(let u of r.issues)i(u,"r")||e.issues.push(u);let a=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&s.has(l)&&e.issues.push(s.get(l))}let c=ec(t.value,r.value);if(!c.valid){if(Qe(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var _h=b("$ZodRecord",(e,t)=>{W.init(e,t);let r=Ie.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Dt(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>et(h,o,Ne())),input:l,path:[l],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:s[l],issues:[]},o);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...vt(l,h.issues)),n.value[p]=h.value})):(f.issues.length&&n.issues.push(...vt(l,f.issues)),n.value[p]=f.value)}let u;for(let l in s)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else u=u??[],u.push(l);u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let c;for(let u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;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(typeof u=="string"&&In.test(u)&&l.issues.length){let h=t.keyType._zod.run({value:Number(u),issues:[]},o);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?n.value[u]=s[u]:a?(c=c??[],c.push(u)):n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>et(h,o,Ne())),input:u,path:[u],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let f=t.valueType._zod.run({value:s[u],issues:[]},o);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...vt(u,h.issues)),n.value[p]=h.value})):(f.issues.length&&n.issues.push(...vt(u,f.issues)),n.value[p]=f.value)}c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}return i.length?Promise.all(i).then(()=>n):n}});var bh=b("$ZodEnum",(e,t)=>{W.init(e,t);let r=Ir(t.entries),n=new Set(r);e._zod.values=n,H(e,"pattern",o=>{let s=Ir(o.def.entries).filter(i=>ja.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>xt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),wh=b("$ZodLiteral",(e,t)=>{W.init(e,t);let r=new Set(t.values);e._zod.values=r,H(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(s=>typeof s=="string"?xt(s):s?xt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var xh=b("$ZodTransform",(e,t)=>{W.init(e,t),e._zod.optin="optional",Ie.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new tt;return r.value=o,r}});function Sp(e,t){return e.value=t.issues.length?void 0:t.value,e}var sc=b("$ZodOptional",(e,t)=>{W.init(e,t),H(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",H(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),H(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Tn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Sp(r,s)):Sp(r,o)}return t.innerType._zod.run(r,n)}}),vh=b("$ZodExactOptional",(e,t)=>{sc.init(e,t),H(e,"values",r=>r.def.innerType._zod.values),H(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),$h=b("$ZodNullable",(e,t)=>{W.init(e,t),H(e,"optin",r=>r.def.innerType._zod.optin),H(e,"optout",r=>r.def.innerType._zod.optout),H(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Tn(n.source)}|null)$`):void 0}),H(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Sh=b("$ZodDefault",(e,t)=>{W.init(e,t),e._zod.optin="defaulted",H(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>zp(s,t)):zp(o,t)}});function zp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var zh=b("$ZodPrefault",(e,t)=>{W.init(e,t),e._zod.optin="defaulted",H(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),kh=b("$ZodNonOptional",(e,t)=>{W.init(e,t),H(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>kp(s,e)):kp(o,e)}});function kp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function Pp(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>et(o,n,Ne()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Ph=b("$ZodCatch",(e,t)=>{W.init(e,t),H(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),H(e,"optout",r=>r.def.innerType._zod.optout),H(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(s=>Pp(r,s,t,n)):Pp(r,o,t,n)}});var ic=b("$ZodPipe",(e,t)=>{W.init(e,t),H(e,"values",r=>r.def.in._zod.values),H(e,"optin",r=>r.def.in._zod.optin),H(e,"optout",r=>r.def.out._zod.optout),H(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Ss(i,t.in,n)):Ss(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Ss(s,t.out,n)):Ss(o,t.out,n)}});function Ss(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Eh=b("$ZodPreprocess",(e,t)=>{ic.init(e,t)}),Th=b("$ZodReadonly",(e,t)=>{W.init(e,t),H(e,"propValues",r=>r.def.innerType._zod.propValues),H(e,"values",r=>r.def.innerType._zod.values),H(e,"optin",r=>r.def.innerType?._zod?.optin),H(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Ep):Ep(o)}});function Ep(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Oh=b("$ZodCustom",(e,t)=>{_e.init(e,t),W.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>Tp(s,r,n,e));Tp(o,r,n,e)}});function Tp(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Dr(o))}}var cc=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},uc="~memo",Rh=[];function Ah(e){return e!==null&&typeof e=="object"}function ac(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Ch=new WeakMap,jn=0,Rs=1,Zn=2;function As(e,t,r){let n=Ch.get(e);if(n!==void 0)return n?Zn:jn;if(t.has(e))return Zn;t.add(e);let o=jn,s=l=>{if(o!==Zn&&l?._zod){let d=As(l,t,r);d>o&&(o=d)}},i=(l,d)=>{let p=jn;for(let f of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,f);if(d&&!h.enumerable)continue;let m=h.get?Rs:h.value?._zod?As(h.value,t,r):jn;m>p&&(p=m)}return p},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Zr(c);a(l?i(l,!0):Rs),s(c.catchall);break}case"array":s(c.element);break;case"tuple":for(let l of c.items)s(l);s(c.rest);break;case"record":case"map":s(c.keyType),s(c.valueType);break;case"set":s(c.valueType);break;case"union":for(let l of c.options)s(l);break;case"intersection":s(c.left),s(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(c.innerType);break;case"pipe":s(c.in),s(c.out);break;case"function":s(c.input),s(c.output);break;case"lazy":{let l=c._cachedInner??(r?e._zod.innerType:void 0);a(l?As(l,t,!1):Rs);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let d=Object.getOwnPropertyDescriptor(c,l);if(!d||d.get)continue;let p=d.value;if(!(!p||typeof p!="object")){if(p._zod)s(p);else if(Array.isArray(p))for(let f of p)s(f)}}}return t.delete(e),Sx(e,o)}function Sx(e,t){return t!==Rs&&Ch.set(e,t===Zn),t}function zx(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Ts,Os=[],kx={alloc(e,t,r){let n=Ts;if(!n)return r;Ts=void 0;let o={value:r,issues:null};return n.set(t.value,o),Os.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&Px(s,o.value))throw new cc;return r(o,s)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(c,u)=>{if(r===void 0){let w=As(e,new Set,!1);if(w===jn)return e._zod.parse=i,e._zod.run===a&&(e._zod.run=i),i(c,u);w===Zn||n?r=!0:n=!0}let l=c.value;if(!Ah(l))return i(c,u);let d=u[uc];d||(d={buckets:new WeakMap,backEdges:void 0},u[uc]=d);let p;o===u?p=s:(p=zx(d,e),o=u,s=p);let f=p.get(l);if(f)return c.value=f.value,f.issues?f.issues.length&&c.issues.push(...ac(f.issues)):(c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),c;Ts=p;let h=Os.length,m=i(c,u);Ts=void 0;let y=Os.length>h?Os.pop():void 0;return m instanceof Promise?m.then(w=>(y&&(y.issues=w.issues.length?ac(w.issues):Rh),w)):(y&&(y.issues=m.issues.length?ac(m.issues):Rh),m)};e._zod.parse=a,e._zod.run===i&&(e._zod.run=a)})}};function lc(){return kx}function Px(e,t){let r=e[uc]?.backEdges;return r!==void 0&&Ah(t)&&r.has(t)}var Ex=()=>{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(s){return e[s]??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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):n[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=Ma(s.input),c=o(a,s.input);return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${ds(s.values[0])}`:`Invalid option: expected one of ${us(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);return a?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);return a?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${us(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(a=>`'${a}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Ih(){return{localeError:Ex()}}var Nh;var dc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function jh(){return new dc}(Nh=globalThis).__zod_globalRegistry??(Nh.__zod_globalRegistry=jh());var Mt=globalThis.__zod_globalRegistry;function Cs(e){return e.checks&&(e.checks=[...e.checks]),e}function Zh(e,t){return new e(Cs({type:"string",...I(t)}))}function Dh(e,t){return new e(Cs({type:"string",coerce:!0,...I(t)}))}function Mh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function Lh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function Uh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function qh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function Fh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function Bh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function fc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function Vh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function Hh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function Kh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function Jh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function Wh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function Gh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function Xh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function Yh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function Qh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function em(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function tm(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function rm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function nm(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function om(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function sm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function Is(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Ns(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function js(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Zs(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function im(e,t){return new e(Cs({type:"number",checks:[],...I(t)}))}function am(e,t){return new e(Cs({type:"number",coerce:!0,checks:[],...I(t)}))}function cm(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function um(e,t){return new e({type:"boolean",...I(t)})}function lm(e,t){return new e({type:"boolean",coerce:!0,...I(t)})}function dm(e,t){return new e({type:"bigint",coerce:!0,...I(t)})}function fm(e,t){return new e({type:"null",...I(t)})}function pm(e){return new e({type:"any"})}function hm(e){return new e({type:"unknown"})}function mm(e,t){return new e({type:"never",...I(t)})}function gm(e,t){return new e({type:"date",coerce:!0,...I(t)})}function Ur(e,t){return new Ya({check:"less_than",...I(t),value:e,inclusive:!1})}function $t(e,t){return new Ya({check:"less_than",...I(t),value:e,inclusive:!0})}function qr(e,t){return new Qa({check:"greater_than",...I(t),value:e,inclusive:!1})}function St(e,t){return new Qa({check:"greater_than",...I(t),value:e,inclusive:!0})}function Dn(e,t){return new ip({check:"multiple_of",...I(t),value:e})}function Ds(e,t){return new cp({check:"max_length",...I(t),maximum:e})}function Fr(e,t){return new up({check:"min_length",...I(t),minimum:e})}function Ms(e,t){return new lp({check:"length_equals",...I(t),length:e})}function pc(e,t){return new dp({check:"string_format",format:"regex",...I(t),pattern:e})}function hc(e){return new fp({check:"string_format",format:"lowercase",...I(e)})}function mc(e){return new pp({check:"string_format",format:"uppercase",...I(e)})}function gc(e,t){return new hp({check:"string_format",format:"includes",...I(t),includes:e})}function yc(e,t){return new mp({check:"string_format",format:"starts_with",...I(t),prefix:e})}function _c(e,t){return new gp({check:"string_format",format:"ends_with",...I(t),suffix:e})}function Lt(e){return new yp({check:"overwrite",tx:e})}function bc(e){return Lt(t=>t.normalize(e))}function wc(){return Lt(e=>e.trim())}function xc(){return Lt(e=>e.toLowerCase())}function vc(){return Lt(e=>e.toUpperCase())}function $c(){return Lt(e=>Ia(e))}function ym(e,t,r){return new e({type:"array",element:t,...I(r)})}function _m(e,t,r){let n=I(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function bm(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function wm(e,t){let r=Tx(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Dr(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Dr(s))}},e(n.value,n)),t);return r}function Tx(e,t){let r=new _e({check:"custom",...I(t)});return r._zod.check=e,r}function Mn(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&qe(e,n,r[n]);return e}function zc(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??Mt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function rt(e,t,r,n,o){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(o);return Object.assign(r,s),!0}function le(e,t,r={path:[],schemaPath:[]}){var n;let o=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),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;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 p=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),le(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Mn(i.schema,c),t.io==="input"&&Oe(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function xm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function kc(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.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.`);n.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??(h=>h);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${xm(f)}`}}let c="#",u=`${c}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:c};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+xm(l)}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(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>
|
|
65
68
|
|
|
66
|
-
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}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Kh(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Kh(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Jh=new Set(["type","properties","required","additionalProperties"]),Bh=["oneOf","anyOf"];function Hh(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function rc(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!Jh.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??Hh(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:rc(a)??{allOf:a};De(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=Hh(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function Vw(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Jh)if(o in e)return;let r=t.filter(o=>Bh.some(s=>Array.isArray(o[s]))),n=null;if(!r.length)n=rc(t);else{let o=r[0],s=Bh.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter(c=>c!==o),a=o[s].map(c=>rc([...i,c]));if(a.some(c=>!c))return;n={[s]:a}}n&&(delete e.allOf,$n(e,n))}function sc(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let 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){n(d);let f=e.seen.get(d),h=f.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)):$n(u,h),$n(u,l),a._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(h.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let p=a._zod.parent;if(p&&p!==d){n(p);let f=e.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let h in u)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(u[h])===JSON.stringify(f.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Kh(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Vw(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$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");o.$id=e.external.uri(a)}$n(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,De(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Sn(t,"input",e.processors),output:Sn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Pe(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Pe(n.element,r);if(n.type==="set")return Pe(n.valueType,r);if(n.type==="lazy")return Pe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Pe(n.innerType,r);if(n.type==="intersection")return Pe(n.left,r)||Pe(n.right,r);if(n.type==="record"||n.type==="map")return Pe(n.keyType,r)||Pe(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Pe(n.in,r)||Pe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Pe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Pe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Pe(o,r))return!0;return!!(n.rest&&Pe(n.rest,r))}return!1}var Wh=(e,t={})=>r=>{let n=nc({...r,processors:t});return ue(e,n),oc(n,e),sc(n,e)},Sn=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=nc({...o??{},target:s,io:t,processors:r});return ue(e,i),oc(i,e),sc(i,e)};var Cr=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Nr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},Gh=(e,t)=>{Cr(e,"minimum",t),Nr(e,"maximum",t)},em=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},tm=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},rm=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},nm=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Xh=(e,t)=>Cr(e,"minimum",t.minimum),Yh=(e,t)=>Nr(e,"maximum",t.maximum),Qh=e=>(t,r)=>{nm(t,r.format);let[n,o]=e[r.format];Cr(t,"minimum",n),Nr(t,"maximum",o)},Bw={greater_than:(e,t)=>Cr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Nr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>em(e,t.value),number_format:Qh(hn),bigint_format:Qh(Jo),min_length:Xh,max_length:Yh,length_equals:(e,t)=>Gh(e,t.length),min_size:Xh,max_size:Yh,size_equals:(e,t)=>Gh(e,t.size),string_format:(e,t)=>{nm(e,t.format),t.pattern&&tm(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>rm(e,t.mime)};function ge(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)Bw[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Cr(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Cr(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Nr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Nr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&em(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&rm(t,o.mime);for(let s of o.patterns??[])tm(t,s);return t}var Hw={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Kw=new Map([[Ca,mf],[ls,gf]]),om=e=>Kw.get(e)??e,sm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=ge(e);if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Hw[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let d=[...c].map(om);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},im=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=ge(e);o.type=l?"integer":"number";let d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d?f?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof s=="number"&&(o.minimum=s),p?f?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof i=="number"&&(o.maximum=i),a){let h=new Set;for(let w of a)Number.isFinite(w)&&w!==0?h.add(Math.abs(w)):Ye(e,t,o,n,`A multipleOf divisor of ${w} cannot be represented in JSON Schema`);let[m,...y]=h;m!==void 0&&(o.multipleOf=m),y.length&&(o.allOf=[...o.allOf??[],...y.map(w=>({multipleOf:w}))])}},am=(e,t,r,n)=>{r.type="boolean"},cm=(e,t,r,n)=>{Ye(e,t,r,n,"BigInt cannot be represented in JSON Schema")};var um=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var lm=(e,t,r,n)=>{r.not={}},dm=(e,t,r,n)=>{},fm=(e,t,r,n)=>{},pm=(e,t,r,n)=>{Ye(e,t,r,n,"Date cannot be represented in JSON Schema")},hm=(e,t,r,n)=>{let o=e._zod.def,s=Sr(o.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},mm=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(Ye(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(Ye(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;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 gm=(e,t,r,n)=>{Ye(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var ym=(e,t,r,n)=>{Ye(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var _m=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=ge(e);typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=ue(s.element,t,{...n,path:[...n.path,"items"]})};function vs(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?vs(t.out):t.type==="catch"?vs(t.innerType):e._zod.optin}var bm=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&Ye(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in i)De(o.properties,u,ue(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];(t.io==="input"?vs(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=ue(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},wm=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>ue(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},xm=(e,t,r,n)=>{let o=e._zod.def,s=ue(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=ue(o.right,t,{...n,path:[...n.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,t.intersections.push(c)};function ic(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let m=ic(e,h,r);return m===h?t:m}for(let h of["anyOf","oneOf"]){let m=t[h];if(!Array.isArray(m))continue;let y=m.map(w=>ic(e,w,r));y.some((w,v)=>w!==m[v])&&(t={...t,[h]:y})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(h=>h==="number"||h==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(h=>typeof h=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:p,...f}=t;return f.enum?f.enum=f.enum.map(h=>typeof h=="number"?String(h):h):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(n.includes("number")?_n:Ea).source)),f}var ac=new WeakMap;function Jw(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of ac.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=ic(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);s&&(o.propertyNames=s)}}var vm=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=ge(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=ue(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)De(o.patternProperties,om(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=ue(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=ac.get(t);l||(l=[],ac.set(t,l),t.deferred.push(()=>Jw(t))),l.push(e)}o.additionalProperties=ue(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&vs(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l.map(String))}},$m=(e,t,r,n)=>{let o=e._zod.def,s=ue(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Sm=(e,t,r,n)=>{let o=e._zod.def;ue(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},cc=Symbol();function zm(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(Ye(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),cc):JSON.parse(i)}var km=(e,t,r,n)=>{let o=e._zod.def;ue(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=zm(o.defaultValue,e,t,r,n);i!==cc&&(r.default=i)},Pm=(e,t,r,n)=>{let o=e._zod.def;ue(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=zm(o.defaultValue,e,t,r,n);i!==cc&&(r._prefault=i)},Em=(e,t,r,n)=>{let o=e._zod.def;ue(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{Ye(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Tm=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;ue(i,t,n);let a=t.seen.get(e);a.ref=i},Om=(e,t,r,n)=>{let o=e._zod.def;ue(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var uc=(e,t,r,n)=>{let o=e._zod.def;ue(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};function $s(e){return!!e._zod}function Ee(e,t){return $s(e)?za(e,t):e.safeParse(t)}function Zr(e){if(!e)return;let t;if($s(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Mr(e){if($s(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 n=e.value;if(n!==void 0)return n}var Rm=new WeakSet([Object.prototype,Error.prototype]);function Ss(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var ox=(e,t)=>{qd.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Rm.has(r)||(Rm.add(r),Ss(r,"format",n=>o=>Sa(n,o)),Ss(r,"flatten",n=>o=>$a(n,o)),Ss(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,zr,2)}),Ss(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,zr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Le=_("ZodError",ox,void 0,{Parent:Error});var Am=Qo(Le),Im=es(Le),Cm=yn(Le),Nm=ts(Le),jm=Bd(Le),Zm=Hd(Le),Mm=Kd(Le),Dm=Jd(Le),Lm=Wd(Le),Um=Gd(Le),qm=Xd(Le),Fm=Yd(Le);function ix(){Re.localeError||Ae(nh())}function ks(){Re.memoizer||Ae({memoizer:qa()})}var G=_("ZodType",(e,t)=>(ix(),J.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(C.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return qe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Kx(e,t))},superRefine(e,t){return this.check(Jx(e,t))},overwrite(e){return this.check(Ct(e))},optional(){return ie(this)},exactOptional(){return Nx(this)},nullable(){return Hm(this)},nullish(){return ie(Hm(this))},nonoptional(e){return Ux(this,e)},array(){return $(this)},or(e){return te([this,e])},and(e){return Es(this,e)},transform(e){return Km(this,ng(e))},default(e){return Mx(this,e)},prefault(e){return Lx(this,e)},catch(e){return Fx(this,e)},pipe(e){return Km(this,e)},readonly(){return Hx(this)},describe(e){let t=this.clone();return It.add(t,{description:e}),t},meta(...e){if(e.length===0)return It.get(this);let t=this.clone();return It.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return C.hide(this,"~standard",{...Ia(this),jsonSchema:{input:Sn(this,"input"),output:Sn(this,"output")}})},set"~standard"(e){C.own(this,"~standard",e)},parse:function e(t,r){return Am(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Im(this,t,r,{callee:e})},safeParse(e,t){return Cm(this,e,t)},async safeParseAsync(e,t){return Nm(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){C.own(this,"spa",e)},validate(e,t){return rs(this,e,t)},validateAsync(e,t){return ns(this,e,t)},encode:function e(t,r){return jm(this,t,r,{callee:e})},decode:function e(t,r){return Zm(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Mm(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Dm(this,t,r,{callee:e})},safeEncode(e,t){return Lm(this,e,t)},safeDecode(e,t){return Um(this,e,t)},async safeEncodeAsync(e,t){return qm(this,e,t)},async safeDecodeAsync(e,t){return Fm(this,e,t)},toJSONSchema(e){return Wh(this,{})(e)},get description(){return It.get(this)?.description},get _def(){return this._zod.def}}),Jm=_("_ZodString",(e,t)=>{us.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sm(e,r,n,o)},C.derived({format:e=>ge(e).format??null,minLength:e=>ge(e).minimum??null,maxLength:e=>ge(e).maximum??null},{regex(...e){return this.check(Ba(...e))},includes(...e){return this.check(Ja(...e))},startsWith(...e){return this.check(Wa(...e))},endsWith(...e){return this.check(Ga(...e))},min(...e){return this.check(Ir(...e))},max(...e){return this.check(ws(...e))},length(...e){return this.check(xs(...e))},nonempty(...e){return this.check(Ir(1,...e))},lowercase(e){return this.check(Ha(e))},uppercase(e){return this.check(Ka(e))},trim(){return this.check(Ya())},normalize(...e){return this.check(Xa(...e))},toLowerCase(){return this.check(Qa())},toUpperCase(){return this.check(ec())},slugify(){return this.check(tc())}})),dc=_("ZodString",(e,t)=>{us.init(e,t),Jm.init(e,t)},{email(e){return this.check(ch(ax,e))},url(e){return this.check(Va(Wm,e))},jwt(e){return this.check(Eh($x,e))},emoji(e){return this.check(hh(ux,e))},guid(e){return this.check(uh(cx,e))},uuid(e){return this.check(lh(zs,e))},uuidv4(e){return this.check(dh(zs,e))},uuidv6(e){return this.check(fh(zs,e))},uuidv7(e){return this.check(ph(zs,e))},nanoid(e){return this.check(mh(lx,e))},cuid(e){return this.check(gh(dx,e))},cuid2(e){return this.check(yh(fx,e))},ulid(e){return this.check(_h(px,e))},base64(e){return this.check(zh(wx,e))},base64url(e){return this.check(kh(xx,e))},xid(e){return this.check(bh(hx,e))},ksuid(e){return this.check(wh(mx,e))},ipv4(e){return this.check(xh(gx,e))},ipv6(e){return this.check(vh(yx,e))},cidrv4(e){return this.check($h(_x,e))},cidrv6(e){return this.check(Sh(bx,e))},e164(e){return this.check(Ph(vx,e))},datetime(e){return this.check(gs(zn,e))},date(e){return this.check(ys(kn,e))},time(e){return this.check(_s(Pn,e))},duration(e){return this.check(bs(En,e))}});function g(e){return ih(dc,e)}var ae=_("ZodStringFormat",(e,t)=>{ee.init(e,t),Jm.init(e,t)}),zn=_("ZodISODateTime",(e,t)=>{pp.init(e,t),ae.init(e,t)}),kn=_("ZodISODate",(e,t)=>{hp.init(e,t),ae.init(e,t)}),Pn=_("ZodISOTime",(e,t)=>{mp.init(e,t),ae.init(e,t)}),En=_("ZodISODuration",(e,t)=>{gp.init(e,t),ae.init(e,t)}),ax=_("ZodEmail",(e,t)=>{rp.init(e,t),ae.init(e,t)});var cx=_("ZodGUID",(e,t)=>{ep.init(e,t),ae.init(e,t)});var zs=_("ZodUUID",(e,t)=>{tp.init(e,t),ae.init(e,t)});var Wm=_("ZodURL",(e,t)=>{sp.init(e,t),ae.init(e,t)});function Gm(e){return Va(Wm,e)}var ux=_("ZodEmoji",(e,t)=>{ip.init(e,t),ae.init(e,t)});var lx=_("ZodNanoID",(e,t)=>{ap.init(e,t),ae.init(e,t)});var dx=_("ZodCUID",(e,t)=>{cp.init(e,t),ae.init(e,t)});var fx=_("ZodCUID2",(e,t)=>{up.init(e,t),ae.init(e,t)});var px=_("ZodULID",(e,t)=>{lp.init(e,t),ae.init(e,t)});var hx=_("ZodXID",(e,t)=>{dp.init(e,t),ae.init(e,t)});var mx=_("ZodKSUID",(e,t)=>{fp.init(e,t),ae.init(e,t)});var gx=_("ZodIPv4",(e,t)=>{yp.init(e,t),ae.init(e,t)});var yx=_("ZodIPv6",(e,t)=>{bp.init(e,t),ae.init(e,t)});var _x=_("ZodCIDRv4",(e,t)=>{wp.init(e,t),ae.init(e,t)});var bx=_("ZodCIDRv6",(e,t)=>{xp.init(e,t),ae.init(e,t)});var wx=_("ZodBase64",(e,t)=>{$p.init(e,t),ae.init(e,t)});var xx=_("ZodBase64URL",(e,t)=>{Sp.init(e,t),ae.init(e,t)});var vx=_("ZodE164",(e,t)=>{zp.init(e,t),ae.init(e,t)});var $x=_("ZodJWT",(e,t)=>{kp.init(e,t),ae.init(e,t)});var Ps=_("ZodNumber",(e,t)=>{Na.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>im(e,r,n,o),e.isFinite=!0},C.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=ge(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=ge(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=ge(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>ge(e).format??null},{gt(e,t){return this.check(Ar(e,t))},gte(e,t){return this.check(_t(e,t))},min(e,t){return this.check(_t(e,t))},lt(e,t){return this.check(Rr(e,t))},lte(e,t){return this.check(yt(e,t))},max(e,t){return this.check(yt(e,t))},int(e){return this.check(Vm(e))},safe(e){return this.check(Vm(e))},positive(e){return this.check(Ar(0,e))},nonnegative(e){return this.check(_t(0,e))},negative(e){return this.check(Rr(0,e))},nonpositive(e){return this.check(yt(0,e))},multipleOf(e,t){return this.check(vn(e,t))},step(e,t){return this.check(vn(e,t))},finite(){return this}}));function B(e){return Th(Ps,e)}var Sx=_("ZodNumberFormat",(e,t)=>{Pp.init(e,t),Ps.init(e,t)});function Vm(e){return Rh(Sx,e)}var fc=_("ZodBoolean",(e,t)=>{Ep.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>am(e,r,n,o)});function X(e){return Ah(fc,e)}var Xm=_("ZodBigInt",(e,t)=>{Tp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cm(e,r,n,o)},C.derived({minValue:e=>ge(e).minimum??null,maxValue:e=>ge(e).maximum??null,format:e=>ge(e).format??null},{gte(e,t){return this.check(_t(e,t))},min(e,t){return this.check(_t(e,t))},gt(e,t){return this.check(Ar(e,t))},lt(e,t){return this.check(Rr(e,t))},lte(e,t){return this.check(yt(e,t))},max(e,t){return this.check(yt(e,t))},positive(e){return this.check(Ar(BigInt(0),e))},negative(e){return this.check(Rr(BigInt(0),e))},nonpositive(e){return this.check(yt(BigInt(0),e))},nonnegative(e){return this.check(_t(BigInt(0),e))},multipleOf(e,t){return this.check(vn(e,t))}}));var zx=_("ZodNull",(e,t)=>{Op.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>um(e,r,n,o)});function Ym(e){return Nh(zx,e)}var kx=_("ZodAny",(e,t)=>{Rp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dm(e,r,n,o)});function Qm(){return jh(kx)}var Px=_("ZodUnknown",(e,t)=>{Ap.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fm(e,r,n,o)});function se(){return Zh(Px)}var Ex=_("ZodNever",(e,t)=>{Ip.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lm(e,r,n,o)});function Tx(e){return Mh(Ex,e)}var eg=_("ZodDate",(e,t)=>{Cp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pm(e,r,n,o),e.min=(r,n)=>e.check(_t(r,n)),e.max=(r,n)=>e.check(yt(r,n))},C.derived({minDate:e=>{let{minimum:t}=ge(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=ge(e);return t?new Date(t):null}},{}));var Ox=_("ZodArray",(e,t)=>{ks(),Np.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_m(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Ir(e,t))},nonempty(e){return this.check(Ir(1,e))},max(e,t){return this.check(ws(e,t))},length(e,t){return this.check(xs(e,t))},unwrap(){return this.element}});function $(e,t){return Lh(Ox,e,t)}var tg=_("ZodObject",(e,t)=>{ks(),Mp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bm(e,r,n,o),C.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ie(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(C.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(C.mergeDefs(this._zod.def,{catchall:se()}))},loose(){return this.clone(C.mergeDefs(this._zod.def,{catchall:se()}))},strict(){return this.clone(C.mergeDefs(this._zod.def,{catchall:Tx()}))},strip(){return this.clone(C.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return C.extend(this,e)},safeExtend(e){return C.safeExtend(this,e)},merge(e){return C.merge(this,e)},pick(e){return C.pick(this,e)},omit(e){return C.omit(this,e)},partial(...e){return C.partial(og,this,e[0])},exactPartial(...e){return C.partial(sg,this,e[0],"exactPartial")},required(...e){return C.required(ig,this,e[0])}});function S(e,t){let r={type:"object",shape:e??{},...C.normalizeParams(t)};return new tg(r)}function fe(e,t){return new tg({type:"object",shape:e,catchall:se(),...C.normalizeParams(t)})}var rg=_("ZodUnion",(e,t)=>{ja.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wm(e,r,n,o),e.options=t.options});function te(e,t){return new rg({type:"union",options:e,...C.normalizeParams(t)})}var Rx=_("ZodDiscriminatedUnion",(e,t)=>{rg.init(e,t),Dp.init(e,t)});function pc(e,t,r){return new Rx({type:"union",options:t,discriminator:e,...C.normalizeParams(r)})}var Ax=_("ZodIntersection",(e,t)=>{Lp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xm(e,r,n,o)});function Es(e,t){return new Ax({type:"intersection",left:e,right:t})}var Bm=_("ZodRecord",(e,t)=>{ks(),Up.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vm(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Q(e,t,r){return!t||!t._zod?new Bm({type:"record",keyType:g(),valueType:e,...C.normalizeParams(t)}):new Bm({type:"record",keyType:e,valueType:t,...C.normalizeParams(r)})}var lc=_("ZodEnum",(e,t)=>{qp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(n,o,s)=>hm(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new lc({...t,checks:[],...C.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new lc({...t,checks:[],...C.normalizeParams(o),entries:s})}});function Ie(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new lc({type:"enum",entries:r,...C.normalizeParams(t)})}var Ix=_("ZodLiteral",(e,t)=>{Fp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mm(e,r,n,o),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 P(e,t){return new Ix({type:"literal",values:Array.isArray(e)?e:[e],...C.normalizeParams(t)})}var Cx=_("ZodTransform",(e,t)=>{ks(),Vp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ym(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(C.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(C.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function ng(e){return new Cx({type:"transform",transform:e})}var og=_("ZodOptional",(e,t)=>{Za.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ie(e){return new og({type:"optional",innerType:e})}var sg=_("ZodExactOptional",(e,t)=>{Bp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nx(e){return new sg({type:"optional",innerType:e})}var jx=_("ZodNullable",(e,t)=>{Hp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$m(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Hm(e){return new jx({type:"nullable",innerType:e})}var Zx=_("ZodDefault",(e,t)=>{Kp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>km(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mx(e,t){return new Zx({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():C.shallowClone(t)}})}var Dx=_("ZodPrefault",(e,t)=>{Jp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pm(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Lx(e,t){return new Dx({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():C.shallowClone(t)}})}var ig=_("ZodNonOptional",(e,t)=>{Wp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sm(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ux(e,t){return new ig({type:"nonoptional",innerType:e,...C.normalizeParams(t)})}var qx=_("ZodCatch",(e,t)=>{Gp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Em(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fx(e,t){return new qx({type:"catch",innerType:e,catchValue:typeof t=="function"?t:C.constantCatch(t)})}var ag=_("ZodPipe",(e,t)=>{Ma.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tm(e,r,n,o),e.in=t.in,e.out=t.out});function Km(e,t){return new ag({type:"pipe",in:e,out:t})}var Vx=_("ZodPreprocess",(e,t)=>{ag.init(e,t),Xp.init(e,t)}),Bx=_("ZodReadonly",(e,t)=>{Yp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Om(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Hx(e){return new Bx({type:"readonly",innerType:e})}var cg=_("ZodCustom",(e,t)=>{Qp.init(e,t),G.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gm(e,r,n,o)});function ug(e,t){return Uh(cg,e??(()=>!0),t)}function Kx(e,t={}){return qh(cg,e,t)}function Jx(e,t){return Fh(e,t)}function hc(e,t){return new Vx({type:"pipe",in:ng(e),out:t})}var dg={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 lg;lg||(lg={});var Ts={};oa(Ts,{ZodISODate:()=>kn,ZodISODateTime:()=>zn,ZodISODuration:()=>En,ZodISOTime:()=>Pn,date:()=>Xx,datetime:()=>Gx,duration:()=>Qx,time:()=>Yx});function Gx(e){return gs(zn,e)}function Xx(e){return ys(kn,e)}function Yx(e){return _s(Pn,e)}function Qx(e){return bs(En,e)}var Os={};oa(Os,{bigint:()=>nv,boolean:()=>rv,date:()=>ov,number:()=>tv,string:()=>ev});function ev(e){return ah(dc,e)}function tv(e){return Oh(Ps,e)}function rv(e){return Ih(fc,e)}function nv(e){return Ch(Xm,e)}function ov(e){return Dh(eg,e)}var Nt="2025-11-25";var As=[Nt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],jt="io.modelcontextprotocol/related-task",Is="2.0",pe=ug(e=>e!==null&&(typeof e=="object"||typeof e=="function")),fg=te([g(),B().int()]),pg=g(),XA=fe({ttl:B().optional(),pollInterval:B().optional()}),iv=S({ttl:B().optional()}),av=S({taskId:g()}),gc=fe({progressToken:fg.optional(),[jt]:av.optional()}),Ue=S({_meta:gc.optional()}),Tn=Ue.extend({task:iv.optional()}),hg=e=>Tn.safeParse(e).success,ye=S({method:g(),params:Ue.loose().optional()}),Fe=S({_meta:gc.optional()}),Ve=S({method:g(),params:Fe.loose().optional()}),_e=fe({_meta:gc.optional()}),Cs=te([g(),B().int()]),mg=S({jsonrpc:P(Is),id:Cs,...ye.shape}).strict(),On=e=>mg.safeParse(e).success,gg=S({jsonrpc:P(Is),...Ve.shape}).strict(),yg=e=>gg.safeParse(e).success,yc=S({jsonrpc:P(Is),id:Cs,result:_e}).strict(),tr=e=>yc.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 _c=S({jsonrpc:P(Is),id:Cs.optional(),error:S({code:B().int(),message:g(),data:se().optional()})}).strict();var _g=e=>_c.safeParse(e).success;var Lr=te([mg,gg,yc,_c]),YA=te([yc,_c]),bt=_e.strict(),cv=Fe.extend({requestId:Cs.optional(),reason:g().optional()}),Ns=Ve.extend({method:P("notifications/cancelled"),params:cv}),uv=S({src:g(),mimeType:g().optional(),sizes:$(g()).optional(),theme:Ie(["light","dark"]).optional()}),Rn=S({icons:$(uv).optional()}),Dr=S({name:g(),title:g().optional()}),bg=Dr.extend({...Dr.shape,...Rn.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),lv=Es(S({applyDefaults:X().optional()}),Q(g(),se())),dv=hc(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Es(S({form:lv.optional(),url:pe.optional()}),Q(g(),se()).optional())),fv=fe({list:pe.optional(),cancel:pe.optional(),requests:fe({sampling:fe({createMessage:pe.optional()}).optional(),elicitation:fe({create:pe.optional()}).optional()}).optional()}),pv=fe({list:pe.optional(),cancel:pe.optional(),requests:fe({tools:fe({call:pe.optional()}).optional()}).optional()}),hv=S({experimental:Q(g(),pe).optional(),sampling:S({context:pe.optional(),tools:pe.optional()}).optional(),elicitation:dv.optional(),roots:S({listChanged:X().optional()}).optional(),tasks:fv.optional(),extensions:Q(g(),pe).optional()}),mv=Ue.extend({protocolVersion:g(),capabilities:hv,clientInfo:bg}),bc=ye.extend({method:P("initialize"),params:mv});var gv=S({experimental:Q(g(),pe).optional(),logging:pe.optional(),completions:pe.optional(),prompts:S({listChanged:X().optional()}).optional(),resources:S({subscribe:X().optional(),listChanged:X().optional()}).optional(),tools:S({listChanged:X().optional()}).optional(),tasks:pv.optional(),extensions:Q(g(),pe).optional()}),wc=_e.extend({protocolVersion:g(),capabilities:gv,serverInfo:bg,instructions:g().optional()}),js=Ve.extend({method:P("notifications/initialized"),params:Fe.optional()}),wg=e=>js.safeParse(e).success,Zs=ye.extend({method:P("ping"),params:Ue.optional()}),yv=S({progress:B(),total:ie(B()),message:ie(g())}),_v=S({...Fe.shape,...yv.shape,progressToken:fg}),Ms=Ve.extend({method:P("notifications/progress"),params:_v}),bv=Ue.extend({cursor:pg.optional()}),An=ye.extend({params:bv.optional()}),In=_e.extend({nextCursor:pg.optional()}),wv=Ie(["working","input_required","completed","failed","cancelled"]),Cn=S({taskId:g(),status:wv,ttl:te([B(),Ym()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:ie(B()),statusMessage:ie(g())}),wt=_e.extend({task:Cn}),xv=Fe.merge(Cn),Nn=Ve.extend({method:P("notifications/tasks/status"),params:xv}),Ds=ye.extend({method:P("tasks/get"),params:Ue.extend({taskId:g()})}),Ls=_e.merge(Cn),Us=ye.extend({method:P("tasks/result"),params:Ue.extend({taskId:g()})}),QA=_e.loose(),qs=An.extend({method:P("tasks/list")}),Fs=In.extend({tasks:$(Cn)}),Vs=ye.extend({method:P("tasks/cancel"),params:Ue.extend({taskId:g()})}),xg=_e.merge(Cn),vg=S({uri:g(),mimeType:ie(g()),_meta:Q(g(),se()).optional()}),$g=vg.extend({text:g()}),xc=g().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Sg=vg.extend({blob:xc}),jn=Ie(["user","assistant"]),Ur=S({audience:$(jn).optional(),priority:B().min(0).max(1).optional(),lastModified:Ts.datetime({offset:!0}).optional()}),zg=S({...Dr.shape,...Rn.shape,uri:g(),description:ie(g()),mimeType:ie(g()),size:ie(B()),annotations:Ur.optional(),_meta:ie(fe({}))}),vv=S({...Dr.shape,...Rn.shape,uriTemplate:g(),description:ie(g()),mimeType:ie(g()),annotations:Ur.optional(),_meta:ie(fe({}))}),$v=An.extend({method:P("resources/list")}),vc=In.extend({resources:$(zg)}),Sv=An.extend({method:P("resources/templates/list")}),$c=In.extend({resourceTemplates:$(vv)}),Sc=Ue.extend({uri:g()}),zv=Sc,kv=ye.extend({method:P("resources/read"),params:zv}),zc=_e.extend({contents:$(te([$g,Sg]))}),kc=Ve.extend({method:P("notifications/resources/list_changed"),params:Fe.optional()}),Pv=Sc,Ev=ye.extend({method:P("resources/subscribe"),params:Pv}),Tv=Sc,Ov=ye.extend({method:P("resources/unsubscribe"),params:Tv}),Rv=Fe.extend({uri:g()}),Av=Ve.extend({method:P("notifications/resources/updated"),params:Rv}),Iv=S({name:g(),description:ie(g()),required:ie(X())}),Cv=S({...Dr.shape,...Rn.shape,description:ie(g()),arguments:ie($(Iv)),_meta:ie(fe({}))}),Nv=An.extend({method:P("prompts/list")}),Pc=In.extend({prompts:$(Cv)}),jv=Ue.extend({name:g(),arguments:Q(g(),g()).optional()}),Zv=ye.extend({method:P("prompts/get"),params:jv}),Ec=S({type:P("text"),text:g(),annotations:Ur.optional(),_meta:Q(g(),se()).optional()}),Tc=S({type:P("image"),data:xc,mimeType:g(),annotations:Ur.optional(),_meta:Q(g(),se()).optional()}),Oc=S({type:P("audio"),data:xc,mimeType:g(),annotations:Ur.optional(),_meta:Q(g(),se()).optional()}),Mv=S({type:P("tool_use"),name:g(),id:g(),input:Q(g(),se()),_meta:Q(g(),se()).optional()}),Dv=S({type:P("resource"),resource:te([$g,Sg]),annotations:Ur.optional(),_meta:Q(g(),se()).optional()}),Lv=zg.extend({type:P("resource_link")}),Rc=te([Ec,Tc,Oc,Lv,Dv]),Uv=S({role:jn,content:Rc}),Ac=_e.extend({description:g().optional(),messages:$(Uv)}),Ic=Ve.extend({method:P("notifications/prompts/list_changed"),params:Fe.optional()}),qv=S({title:g().optional(),readOnlyHint:X().optional(),destructiveHint:X().optional(),idempotentHint:X().optional(),openWorldHint:X().optional()}),Fv=S({taskSupport:Ie(["required","optional","forbidden"]).optional()}),kg=S({...Dr.shape,...Rn.shape,description:g().optional(),inputSchema:S({type:P("object"),properties:Q(g(),pe).optional(),required:$(g()).optional()}).catchall(se()),outputSchema:S({type:P("object"),properties:Q(g(),pe).optional(),required:$(g()).optional()}).catchall(se()).optional(),annotations:qv.optional(),execution:Fv.optional(),_meta:Q(g(),se()).optional()}),Cc=An.extend({method:P("tools/list")}),Nc=In.extend({tools:$(kg)}),Zt=_e.extend({content:$(Rc).default([]),structuredContent:Q(g(),se()).optional(),isError:X().optional()}),eI=Zt.or(_e.extend({toolResult:se()})),Vv=Tn.extend({name:g(),arguments:Q(g(),se()).optional()}),Zn=ye.extend({method:P("tools/call"),params:Vv}),jc=Ve.extend({method:P("notifications/tools/list_changed"),params:Fe.optional()}),Pg=S({autoRefresh:X().default(!0),debounceMs:B().int().nonnegative().default(300)}),Mn=Ie(["debug","info","notice","warning","error","critical","alert","emergency"]),Bv=Ue.extend({level:Mn}),Zc=ye.extend({method:P("logging/setLevel"),params:Bv}),Hv=Fe.extend({level:Mn,logger:g().optional(),data:se()}),Kv=Ve.extend({method:P("notifications/message"),params:Hv}),Jv=S({name:g().optional()}),Wv=S({hints:$(Jv).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),Gv=S({mode:Ie(["auto","required","none"]).optional()}),Xv=S({type:P("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:$(Rc).default([]),structuredContent:S({}).loose().optional(),isError:X().optional(),_meta:Q(g(),se()).optional()}),Yv=pc("type",[Ec,Tc,Oc]),Rs=pc("type",[Ec,Tc,Oc,Mv,Xv]),Qv=S({role:jn,content:te([Rs,$(Rs)]),_meta:Q(g(),se()).optional()}),e$=Tn.extend({messages:$(Qv),modelPreferences:Wv.optional(),systemPrompt:g().optional(),includeContext:Ie(["none","thisServer","allServers"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:$(g()).optional(),metadata:pe.optional(),tools:$(kg).optional(),toolChoice:Gv.optional()}),Mc=ye.extend({method:P("sampling/createMessage"),params:e$}),rr=_e.extend({model:g(),stopReason:ie(Ie(["endTurn","stopSequence","maxTokens"]).or(g())),role:jn,content:Yv}),Dn=_e.extend({model:g(),stopReason:ie(Ie(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:jn,content:te([Rs,$(Rs)])}),t$=S({type:P("boolean"),title:g().optional(),description:g().optional(),default:X().optional()}),r$=S({type:P("string"),title:g().optional(),description:g().optional(),minLength:B().optional(),maxLength:B().optional(),format:Ie(["email","uri","date","date-time"]).optional(),default:g().optional()}),n$=S({type:Ie(["number","integer"]),title:g().optional(),description:g().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),o$=S({type:P("string"),title:g().optional(),description:g().optional(),enum:$(g()),default:g().optional()}),s$=S({type:P("string"),title:g().optional(),description:g().optional(),oneOf:$(S({const:g(),title:g()})),default:g().optional()}),i$=S({type:P("string"),title:g().optional(),description:g().optional(),enum:$(g()),enumNames:$(g()).optional(),default:g().optional()}),a$=te([o$,s$]),c$=S({type:P("array"),title:g().optional(),description:g().optional(),minItems:B().optional(),maxItems:B().optional(),items:S({type:P("string"),enum:$(g())}),default:$(g()).optional()}),u$=S({type:P("array"),title:g().optional(),description:g().optional(),minItems:B().optional(),maxItems:B().optional(),items:S({anyOf:$(S({const:g(),title:g()}))}),default:$(g()).optional()}),l$=te([c$,u$]),d$=te([i$,a$,l$]),f$=te([d$,t$,r$,n$]),p$=Tn.extend({mode:P("form").optional(),message:g(),requestedSchema:S({type:P("object"),properties:Q(g(),f$),required:$(g()).optional()})}),h$=Tn.extend({mode:P("url"),message:g(),elicitationId:g(),url:g().url()}),m$=te([p$,h$]),Dc=ye.extend({method:P("elicitation/create"),params:m$}),g$=Fe.extend({elicitationId:g()}),y$=Ve.extend({method:P("notifications/elicitation/complete"),params:g$}),Mt=_e.extend({action:Ie(["accept","decline","cancel"]),content:hc(e=>e===null?void 0:e,Q(g(),te([g(),B(),X(),$(g())])).optional())}),_$=S({type:P("ref/resource"),uri:g()});var b$=S({type:P("ref/prompt"),name:g()}),w$=Ue.extend({ref:te([b$,_$]),argument:S({name:g(),value:g()}),context:S({arguments:Q(g(),g()).optional()}).optional()}),x$=ye.extend({method:P("completion/complete"),params:w$});var Lc=_e.extend({completion:fe({values:$(g()).max(100),total:ie(B().int()),hasMore:ie(X())})}),v$=S({uri:g().startsWith("file://"),name:g().optional(),_meta:Q(g(),se()).optional()}),$$=ye.extend({method:P("roots/list"),params:Ue.optional()}),Uc=_e.extend({roots:$(v$)}),S$=Ve.extend({method:P("notifications/roots/list_changed"),params:Fe.optional()}),tI=te([Zs,bc,x$,Zc,Zv,Nv,$v,Sv,kv,Ev,Ov,Zn,Cc,Ds,Us,qs,Vs]),rI=te([Ns,Ms,js,S$,Nn]),nI=te([bt,rr,Dn,Mt,Uc,Ls,Fs,wt]),oI=te([Zs,Mc,Dc,$$,Ds,Us,qs,Vs]),sI=te([Ns,Ms,Kv,Av,kc,jc,Ic,Nn,y$]),iI=te([bt,wc,Lc,Ac,Pc,vc,$c,zc,Zt,Nc,Ls,Fs,wt]),E=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===I.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new mc(o.elicitations,r)}return new e(t,r,n)}},mc=class extends E{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(I.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Dt(e){return e==="completed"||e==="failed"||e==="cancelled"}var DI=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function qc(e){let r=Zr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Mr(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Fc(e,t){let r=Ee(e,t);if(!r.success)throw r.error;return r.data}var O$=6e4,qr=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(Ns,r=>{this._oncancel(r)}),this.setNotificationHandler(Ms,r=>{this._onprogress(r)}),this.setRequestHandler(Zs,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ds,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new E(I.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Us,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.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,p=new E(d.error.code,d.error.message,d.error.data);l(p)}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:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new E(I.InvalidParams,`Task not found: ${s}`);if(!Dt(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(Dt(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[jt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(qs,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new E(I.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Vs,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new E(I.InvalidParams,`Task not found: ${r.params.taskId}`);if(Dt(o.status))throw new E(I.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new E(I.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof E?o:new E(I.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),E.fromError(I.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),tr(s)||_g(s)?this._onresponse(s):On(s)?this._onrequest(s,i):yg(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 n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=E.fromError(I.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=t.params?._meta?.[jt]?.taskId;if(n===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()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.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=hg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.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,p)=>{if(i.signal.aborted)throw new E(I.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let h=f.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},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(()=>n(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()},o?.sessionId):await o?.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()},o?.sessionId):await o?.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,...n}=t.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),tr(t))n(t);else{let i=new E(t.error.code,t.error.message,t.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===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(tr(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),tr(t))o(t);else{let i=E.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(i){yield{type:"error",error:i instanceof E?i:new E(I.InternalError,String(i))}}return}let s;try{let i=await this.request(t,wt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new E(I.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},Dt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new E(I.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new E(I.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof E?i:new E(I.InternalError,String(i))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=v=>{l(v)};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(v){d(v);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[jt]:c}});let h=v=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(v)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let z=v instanceof E?v:new E(I.RequestTimeout,String(v));l(z)};this._responseHandlers.set(p,v=>{if(!n?.signal?.aborted){if(v instanceof Error)return l(v);try{let z=Ee(r,v.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let m=n?.timeout??O$,y=()=>h(E.fromError(I.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let w=c?.taskId;if(w){let v=z=>{let A=this._responseHandlers.get(p);A?A(z):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(w,{type:"request",message:f,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(p),l(z)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(v=>{this._cleanupTimeout(p),l(v)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ls,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Fs,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},xg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[jt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{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||{},[jt]: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||{},[jt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let n=qc(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=Fc(t,o);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 n=qc(t);this._notificationHandlers.set(n,o=>{let s=Fc(t,o);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,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&On(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new E(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 n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,s)=>{if(r.aborted){s(new E(I.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new E(I.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new E(I.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=Nn.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Dt(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new E(I.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Dt(a.status))throw new E(I.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=Nn.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Dt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Eg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Bs(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];Eg(i)&&Eg(s)?r[o]={...i,...s}:r[o]=s}return r}var P0=sa(Nl(),1),E0=sa(k0(),1);function UE(){let e=new P0.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,E0.default)(e),e}var an=class{constructor(t){this._ajv=t??UE()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Ei=class{constructor(t){this._client=t}async*callToolStream(t,r=Zt,n){let o=this._client,s={...n,task:n?.task??(o.isToolTask(t.name)?{}:void 0)},i=o.requestStream({method:"tools/call",params:t},r,s),a=o.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 E(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 E(I.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof E){yield{type:"error",error:l};return}yield{type:"error",error:new E(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,n){return this._client.getTaskResult({taskId:t},r,n)}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,n){return this._client.requestStream(t,r,n)}};function Ti(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 Oi(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 Ri(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[o]=s.default),r[o]!==void 0&&Ri(s,r[o])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&Ri(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&Ri(r,t)}}function qE(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 Ai=class extends qr{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 an,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",jc,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Ic,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",kc,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Ei(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Bs(this._capabilities,t)}setRequestHandler(t,r){let o=Zr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Mr(o);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=Ee(Dc,c);if(!l.success){let v=l.error instanceof Error?l.error.message:String(l.error);throw new E(I.InvalidParams,`Invalid elicitation request: ${v}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=qE(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new E(I.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new E(I.InvalidParams,"Client does not support URL-mode elicitation requests");let h=await Promise.resolve(r(c,u));if(d.task){let v=Ee(wt,h);if(!v.success){let z=v.error instanceof Error?v.error.message:String(v.error);throw new E(I.InvalidParams,`Invalid task creation result: ${z}`)}return v.data}let m=Ee(Mt,h);if(!m.success){let v=m.error instanceof Error?m.error.message:String(m.error);throw new E(I.InvalidParams,`Invalid elicitation result: ${v}`)}let y=m.data,w=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&w&&this._capabilities.elicitation?.form?.applyDefaults)try{Ri(w,y.content)}catch{}return y};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,u)=>{let l=Ee(Mc,c);if(!l.success){let y=l.error instanceof Error?l.error.message:String(l.error);throw new E(I.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let y=Ee(wt,p);if(!y.success){let w=y.error instanceof Error?y.error.message:String(y.error);throw new E(I.InvalidParams,`Invalid task creation result: ${w}`)}return y.data}let h=d.tools||d.toolChoice?Dn:rr,m=Ee(h,p);if(!m.success){let y=m.error instanceof Error?m.error.message:String(m.error);throw new E(I.InvalidParams,`Invalid sampling result: ${y}`)}return m.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 n=await this.request({method:"initialize",params:{protocolVersion:Nt,capabilities:this._capabilities,clientInfo:this._clientInfo}},wc,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!As.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}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){Ti(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&Oi(this._capabilities.tasks?.requests,t,"Client")}async ping(t){return this.request({method:"ping"},bt,t)}async complete(t,r){return this.request({method:"completion/complete",params:t},Lc,r)}async setLoggingLevel(t,r){return this.request({method:"logging/setLevel",params:{level:t}},bt,r)}async getPrompt(t,r){return this.request({method:"prompts/get",params:t},Ac,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Pc,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},vc,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},$c,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},zc,r)}async subscribeResource(t,r){return this.request({method:"resources/subscribe",params:t},bt,r)}async unsubscribeResource(t,r){return this.request({method:"resources/unsubscribe",params:t},bt,r)}async callTool(t,r=Zt,n){if(this.isToolTaskRequired(t.name))throw new E(I.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:t},r,n),s=this.getToolOutputValidator(t.name);if(s){if(!o.structuredContent&&!o.isError)throw new E(I.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let i=s(o.structuredContent);if(!i.valid)throw new E(I.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof E?i:new E(I.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}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 o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let n=await this.request({method:"tools/list",params:t},Nc,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,o){let s=Pg.safeParse(n);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=n,u=async()=>{if(!i){c(null,null);return}try{let d=await o();c(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));c(p,null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let p=setTimeout(u,a);this._listChangedDebounceTimers.set(t,p)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var I0=sa(A0(),1);function C0(e){if(e)try{return I0.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function Ii(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function N0(e=fetch,t){return t?async(r,n)=>{let o={...t,...n,headers:n?.headers?{...Ii(t.headers),...Ii(n.headers)}:t.headers};return e(r,o)}:e}var Vl;Vl=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function XE(e){return(await Vl).getRandomValues(new Uint8Array(e))}async function YE(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,n="";for(;n.length<e;){let o=await XE(e-n.length);for(let s of o)s<r&&(n+=t[s%t.length])}return n}async function QE(e){return await YE(e)}async function eT(e){let t=await(await Vl).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Bl(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await QE(e),r=await eT(t);return{code_verifier:t,code_challenge:r}}var ve=Gm().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:dg.custom,message:"URL must be parseable",fatal:!0}),wa}).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"}),Z0=fe({resource:g().url(),authorization_servers:$(ve).optional(),jwks_uri:g().url().optional(),scopes_supported:$(g()).optional(),bearer_methods_supported:$(g()).optional(),resource_signing_alg_values_supported:$(g()).optional(),resource_name:g().optional(),resource_documentation:g().optional(),resource_policy_uri:g().url().optional(),resource_tos_uri:g().url().optional(),tls_client_certificate_bound_access_tokens:X().optional(),authorization_details_types_supported:$(g()).optional(),dpop_signing_alg_values_supported:$(g()).optional(),dpop_bound_access_tokens_required:X().optional()}),Hl=fe({issuer:g(),authorization_endpoint:ve,token_endpoint:ve,registration_endpoint:ve.optional(),scopes_supported:$(g()).optional(),response_types_supported:$(g()),response_modes_supported:$(g()).optional(),grant_types_supported:$(g()).optional(),token_endpoint_auth_methods_supported:$(g()).optional(),token_endpoint_auth_signing_alg_values_supported:$(g()).optional(),service_documentation:ve.optional(),revocation_endpoint:ve.optional(),revocation_endpoint_auth_methods_supported:$(g()).optional(),revocation_endpoint_auth_signing_alg_values_supported:$(g()).optional(),introspection_endpoint:g().optional(),introspection_endpoint_auth_methods_supported:$(g()).optional(),introspection_endpoint_auth_signing_alg_values_supported:$(g()).optional(),code_challenge_methods_supported:$(g()).optional(),client_id_metadata_document_supported:X().optional()}),tT=fe({issuer:g(),authorization_endpoint:ve,token_endpoint:ve,userinfo_endpoint:ve.optional(),jwks_uri:ve,registration_endpoint:ve.optional(),scopes_supported:$(g()).optional(),response_types_supported:$(g()),response_modes_supported:$(g()).optional(),grant_types_supported:$(g()).optional(),acr_values_supported:$(g()).optional(),subject_types_supported:$(g()),id_token_signing_alg_values_supported:$(g()),id_token_encryption_alg_values_supported:$(g()).optional(),id_token_encryption_enc_values_supported:$(g()).optional(),userinfo_signing_alg_values_supported:$(g()).optional(),userinfo_encryption_alg_values_supported:$(g()).optional(),userinfo_encryption_enc_values_supported:$(g()).optional(),request_object_signing_alg_values_supported:$(g()).optional(),request_object_encryption_alg_values_supported:$(g()).optional(),request_object_encryption_enc_values_supported:$(g()).optional(),token_endpoint_auth_methods_supported:$(g()).optional(),token_endpoint_auth_signing_alg_values_supported:$(g()).optional(),display_values_supported:$(g()).optional(),claim_types_supported:$(g()).optional(),claims_supported:$(g()).optional(),service_documentation:g().optional(),claims_locales_supported:$(g()).optional(),ui_locales_supported:$(g()).optional(),claims_parameter_supported:X().optional(),request_parameter_supported:X().optional(),request_uri_parameter_supported:X().optional(),require_request_uri_registration:X().optional(),op_policy_uri:ve.optional(),op_tos_uri:ve.optional(),client_id_metadata_document_supported:X().optional()}),M0=S({...tT.shape,...Hl.pick({code_challenge_methods_supported:!0}).shape}),D0=S({access_token:g(),id_token:g().optional(),token_type:g(),expires_in:Os.number().optional(),scope:g().optional(),refresh_token:g().optional(),issuer:g().optional().catch(void 0)}).strip(),L0=S({error:g(),error_description:g().optional(),error_uri:g().optional()}),j0=ve.optional().or(P("").transform(()=>{})),rT=S({redirect_uris:$(ve),token_endpoint_auth_method:g().optional(),grant_types:$(g()).optional(),response_types:$(g()).optional(),client_name:g().optional(),client_uri:ve.optional(),logo_uri:j0,scope:g().optional(),contacts:$(g()).optional(),tos_uri:j0,policy_uri:g().optional(),jwks_uri:ve.optional(),jwks:Qm().optional(),software_id:g().optional(),software_version:g().optional(),software_statement:g().optional()}).strip(),nT=S({client_id:g(),client_secret:g().optional(),client_id_issued_at:B().optional(),client_secret_expires_at:B().optional(),issuer:g().optional().catch(void 0)}).strip(),U0=rT.merge(nT),hj=S({error:g(),error_description:g().optional()}).strip(),mj=S({token:g(),token_type_hint:g().optional()}).strip();function q0(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function F0({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),n=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var de=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}},_o=class extends de{};_o.errorCode="invalid_request";var mr=class extends de{};mr.errorCode="invalid_client";var gr=class extends de{};gr.errorCode="invalid_grant";var yr=class extends de{};yr.errorCode="unauthorized_client";var bo=class extends de{};bo.errorCode="unsupported_grant_type";var wo=class extends de{};wo.errorCode="invalid_scope";var xo=class extends de{};xo.errorCode="access_denied";var kt=class extends de{};kt.errorCode="server_error";var vo=class extends de{};vo.errorCode="temporarily_unavailable";var $o=class extends de{};$o.errorCode="unsupported_response_type";var So=class extends de{};So.errorCode="unsupported_token_type";var zo=class extends de{};zo.errorCode="invalid_token";var ko=class extends de{};ko.errorCode="method_not_allowed";var Po=class extends de{};Po.errorCode="too_many_requests";var _r=class extends de{};_r.errorCode="invalid_client_metadata";var Eo=class extends de{};Eo.errorCode="insufficient_scope";var To=class extends de{};To.errorCode="invalid_target";var V0={[_o.errorCode]:_o,[mr.errorCode]:mr,[gr.errorCode]:gr,[yr.errorCode]:yr,[bo.errorCode]:bo,[wo.errorCode]:wo,[xo.errorCode]:xo,[kt.errorCode]:kt,[vo.errorCode]:vo,[$o.errorCode]:$o,[So.errorCode]:So,[zo.errorCode]:zo,[ko.errorCode]:ko,[Po.errorCode]:Po,[_r.errorCode]:_r,[Eo.errorCode]:Eo,[To.errorCode]:To};var Pt=class extends Error{constructor(t){super(t??"Unauthorized")}};function oT(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Kl="code",Jl="S256";function sT(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&oT(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 iT(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":aT(o,s,r);return;case"client_secret_post":cT(o,s,n);return;case"none":uT(o,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function aT(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function cT(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function uT(e,t){t.set("client_id",e)}async function H0(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=L0.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n,a=V0[o]||kt;return new a(s||"",i)}catch(n){let o=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new kt(o)}}function lT(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith("/")&&r.slice(0,-1)===n||n.endsWith("/")&&n.slice(0,-1)===r}function Xl(e,t){if(e)return typeof e.issuer!="string"?e.issuer==null?e:{...e,issuer:void 0}:lT(e.issuer,t)?e:void 0}var dT=D0.omit({issuer:!0}),fT=U0.omit({issuer:!0});function K0(e,t){return new Error(`OAuth client information is bound to authorization server ${e.issuer} and is not presented to ${t}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`)}async function Oo(e,t){try{return await Wl(e,t)}catch(r){if(r instanceof mr||r instanceof yr)return await e.invalidateCredentials?.("all"),await Wl(e,t);if(r instanceof gr)return await e.invalidateCredentials?.("tokens"),await Wl(e,t);throw r}}async function Wl(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,c,u,l=o;if(!l&&i?.resourceMetadataUrl&&(l=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await W0(c,{fetchFn:s}),!a)try{a=await J0(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 bT(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=String(c),p=await hT(t,e,a),f=p&&a&&!e.validateResourceURL?a.resource:p,h=n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation()),y=Xl(m,d),w=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(m&&!y&&!w)throw K0(m,d);let v=y?.issuer==null?y:void 0,z=async()=>{try{v&&await e.saveClientInformation?.({...v,issuer:d})}catch{}};if(!y){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,oe=e.clientMetadataUrl;if(oe&&!pT(oe))throw new _r(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${oe}`);if(Z&&oe)y={client_id:oe,issuer:d},await e.saveClientInformation?.(y);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");y={...await ST(c,{metadata:u,clientMetadata:e.clientMetadata,scope:h,fetchFn:s}),issuer:d},await e.saveClientInformation(y)}}let A=!e.redirectUrl;if(r!==void 0||A){let Z=await $T(e,c,{metadata:u,resource:f,authorizationCode:r,fetchFn:s});return await z(),await e.saveTokens({...Z,issuer:d}),"AUTHORIZED"}let b=Xl(await e.tokens(),d);if(b?.refresh_token&&b.issuer==null&&console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged."),b?.refresh_token)try{let Z=await vT(c,{metadata:u,clientInformation:y,refreshToken:b.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await z(),await e.saveTokens({...Z,issuer:d}),"AUTHORIZED"}catch(Z){if(!(!(Z instanceof de)||Z instanceof kt))throw Z}let x=e.state?await e.state():void 0,{authorizationUrl:T,codeVerifier:K}=await wT(c,{metadata:u,clientInformation:y,state:x,redirectUrl:e.redirectUrl,scope:h,resource:f});return await e.saveCodeVerifier(K),await e.redirectToAuthorization(T),"REDIRECT"}function pT(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function hT(e,t,r){let n=q0(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(r){if(!F0({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Yl(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=Gl(e,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=Gl(e,"scope")||void 0,a=Gl(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function Gl(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function J0(e,t,r=fetch){let n=await yT(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Z0.parse(await n.json())}async function Ql(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?Ql(e,void 0,r):void 0;throw n}}function mT(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function B0(e,t,r=fetch){return await Ql(e,{"MCP-Protocol-Version":t},r)}function gT(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function yT(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??Nt,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let c=mT(t,o.pathname);i=new URL(c,n?.metadataServerUrl??o),i.search=o.search}let a=await B0(i,s,r);if(!n?.metadataUrl&&gT(a,o.pathname)){let c=new URL(`/.well-known/${t}`,o);a=await B0(c,s,r)}return a}function _T(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function W0(e,{fetchFn:t=fetch,protocolVersion:r=Nt}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=_T(e);for(let{url:s,type:i}of o){let a=await Ql(s,n,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"?Hl.parse(await a.json()):M0.parse(await a.json())}}}async function bT(e,t){let r,n;try{r=await J0(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",e)));let o=await W0(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function G0(e){return typeof e=="string"?e:e.href}async function wT(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Kl))throw new Error(`Incompatible auth server: does not support response type ${Kl}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Jl))throw new Error(`Incompatible auth server: does not support code challenge method ${Jl}`)}else a=new URL("/authorize",e);let c=await Bl(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",Kl),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",Jl),a.searchParams.set("redirect_uri",String(n)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",G0(i)),{authorizationUrl:a,codeVerifier:u}}function xT(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function X0(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,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",G0(s)),o)await o(c,r,a,t);else if(n){let l=t?.token_endpoint_auth_methods_supported??[],d=sT(n,l);iT(d,n,c,r)}let u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await H0(u);return dT.parse(await u.json())}async function vT(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await X0(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...c}}async function $T(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let l=await e.clientInformation(),d=Xl(l,String(t));if(l&&!d)throw K0(l,String(t));return d},a=await i(),c=e.clientMetadata.scope,u;if(e.prepareTokenRequest&&(u=await e.prepareTokenRequest(c)),!u){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();u=xT(o,l,e.redirectUrl)}return a??(a=await i()),X0(t,{metadata:r,tokenRequestParams:u,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function ST(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){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(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await H0(i);return fT.parse(await i.json())}var Ro=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}},Y0=10,zT=13,br=32;function ed(e){}function tb(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=ed,onError:r=ed,onRetry:n=ed,onComment:o,maxBufferSize:s}=e,i=[],a=0,c=!0,u,l="",d=0,p,f=!1;function h(b){if(f)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,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),i.length===0){let K=y(b);K!==""&&(i.push(K),a=K.length),m();return}if(b.indexOf(`
|
|
67
|
-
`)===-1&&
|
|
68
|
-
`,x);for(
|
|
69
|
-
`,x);continue}let
|
|
70
|
-
`,x);continue}l=d===0?
|
|
71
|
-
${
|
|
72
|
-
`,x)}return
|
|
73
|
-
`,x),
|
|
74
|
-
${
|
|
75
|
-
${x}`,d++;break;case"id":x.includes("\0")||(u=x);break;case"retry":/^\d+$/.test(x)?n(parseInt(x,10)):r(new Ro(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:T}));break;default:r(new Ro(`Unknown field "${b.length>20?`${b.slice(0,20)}\u2026`:b}"`,{type:"unknown-field",field:b,value:x,line:T}));break}}function z(){d>0&&t({id:u,event:p,data:l}),u=void 0,l="",d=0,p=void 0}function A(b={}){if(b.consume&&i.length>0){let x=i.join("");w(x,0,x.length)}c=!0,u=void 0,l="",d=0,p=void 0,i.length=0,a=0,f=!1}return{feed:h,reset:A}}function Q0(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 eb(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 Ci=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:n,maxBufferSize:o}={}){let s;super({start(i){s=tb({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:n,maxBufferSize:o})},transform(i){s.feed(i)}})}};var kT={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Jt=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},Ni=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=N0(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??kT}async _authThenStart(){if(!this._authProvider)throw new Pt("No auth provider");let t;try{t=await Oo(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 Pt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(t.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=Ii(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new Jt(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,t,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,t),o)}_scheduleReconnection(t,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=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)})},o)}_handleSseStream(t,r,n){if(!t)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=t.pipeThrough(new TextDecoderStream).pipeThrough(new Ci({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:h}=await l.read();if(h)break;if(f.id&&(i=f.id,a=!0,o?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let m=Lr.parse(JSON.parse(f.data));tr(m)&&(c=!0,s!==void 0&&(m.id=s)),this.onmessage?.(m)}catch(m){this.onerror?.(m)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}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 Pt("No auth provider");if(await Oo(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Pt("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:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:On(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 Jt(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:h,scope:m}=Yl(a);if(this._resourceMetadataUrl=h,this._scope=m,await Oo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Pt;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:h,scope:m,error:y}=Yl(a);if(y==="insufficient_scope"){let w=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===w)throw new Jt(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),h&&(this._resourceMetadataUrl=h),this._lastUpscopingHeader=w??void 0,await Oo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Pt;return this.send(t)}}throw new Jt(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),wg(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"),p=C0(d);if(l)if(p==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:o},!1);else if(p==="application/json"){let f=await a.json(),h=Array.isArray(f)?f.map(m=>Lr.parse(m)):[Lr.parse(f)];for(let m of h)this.onmessage?.(m)}else throw await a.body?.cancel(),new Jt(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}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},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Jt(n.status,`Failed to terminate session: ${n.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 ji=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],s=Array.isArray(o.content)?o.content:[o.content],i=s.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},rr,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Mt,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};var Zi=class extends qr{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Mn.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new an,this.setRequestHandler(bc,n=>this._oninitialize(n)),this.setNotificationHandler(js,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Zc,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=Mn.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ji(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Bs(this._capabilities,t)}setRequestHandler(t,r){let o=Zr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Mr(o);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=Ee(Zn,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new E(I.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=Ee(wt,p);if(!h.success){let m=h.error instanceof Error?h.error.message:String(h.error);throw new E(I.InvalidParams,`Invalid task creation result: ${m}`)}return h.data}let f=Ee(Zt,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new E(I.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){Oi(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Ti(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:As.includes(r)?r:Nt,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},bt)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},Dn,r):this.request({method:"sampling/createMessage",params:t},rr,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Mt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:o},Mt,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new E(I.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof E?i:new E(I.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},Uc,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import nb from"node:process";var PT=10*1024*1024,Mi=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??PT}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
76
|
-
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),
|
|
77
|
-
`}var Di=class{constructor(t=nb.stdin,r=nb.stdout,n){this._stdin=t,this._stdout=r,this._started=!1,this._ondata=o=>{try{this._readBuffer.append(o),this.processReadBuffer()}catch(s){this.onerror?.(s),this.close().catch(()=>{})}},this._onerror=o=>{this.onerror?.(o)},this._readBuffer=new Mi({maxBufferSize:n?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=rb(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};function td(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var Li=e=>e?`"${e}" `:"";function TT(e,t=""){if(typeof e!="boolean")throw new TypeError(Li(t)+"expected boolean, got type="+typeof e);return e}function Ui(e,t=""){if(typeof e!="number")throw new TypeError(Li(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Li(t)+"expected integer >= 0, got "+e);return e}function he(e,t,r=""){if(td(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Ui(t,"length");let n=td(e),o=t!==void 0?` of length ${t}`:"",s=n?`length=${e.length}`:`type=${typeof e}`,i=Li(r)+"expected Uint8Array"+o+", got "+s;throw n?new RangeError(i):new TypeError(i)}function qi(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function OT(e,t){he(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function rd(e,t){if(OT(e,t),!ln(e))throw new Error("invalid output, must be aligned")}function ob(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Et(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function lt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function cn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var un=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function nd(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}var ce=un?e=>e:e=>nd(e)>>>0;function RT(e){for(let t=0;t<e.length;t++)e[t]=nd(e[t]);return e}var Ao=un?e=>e:RT;function sb(e,t){if(e=he(e),t=he(t),e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return r===0}function od(e,t,r){let n=t,o=r||(()=>[]),s=(a,c)=>n(c,...o(a)).update(a).digest(),i=n(new Uint8Array(e),...o(new Uint8Array(0)));return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.create=(a,...c)=>n(a,...c),s}var ib=(e,t)=>{function r(n,...o){if(he(n,void 0,"key"),e.nonceLength!==void 0){let d=o[0];he(d,e.varSizeNonce?void 0:e.nonceLength,"nonce")}let s=e.tagLength,i=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let d=i;d<o.length;d++)if(td(o[d]))throw new Error("AAD not supported")}e.withAAD&&o[i]!==void 0&&he(o[i],void 0,"AAD");let a=t(n,...o),c=(d,p)=>{if(p!==void 0){if(d!==2)throw new Error("cipher output not supported");he(p,void 0,"output")}},u=!1;return{encrypt(d,p){if(u)throw new Error("cannot encrypt() twice with same key + nonce");return u=!0,he(d,void 0,"data"),c(a.encrypt.length,p),a.encrypt(d,p)},decrypt(d,p){if(he(d,void 0,"data"),s&&d.length<s)throw new Error('"ciphertext" expected length >= tagLength='+s);return c(a.decrypt.length,p),a.decrypt(d,p)}}}return Object.assign(r,e),r};function ab(e,t,r=!0){if(t===void 0)return new Uint8Array(e);if(he(t,e,"output"),r&&!ln(t))throw new Error("invalid output, must be aligned");return t}function cb(e,t,r){Ui(e),Ui(t),TT(r);let n=new Uint8Array(16),o=cn(n);return o.setBigUint64(0,BigInt(t),r),o.setBigUint64(8,BigInt(e),r),n}function ln(e){return e.byteOffset%4===0}function wr(e){return Uint8Array.from(he(e))}var xr=16,ub=new Uint8Array(16),Io=Et(ub),AT=225,IT=(e,t,r,n)=>{let o=n&1;return{s3:r<<31|n>>>1,s2:t<<31|r>>>1,s1:e<<31|t>>>1,s0:e>>>1^AT<<24&-(o&1)}},Fi=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;var CT=e=>e>64*1024?8:e>1024?4:2,sd=class{blockLen=xr;outputLen=xr;s0=0;s1=0;s2=0;s3=0;finished=!1;destroyed=!1;t;W;windowSize;constructor(t,r){he(t,16,"key"),t=wr(t);let n=cn(t),o=n.getUint32(0,!1),s=n.getUint32(4,!1),i=n.getUint32(8,!1),a=n.getUint32(12,!1),c=[];for(let h=0;h<128;h++)c.push({s0:Fi(o),s1:Fi(s),s2:Fi(i),s3:Fi(a)}),{s0:o,s1:s,s2:i,s3:a}=IT(o,s,i,a);let u=CT(r||1024);if(![1,2,4,8].includes(u))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=u;let d=128/u,p=this.windowSize=2**u,f=[];for(let h=0;h<d;h++)for(let m=0;m<p;m++){let y=0,w=0,v=0,z=0;for(let A=0;A<u;A++){if(!(m>>>u-A-1&1))continue;let{s0:x,s1:T,s2:K,s3:Z}=c[u*h+A];y^=x,w^=T,v^=K,z^=Z}f.push({s0:y,s1:w,s2:v,s3:z})}this.t=f}_updateBlock(t,r,n,o){t^=this.s0,r^=this.s1,n^=this.s2,o^=this.s3;let{W:s,t:i,windowSize:a}=this,c=0,u=0,l=0,d=0,p=(1<<s)-1,f=0;for(let h of[t,r,n,o])for(let m=0;m<4;m++){let y=h>>>8*m&255;for(let w=8/s-1;w>=0;w--){let v=y>>>s*w&p,{s0:z,s1:A,s2:b,s3:x}=i[f*a+v];c^=z,u^=A,l^=b,d^=x,f+=1}}this.s0=c,this.s1=u,this.s2=l,this.s3=d}update(t){qi(this),he(t),t=wr(t);let r=Et(t),n=Math.floor(t.length/xr),o=t.length%xr;for(let s=0;s<n;s++)this._updateBlock(ce(r[s*4+0]),ce(r[s*4+1]),ce(r[s*4+2]),ce(r[s*4+3]));return o&&(ub.set(t.subarray(n*xr)),this._updateBlock(ce(Io[0]),ce(Io[1]),ce(Io[2]),ce(Io[3])),lt(Io)),this}destroy(){this.destroyed=!0;let{t}=this;for(let r of t)r.s0=0,r.s1=0,r.s2=0,r.s3=0}digestInto(t){qi(this),rd(t,this),this.finished=!0;let{s0:r,s1:n,s2:o,s3:s}=this,i=Et(t);i[0]=r,i[1]=n,i[2]=o,i[3]=s,un||Ao(i.subarray(0,xr/4))}digest(){let t=new Uint8Array(xr);return this.digestInto(t),this.destroy(),t}};var id=od(16,(e,t)=>new sd(e,t),e=>[e.length]);var cd=16,NT=4,Vi=new Uint8Array(cd);var jT=283;function ZT(e){if(![16,24,32].includes(e.length))throw new Error('"aes key" expected Uint8Array of length 16/24/32, got length='+e.length)}function ud(e){return e<<1^jT&-(e>>7)}function lb(e,t){let r=0;for(;t>0;t>>=1)r^=e&-(t&1),e=ud(e);return r}var MT=(()=>{let e=new Uint8Array(256);for(let r=0,n=1;r<256;r++,n^=ud(n))e[r]=n;let t=new Uint8Array(256);t[0]=99;for(let r=0;r<255;r++){let n=e[255-r];n|=n<<8,t[e[r]]=(n^n>>4^n>>5^n>>6^n>>7^99)&255}return lt(e),t})();var DT=e=>e<<24|e>>>8,ad=e=>e<<8|e>>>24;function LT(e,t){if(e.length!==256)throw new Error("wrong sbox length");let r=new Uint32Array(256).map((u,l)=>t(e[l])),n=r.map(ad),o=n.map(ad),s=o.map(ad),i=new Uint32Array(256*256),a=new Uint32Array(256*256),c=new Uint16Array(256*256);for(let u=0;u<256;u++)for(let l=0;l<256;l++){let d=u*256+l;i[d]=r[u]^n[l],a[d]=o[u]^s[l],c[d]=e[u]<<8|e[l]}return{sbox:e,sbox2:c,T0:r,T1:n,T2:o,T3:s,T01:i,T23:a}}var fb=LT(MT,e=>lb(e,3)<<24|e<<16|e<<8|lb(e,2));var UT=(()=>{let e=new Uint8Array(16);for(let t=0,r=1;t<16;t++,r=ud(r))e[t]=r;return e})();function qT(e){he(e);let t=e.length;ZT(e);let{sbox2:r}=fb,n=[];(!un||!ln(e))&&n.push(e=wr(e));let o=Ao(Et(e)),s=o.length,i=c=>Co(r,c,c,c,c),a=new Uint32Array(t+28);a.set(o);for(let c=s;c<a.length;c++){let u=a[c-1];c%s===0?u=i(DT(u))^UT[c/s-1]:s>6&&c%s===4&&(u=i(u)),a[c]=a[c-s]^u}return lt(...n),a}function Bi(e,t,r,n,o,s){return e[r<<8&65280|n>>>8&255]^t[o>>>8&65280|s>>>24&255]}function Co(e,t,r,n,o){return e[t&255|r&65280]|e[n>>>16&255|o>>>16&65280]<<16}function db(e,t,r,n,o){let{sbox2:s,T01:i,T23:a}=fb,c=0;t^=e[c++],r^=e[c++],n^=e[c++],o^=e[c++];let u=e.length/4-2;for(let h=0;h<u;h++){let m=e[c++]^Bi(i,a,t,r,n,o),y=e[c++]^Bi(i,a,r,n,o,t),w=e[c++]^Bi(i,a,n,o,t,r),v=e[c++]^Bi(i,a,o,t,r,n);t=m,r=y,n=w,o=v}let l=e[c++]^Co(s,t,r,n,o),d=e[c++]^Co(s,r,n,o,t),p=e[c++]^Co(s,n,o,t,r),f=e[c++]^Co(s,o,t,r,n);return{s0:l,s1:d,s2:p,s3:f}}function Hi(e,t,r,n,o){he(r,cd,"nonce"),he(n),o=ab(n.length,o);let s=r,i=Et(s),a=cn(s),c=Et(n),u=Et(o),l=t?0:12,d=n.length,p=a.getUint32(l,t);for(let h=0;h+4<=c.length;h+=4){let{s0:m,s1:y,s2:w,s3:v}=db(e,ce(i[0]),ce(i[1]),ce(i[2]),ce(i[3]));u[h+0]=c[h+0]^ce(m),u[h+1]=c[h+1]^ce(y),u[h+2]=c[h+2]^ce(w),u[h+3]=c[h+3]^ce(v),p=p+1>>>0,a.setUint32(l,p,t)}let f=cd*Math.floor(c.length/NT);if(f<d){let{s0:h,s1:m,s2:y,s3:w}=db(e,ce(i[0]),ce(i[1]),ce(i[2]),ce(i[3])),v=new Uint32Array([h,m,y,w]);Ao(v);let z=ob(v);for(let A=f,b=0;A<d;A++,b++)o[A]=n[A]^z[b];lt(v)}return o}function FT(e,t,r,n,o){let s=o?o.length:0,i=e.create(r,n.length+s);o&&i.update(o);let a=cb(8*n.length,8*s,t);i.update(n),i.update(a);let c=i.digest();return lt(a),c}var ld=ib({blockSize:16,nonceLength:12,tagLength:16,withAAD:!0,varSizeNonce:!0},function(t,r,n){if(r.length<8)throw new Error("aes/gcm: invalid nonce length");let o=16;function s(a,c,u){let l=FT(id,!1,a,u,n);for(let d=0;d<c.length;d++)l[d]^=c[d];return l}function i(){let a=qT(t),c=Vi.slice(),u=Vi.slice();if(Hi(a,!1,u,u,c),r.length===12)u.set(r);else{let d=Vi.slice();cn(d).setBigUint64(8,BigInt(r.length*8),!1);let f=id.create(c).update(r).update(d);f.digestInto(u),f.destroy()}let l=Hi(a,!1,u,Vi);return{xk:a,authKey:c,counter:u,tagMask:l}}return{encrypt(a){let{xk:c,authKey:u,counter:l,tagMask:d}=i(),p=new Uint8Array(a.length+o),f=[c,u,l,d];ln(a)||f.push(a=wr(a)),Hi(c,!1,l,a,p.subarray(0,a.length));let h=s(u,d,p.subarray(0,p.length-o));return f.push(h),p.set(h,a.length),lt(...f),p},decrypt(a){let{xk:c,authKey:u,counter:l,tagMask:d}=i(),p=[c,u,d,l];ln(a)||p.push(a=wr(a));let f=a.subarray(0,-o),h=a.subarray(-o),m=s(u,d,f);if(p.push(m),!sb(m,h))throw lt(...p),new Error("aes-gcm: invalid tag");let y=Hi(c,!1,l,f);return lt(...p),y}}});function pb(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}var dd=e=>e?`"${e}" `:"";function No(e,t=""){if(typeof e!="number")throw new TypeError(dd(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(dd(t)+"expected integer >= 0, got "+e);return e}function Wt(e,t,r=""){if(pb(e)&&(t===void 0||e.length===t))return e;t!==void 0&&No(t,"length");let n=pb(e),o=t!==void 0?` of length ${t}`:"",s=n?`length=${e.length}`:`type=${typeof e}`,i=dd(r)+"expected Uint8Array"+o+", got "+s;throw n?new RangeError(i):new TypeError(i)}function jo(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("expected hash wrapped by utils.createHasher");if(No(e.outputLen),No(e.blockLen),e.outputLen<1||e.blockLen<1)throw new Error("hash blockLen / outputLen must be >= 1")}var VT=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError((t==="object"?"":`"${t}" `)+"expected object, got type="+typeof e)},hb=(e,t)=>{VT(e,t);let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)throw new TypeError(`"${t}" expected plain object`);if(Object.hasOwn(e,"__proto__"))throw new TypeError(`"${t}.__proto__" is not allowed`)};function dn(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Ki(e,t){Wt(e,void 0,"output");let r=t.outputLen;if(!(e.length>=r))throw new RangeError('"output" expected length >= '+r)}function dt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ji(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ot(e,t){return e<<32-t|e>>>t}function BT(e,t,r="opts"){return hb(e,"defaults"),t!==void 0&&hb(t,r),Object.assign(Object.create(null),e,t)}function mb(e,t={}){if(typeof e!="function")throw new TypeError('"hashCons" expected function, got type='+typeof e);t=BT({},t,"info");let r=(o,s)=>e(s).update(o).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=o=>e(o),Object.assign(r,t),Object.freeze(r)}var gb=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});var Wi=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(t,r){if(jo(t),Wt(r,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("expected Hash instance");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,o=new Uint8Array(n);o.set(r.length>n?t.create().update(r).digest():r);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=t.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),dt(o)}update(t){return dn(this),this.iHash.update(t),this}digestInto(t){dn(this),Ki(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});let{oHash:r,iHash:n,finished:o,destroyed:s,blockLen:i,outputLen:a,canXOF:c}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=i,t.outputLen=a,t.canXOF=c,t.oHash=r._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Zo=(()=>{let e=((t,r,n)=>new Wi(t,r).update(n).digest());return e.create=(t,r)=>new Wi(t,r),e})();var Mo=Uint8Array.of(0),HT=Uint8Array.of();function KT(e,t,r,n=32,o){jo(e),No(n,"length"),Wt(t,void 0,"prk");let s=e.outputLen;if(t.length<s)throw new Error('"prk" must be at least HashLen octets');if(n>255*s)throw new Error("Length must be <= 255*HashLen");let i=Math.ceil(n/s);if(r===void 0?r=HT:Wt(r,void 0,"info"),!i)return o&&dt(t),new Uint8Array;let a=o&&i===1?t:new Uint8Array(i*s),{iHash:c,oHash:u}=Zo.create(e,t),l=o?t:new Uint8Array(s),d=i>1?o?.iHash||e.create():void 0;for(let f=0;f<i-1;f++){Mo[0]=f+1;let h=c._cloneInto(d);f&&h.update(l),h.update(r).update(Mo).digestInto(l),u._cloneInto(d).update(l).digestInto(l),a.set(l,s*f)}if(Mo[0]=i,i>1&&c.update(l),c.update(r).update(Mo).digestInto(l),u.update(l).digestInto(l),a.set(l,s*(i-1)),c.destroy(),u.destroy(),d?.destroy(),l!==a&&dt(l),dt(Mo),n===a.length)return a;let p=a.slice(0,n);return dt(a),p}var fd=(e,t,r,n,o)=>{jo(e),r===void 0&&(r=new Uint8Array(e.outputLen));let s=Zo.create(e,r).update(t);return KT(e,s.digest(),n,o,s)};var JT=e=>e/2**32|0,WT=e=>e>>>0;function yb(e,t,r,n){let o=JT(r),s=WT(r);e.setUint32(t,n?s:o,n),e.setUint32(t+4,n?o:s,n)}function _b(e,t,r){return e&t^~e&r}function bb(e,t,r){return e&t^e&r^t&r}var Gi=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(t,r,n,o){this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(t),this.view=Ji(this.buffer)}update(t){dn(this),Wt(t);let{view:r,buffer:n,blockLen:o}=this,s=t.length,i=!1;for(let a=0;a<s;){let c=Math.min(o-this.pos,s-a);if(c===o){let u=Ji(t);for(;o<=s-a;a+=o)this.process(u,a);i=!0;continue}n.set(a===0&&c===s?t:t.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===o&&(this.process(r,0),this.pos=0,i=!0)}return this.length+=t.length,i&&this.roundClean(),this}digestInto(t){dn(this),Ki(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:s}=this,{pos:i}=this;r[i++]=128,r.fill(0,i),this.padOffset>o-i&&(this.process(n,0),r.fill(0)),yb(n,o-8,this.length*8,s),this.process(n,0),this.roundClean();let a=t===r?n:Ji(t),c=this.outputLen,u=c/4,l=this.get();if(c%4||u>l.length)throw new Error("invalid outputLen");for(let d=0;d<u;d++)a.setUint32(4*d,l[d],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneIntoMeta(t){let{buffer:r,length:n,finished:o,destroyed:s,pos:i}=this;return t.destroyed=s,t.finished=o,t.length=n,t.pos=i,i&&t.buffer.set(r),t}clone(){return this._cloneInto()}},wb=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var GT=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Gt=new Uint32Array(64),pd=class extends Gi{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(t,r){super(64,t,8,!1),this.A=r[0]|0,this.B=r[1]|0,this.C=r[2]|0,this.D=r[3]|0,this.E=r[4]|0,this.F=r[5]|0,this.G=r[6]|0,this.H=r[7]|0}get(){let{A:t,B:r,C:n,D:o,E:s,F:i,G:a,H:c}=this;return[t,r,n,o,s,i,a,c]}set(t,r,n,o,s,i,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=a|0,this.H=c|0}_cloneInto(t){return(t||=new this.constructor).set(...this.get()),this._cloneIntoMeta(t)}process(t,r){for(let d=0;d<16;d++,r+=4)Gt[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){let p=Gt[d-15],f=Gt[d-2],h=ot(p,7)^ot(p,18)^p>>>3,m=ot(f,17)^ot(f,19)^f>>>10;Gt[d]=m+Gt[d-7]+h+Gt[d-16]|0}let{A:n,B:o,C:s,D:i,E:a,F:c,G:u,H:l}=this;for(let d=0;d<64;d++){let p=ot(a,6)^ot(a,11)^ot(a,25),f=l+p+_b(a,c,u)+GT[d]+Gt[d]|0,m=(ot(n,2)^ot(n,13)^ot(n,22))+bb(n,o,s)|0;l=u,u=c,c=a,a=i+f|0,i=s,s=o,o=n,n=f+m|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,o,s,i,a,c,u,l)}roundClean(){dt(Gt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),dt(this.buffer)}},hd=class extends pd{constructor(){super(32,wb)}};var Xi=mb(()=>new hd,gb(1));var Do=new TextEncoder,XT=new TextDecoder,YT="ape1",xb=/^ape1\.([A-Za-z0-9_-]{16})\.([A-Za-z0-9_-]+)$/,QT=/^[A-Za-z0-9_-]{43}$/,eO=/^jb_live_[A-Za-z0-9]{40}$/;function md(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function gd(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4)),r=new Uint8Array(new ArrayBuffer(t.length));for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}var yd=e=>QT.test(e),vb=e=>typeof e=="string"&&xb.test(e);function $b(e){let t=e.trim();if(yd(t))return{token:null,key:t};let[r,n,...o]=t.split(".");if(!eO.test(r)||o.length||n!==void 0&&!yd(n))throw new Error("Not a valid Jotbus token or connection string");return{token:r,key:n??null}}async function Sb(e){if(!yd(e))throw new Error("Invalid workspace key");let t=gd(e),r=new Uint8Array(32),n=fd(Xi,t,r,Do.encode("agentpad/v1/enc"),32),o=fd(Xi,t,r,Do.encode("agentpad/v1/check"),32),s=md(Zo(Xi,o,Do.encode("agentpad/v1/key-check"))),i=a=>Do.encode(`agentpad/v1/${a}`);return{check:s,async encrypt(a,c){let u=globalThis.crypto.getRandomValues(new Uint8Array(12)),l=ld(n,u,i(a)).encrypt(Do.encode(JSON.stringify(c)));return`${YT}.${md(u)}.${md(l)}`},async decrypt(a,c){let u=xb.exec(c);if(!u)throw new Error("Not an encrypted message");let l=ld(n,gd(u[1]),i(a)).decrypt(gd(u[2])),d=JSON.parse(XT.decode(l));if(typeof d?.c!="string")throw new Error("Malformed message");return d}}}var qo="0.2.0",oO=64*1024,kb="https://app.jotbus.com/mcp";globalThis.crypto||(globalThis.crypto=tO);var Qi=e=>process.stderr.write(`[jotbus] ${e}
|
|
78
|
-
`);function
|
|
79
|
-
`),process.exit(0));xd.help&&(process.stdout.write(`jotbus ${qo}: shared scratchpad for coding agents (local MCP client, stdio)
|
|
69
|
+
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}a.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Sm(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Sm(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var zm=new Set(["type","properties","required","additionalProperties"]),vm=["oneOf","anyOf"];function $m(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Sc(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!zm.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let u of t){let l=u.properties?.[i]??$m(u);l!=null&&(a.some(d=>JSON.stringify(d)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:Sc(a)??{allOf:a};qe(r,i,c)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(s=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=$m(i);a&&!s.some(c=>JSON.stringify(c)===JSON.stringify(a))&&s.push(a)}s.length===1?o.additionalProperties=s[0]:s.length>1&&(o.additionalProperties={allOf:s})}return o}function Ox(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of zm)if(o in e)return;let r=t.filter(o=>vm.some(s=>Array.isArray(o[s]))),n=null;if(!r.length)n=Sc(t);else{let o=r[0],s=vm.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let i=t.filter(c=>c!==o),a=o[s].map(c=>Sc([...i,c]));if(a.some(c=>!c))return;n={[s]:a}}n&&(delete e.allOf,Mn(e,n))}function Pc(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let 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){n(d);let f=e.seen.get(d),h=f.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)):Mn(u,h),Mn(u,l),a._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(h.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let p=a._zod.parent;if(p&&p!==d){n(p);let f=e.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let h in u)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(u[h])===JSON.stringify(f.def[h])&&delete u[h]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Sm(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);d?d.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Ox(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$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");o.$id=e.external.uri(a)}Mn(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,qe(i,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ln(t,"input",e.processors),output:Ln(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Oe(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Oe(n.element,r);if(n.type==="set")return Oe(n.valueType,r);if(n.type==="lazy")return Oe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Oe(n.innerType,r);if(n.type==="intersection")return Oe(n.left,r)||Oe(n.right,r);if(n.type==="record"||n.type==="map")return Oe(n.keyType,r)||Oe(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Oe(n.in,r)||Oe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Oe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Oe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Oe(o,r))return!0;return!!(n.rest&&Oe(n.rest,r))}return!1}var km=(e,t={})=>r=>{let n=zc({...r,processors:t});return le(e,n),kc(n,e),Pc(n,e)},Ln=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=zc({...o??{},target:s,io:t,processors:r});return le(e,i),kc(i,e),Pc(i,e)};var Br=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Vr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},Pm=(e,t)=>{Br(e,"minimum",t),Vr(e,"maximum",t)},Rm=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Am=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Cm=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},Im=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Em=(e,t)=>Br(e,"minimum",t.minimum),Tm=(e,t)=>Vr(e,"maximum",t.maximum),Om=e=>(t,r)=>{Im(t,r.format);let[n,o]=e[r.format];Br(t,"minimum",n),Vr(t,"maximum",o)},Rx={greater_than:(e,t)=>Br(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Vr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Rm(e,t.value),number_format:Om(On),bigint_format:Om(fs),min_length:Em,max_length:Tm,length_equals:(e,t)=>Pm(e,t.length),min_size:Em,max_size:Tm,size_equals:(e,t)=>Pm(e,t.size),string_format:(e,t)=>{Im(e,t.format),t.pattern&&Am(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Cm(e,t.mime)};function be(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)Rx[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Br(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Br(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Vr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Vr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Rm(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Cm(t,o.mime);for(let s of o.patterns??[])Am(t,s);return t}var Ax={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Cx=new Map([[rc,Hf],[Es,Kf]]),Nm=e=>Cx.get(e)??e,jm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u,laxFormat:l}=be(e);if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Ax[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let d=[...c].map(Nm);d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Zm=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=be(e);o.type=l?"integer":"number";let d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d?f?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof s=="number"&&(o.minimum=s),p?f?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof i=="number"&&(o.maximum=i),a){let h=new Set;for(let w of a)Number.isFinite(w)&&w!==0?h.add(Math.abs(w)):rt(e,t,o,n,`A multipleOf divisor of ${w} cannot be represented in JSON Schema`);let[m,...y]=h;m!==void 0&&(o.multipleOf=m),y.length&&(o.allOf=[...o.allOf??[],...y.map(w=>({multipleOf:w}))])}},Dm=(e,t,r,n)=>{r.type="boolean"},Mm=(e,t,r,n)=>{rt(e,t,r,n,"BigInt cannot be represented in JSON Schema")};var Lm=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Um=(e,t,r,n)=>{r.not={}},qm=(e,t,r,n)=>{},Fm=(e,t,r,n)=>{},Bm=(e,t,r,n)=>{rt(e,t,r,n,"Date cannot be represented in JSON Schema")},Vm=(e,t,r,n)=>{let o=e._zod.def,s=Ir(o.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Hm=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(rt(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(rt(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;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 Km=(e,t,r,n)=>{rt(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var Jm=(e,t,r,n)=>{rt(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Wm=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=be(e);typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=le(s.element,t,{...n,path:[...n.path,"items"]})};function Ls(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Ls(t.out):t.type==="catch"?Ls(t.innerType):e._zod.optin}var Gm=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&rt(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in i)qe(o.properties,u,le(i[u],t,{...n,path:[...n.path,"properties",u]}));let c=[];for(let u of Object.keys(i)){let l=s.shape[u];(t.io==="input"?Ls(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=le(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Xm=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>le(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Ym=(e,t,r,n)=>{let o=e._zod.def,s=le(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=le(o.right,t,{...n,path:[...n.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,t.intersections.push(c)};function Ec(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let h=e.get(t)?.def;if(!h)return t;let m=Ec(e,h,r);return m===h?t:m}for(let h of["anyOf","oneOf"]){let m=t[h];if(!Array.isArray(m))continue;let y=m.map(w=>Ec(e,w,r));y.some((w,v)=>w!==m[v])&&(t={...t,[h]:y})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(h=>h==="number"||h==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some(h=>typeof h=="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:d,id:p,...f}=t;return f.enum?f.enum=f.enum.map(h=>typeof h=="number"?String(h):h):typeof f.const=="number"&&(f.const=String(f.const)),o&&(f.type="string",s||(f.pattern=(n.includes("number")?In:Ga).source)),f}var Tc=new WeakMap;function Ix(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Tc.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Ec(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);s&&(o.propertyNames=s)}}var Qm=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=be(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=le(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)qe(o.patternProperties,Nm(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=le(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Tc.get(t);l||(l=[],Tc.set(t,l),t.deferred.push(()=>Ix(t))),l.push(e)}o.additionalProperties=le(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let c=i._zod.values,u=t.io==="input"&&Ls(s.valueType)!==void 0;if(c&&!s.partial&&!u){let l=[...c].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l.map(String))}},eg=(e,t,r,n)=>{let o=e._zod.def,s=le(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},tg=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Oc=Symbol();function rg(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(s=!0,null));return s?(rt(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Oc):JSON.parse(i)}var ng=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=rg(o.defaultValue,e,t,r,n);i!==Oc&&(r.default=i)},og=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=rg(o.defaultValue,e,t,r,n);i!==Oc&&(r._prefault=i)},sg=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{rt(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},ig=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;le(i,t,n);let a=t.seen.get(e);a.ref=i},ag=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Rc=(e,t,r,n)=>{let o=e._zod.def;le(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};function Us(e){return!!e._zod}function Re(e,t){return Us(e)?Ka(e,t):e.safeParse(t)}function Kr(e){if(!e)return;let t;if(Us(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Jr(e){if(Us(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 n=e.value;if(n!==void 0)return n}var cg=new WeakSet([Object.prototype,Error.prototype]);function qs(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Bx=(e,t)=>{wf.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);cg.has(r)||(cg.add(r),qs(r,"format",n=>o=>Ha(n,o)),qs(r,"flatten",n=>o=>Va(n,o)),qs(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Nr,2)}),qs(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Nr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var Fe=b("ZodError",Bx,void 0,{Parent:Error});var ug=ys(Fe),lg=_s(Fe),dg=Cn(Fe),fg=bs(Fe),pg=$f(Fe),hg=Sf(Fe),mg=zf(Fe),gg=kf(Fe),yg=Pf(Fe),_g=Ef(Fe),bg=Tf(Fe),wg=Of(Fe);function Hx(){Ie.localeError||Ne(Ih())}function Bs(){Ie.memoizer||Ne({memoizer:lc()})}var X=b("ZodType",(e,t)=>(Hx(),W.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(j.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ve(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Cv(e,t))},superRefine(e,t){return this.check(Iv(e,t))},overwrite(e){return this.check(Lt(e))},optional(){return ae(this)},exactOptional(){return xv(this)},nullable(){return $g(this)},nullish(){return ae($g(this))},nonoptional(e){return Pv(this,e)},array(){return z(this)},or(e){return re([this,e])},and(e){return Hs(this,e)},transform(e){return Sg(this,Ig(e))},default(e){return Sv(this,e)},prefault(e){return kv(this,e)},catch(e){return Tv(this,e)},pipe(e){return Sg(this,e)},readonly(){return Av(this)},describe(e){let t=this.clone();return Mt.add(t,{description:e}),t},meta(...e){if(e.length===0)return Mt.get(this);let t=this.clone();return Mt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return j.hide(this,"~standard",{...tc(this),jsonSchema:{input:Ln(this,"input"),output:Ln(this,"output")}})},set"~standard"(e){j.own(this,"~standard",e)},parse:function e(t,r){return ug(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await lg(this,t,r,{callee:e})},safeParse(e,t){return dg(this,e,t)},async safeParseAsync(e,t){return fg(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){j.own(this,"spa",e)},validate(e,t){return ws(this,e,t)},validateAsync(e,t){return xs(this,e,t)},encode:function e(t,r){return pg(this,t,r,{callee:e})},decode:function e(t,r){return hg(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await mg(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await gg(this,t,r,{callee:e})},safeEncode(e,t){return yg(this,e,t)},safeDecode(e,t){return _g(this,e,t)},async safeEncodeAsync(e,t){return bg(this,e,t)},async safeDecodeAsync(e,t){return wg(this,e,t)},toJSONSchema(e){return km(this,{})(e)},get description(){return Mt.get(this)?.description},get _def(){return this._zod.def}}),zg=b("_ZodString",(e,t)=>{Ps.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jm(e,r,n,o)},j.derived({format:e=>be(e).format??null,minLength:e=>be(e).minimum??null,maxLength:e=>be(e).maximum??null},{regex(...e){return this.check(pc(...e))},includes(...e){return this.check(gc(...e))},startsWith(...e){return this.check(yc(...e))},endsWith(...e){return this.check(_c(...e))},min(...e){return this.check(Fr(...e))},max(...e){return this.check(Ds(...e))},length(...e){return this.check(Ms(...e))},nonempty(...e){return this.check(Fr(1,...e))},lowercase(e){return this.check(hc(e))},uppercase(e){return this.check(mc(e))},trim(){return this.check(wc())},normalize(...e){return this.check(bc(...e))},toLowerCase(){return this.check(xc())},toUpperCase(){return this.check(vc())},slugify(){return this.check($c())}})),Cc=b("ZodString",(e,t)=>{Ps.init(e,t),zg.init(e,t)},{email(e){return this.check(Mh(Kx,e))},url(e){return this.check(fc(kg,e))},jwt(e){return this.check(sm(uv,e))},emoji(e){return this.check(Vh(Wx,e))},guid(e){return this.check(Lh(Jx,e))},uuid(e){return this.check(Uh(Fs,e))},uuidv4(e){return this.check(qh(Fs,e))},uuidv6(e){return this.check(Fh(Fs,e))},uuidv7(e){return this.check(Bh(Fs,e))},nanoid(e){return this.check(Hh(Gx,e))},cuid(e){return this.check(Kh(Xx,e))},cuid2(e){return this.check(Jh(Yx,e))},ulid(e){return this.check(Wh(Qx,e))},base64(e){return this.check(rm(iv,e))},base64url(e){return this.check(nm(av,e))},xid(e){return this.check(Gh(ev,e))},ksuid(e){return this.check(Xh(tv,e))},ipv4(e){return this.check(Yh(rv,e))},ipv6(e){return this.check(Qh(nv,e))},cidrv4(e){return this.check(em(ov,e))},cidrv6(e){return this.check(tm(sv,e))},e164(e){return this.check(om(cv,e))},datetime(e){return this.check(Is(Un,e))},date(e){return this.check(Ns(qn,e))},time(e){return this.check(js(Fn,e))},duration(e){return this.check(Zs(Bn,e))}});function g(e){return Zh(Cc,e)}var ce=b("ZodStringFormat",(e,t)=>{te.init(e,t),zg.init(e,t)}),Un=b("ZodISODateTime",(e,t)=>{Bp.init(e,t),ce.init(e,t)}),qn=b("ZodISODate",(e,t)=>{Vp.init(e,t),ce.init(e,t)}),Fn=b("ZodISOTime",(e,t)=>{Hp.init(e,t),ce.init(e,t)}),Bn=b("ZodISODuration",(e,t)=>{Kp.init(e,t),ce.init(e,t)}),Kx=b("ZodEmail",(e,t)=>{Cp.init(e,t),ce.init(e,t)});var Jx=b("ZodGUID",(e,t)=>{Rp.init(e,t),ce.init(e,t)});var Fs=b("ZodUUID",(e,t)=>{Ap.init(e,t),ce.init(e,t)});var kg=b("ZodURL",(e,t)=>{jp.init(e,t),ce.init(e,t)});function Pg(e){return fc(kg,e)}var Wx=b("ZodEmoji",(e,t)=>{Zp.init(e,t),ce.init(e,t)});var Gx=b("ZodNanoID",(e,t)=>{Dp.init(e,t),ce.init(e,t)});var Xx=b("ZodCUID",(e,t)=>{Mp.init(e,t),ce.init(e,t)});var Yx=b("ZodCUID2",(e,t)=>{Lp.init(e,t),ce.init(e,t)});var Qx=b("ZodULID",(e,t)=>{Up.init(e,t),ce.init(e,t)});var ev=b("ZodXID",(e,t)=>{qp.init(e,t),ce.init(e,t)});var tv=b("ZodKSUID",(e,t)=>{Fp.init(e,t),ce.init(e,t)});var rv=b("ZodIPv4",(e,t)=>{Jp.init(e,t),ce.init(e,t)});var nv=b("ZodIPv6",(e,t)=>{Gp.init(e,t),ce.init(e,t)});var ov=b("ZodCIDRv4",(e,t)=>{Xp.init(e,t),ce.init(e,t)});var sv=b("ZodCIDRv6",(e,t)=>{Yp.init(e,t),ce.init(e,t)});var iv=b("ZodBase64",(e,t)=>{eh.init(e,t),ce.init(e,t)});var av=b("ZodBase64URL",(e,t)=>{th.init(e,t),ce.init(e,t)});var cv=b("ZodE164",(e,t)=>{rh.init(e,t),ce.init(e,t)});var uv=b("ZodJWT",(e,t)=>{nh.init(e,t),ce.init(e,t)});var Vs=b("ZodNumber",(e,t)=>{nc.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zm(e,r,n,o),e.isFinite=!0},j.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=be(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=be(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=be(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>be(e).format??null},{gt(e,t){return this.check(qr(e,t))},gte(e,t){return this.check(St(e,t))},min(e,t){return this.check(St(e,t))},lt(e,t){return this.check(Ur(e,t))},lte(e,t){return this.check($t(e,t))},max(e,t){return this.check($t(e,t))},int(e){return this.check(xg(e))},safe(e){return this.check(xg(e))},positive(e){return this.check(qr(0,e))},nonnegative(e){return this.check(St(0,e))},negative(e){return this.check(Ur(0,e))},nonpositive(e){return this.check($t(0,e))},multipleOf(e,t){return this.check(Dn(e,t))},step(e,t){return this.check(Dn(e,t))},finite(){return this}}));function K(e){return im(Vs,e)}var lv=b("ZodNumberFormat",(e,t)=>{oh.init(e,t),Vs.init(e,t)});function xg(e){return cm(lv,e)}var Ic=b("ZodBoolean",(e,t)=>{sh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dm(e,r,n,o)});function Y(e){return um(Ic,e)}var Eg=b("ZodBigInt",(e,t)=>{ih.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mm(e,r,n,o)},j.derived({minValue:e=>be(e).minimum??null,maxValue:e=>be(e).maximum??null,format:e=>be(e).format??null},{gte(e,t){return this.check(St(e,t))},min(e,t){return this.check(St(e,t))},gt(e,t){return this.check(qr(e,t))},lt(e,t){return this.check(Ur(e,t))},lte(e,t){return this.check($t(e,t))},max(e,t){return this.check($t(e,t))},positive(e){return this.check(qr(BigInt(0),e))},negative(e){return this.check(Ur(BigInt(0),e))},nonpositive(e){return this.check($t(BigInt(0),e))},nonnegative(e){return this.check(St(BigInt(0),e))},multipleOf(e,t){return this.check(Dn(e,t))}}));var dv=b("ZodNull",(e,t)=>{ah.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lm(e,r,n,o)});function Tg(e){return fm(dv,e)}var fv=b("ZodAny",(e,t)=>{ch.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qm(e,r,n,o)});function Og(){return pm(fv)}var pv=b("ZodUnknown",(e,t)=>{uh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fm(e,r,n,o)});function ie(){return hm(pv)}var hv=b("ZodNever",(e,t)=>{lh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Um(e,r,n,o)});function mv(e){return mm(hv,e)}var Rg=b("ZodDate",(e,t)=>{dh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bm(e,r,n,o),e.min=(r,n)=>e.check(St(r,n)),e.max=(r,n)=>e.check($t(r,n))},j.derived({minDate:e=>{let{minimum:t}=be(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=be(e);return t?new Date(t):null}},{}));var gv=b("ZodArray",(e,t)=>{Bs(),fh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wm(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Fr(e,t))},nonempty(e){return this.check(Fr(1,e))},max(e,t){return this.check(Ds(e,t))},length(e,t){return this.check(Ms(e,t))},unwrap(){return this.element}});function z(e,t){return ym(gv,e,t)}var Ag=b("ZodObject",(e,t)=>{Bs(),mh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o),j.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return je(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(j.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(j.mergeDefs(this._zod.def,{catchall:ie()}))},loose(){return this.clone(j.mergeDefs(this._zod.def,{catchall:ie()}))},strict(){return this.clone(j.mergeDefs(this._zod.def,{catchall:mv()}))},strip(){return this.clone(j.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return j.extend(this,e)},safeExtend(e){return j.safeExtend(this,e)},merge(e){return j.merge(this,e)},pick(e){return j.pick(this,e)},omit(e){return j.omit(this,e)},partial(...e){return j.partial(Ng,this,e[0])},exactPartial(...e){return j.partial(jg,this,e[0],"exactPartial")},required(...e){return j.required(Zg,this,e[0])}});function k(e,t){let r={type:"object",shape:e??{},...j.normalizeParams(t)};return new Ag(r)}function pe(e,t){return new Ag({type:"object",shape:e,catchall:ie(),...j.normalizeParams(t)})}var Cg=b("ZodUnion",(e,t)=>{oc.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o),e.options=t.options});function re(e,t){return new Cg({type:"union",options:e,...j.normalizeParams(t)})}var yv=b("ZodDiscriminatedUnion",(e,t)=>{Cg.init(e,t),gh.init(e,t)});function Nc(e,t,r){return new yv({type:"union",options:t,discriminator:e,...j.normalizeParams(r)})}var _v=b("ZodIntersection",(e,t)=>{yh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o)});function Hs(e,t){return new _v({type:"intersection",left:e,right:t})}var vg=b("ZodRecord",(e,t)=>{Bs(),_h.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ee(e,t,r){return!t||!t._zod?new vg({type:"record",keyType:g(),valueType:e,...j.normalizeParams(t)}):new vg({type:"record",keyType:e,valueType:t,...j.normalizeParams(r)})}var Ac=b("ZodEnum",(e,t)=>{bh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Vm(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ac({...t,checks:[],...j.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ac({...t,checks:[],...j.normalizeParams(o),entries:s})}});function je(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Ac({type:"enum",entries:r,...j.normalizeParams(t)})}var bv=b("ZodLiteral",(e,t)=>{wh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hm(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function R(e,t){return new bv({type:"literal",values:Array.isArray(e)?e:[e],...j.normalizeParams(t)})}var wv=b("ZodTransform",(e,t)=>{Bs(),xh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jm(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(j.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(j.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Ig(e){return new wv({type:"transform",transform:e})}var Ng=b("ZodOptional",(e,t)=>{sc.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new Ng({type:"optional",innerType:e})}var jg=b("ZodExactOptional",(e,t)=>{vh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xv(e){return new jg({type:"optional",innerType:e})}var vv=b("ZodNullable",(e,t)=>{$h.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $g(e){return new vv({type:"nullable",innerType:e})}var $v=b("ZodDefault",(e,t)=>{Sh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ng(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sv(e,t){return new $v({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var zv=b("ZodPrefault",(e,t)=>{zh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>og(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function kv(e,t){return new zv({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():j.shallowClone(t)}})}var Zg=b("ZodNonOptional",(e,t)=>{kh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Pv(e,t){return new Zg({type:"nonoptional",innerType:e,...j.normalizeParams(t)})}var Ev=b("ZodCatch",(e,t)=>{Ph.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sg(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Tv(e,t){return new Ev({type:"catch",innerType:e,catchValue:typeof t=="function"?t:j.constantCatch(t)})}var Dg=b("ZodPipe",(e,t)=>{ic.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ig(e,r,n,o),e.in=t.in,e.out=t.out});function Sg(e,t){return new Dg({type:"pipe",in:e,out:t})}var Ov=b("ZodPreprocess",(e,t)=>{Dg.init(e,t),Eh.init(e,t)}),Rv=b("ZodReadonly",(e,t)=>{Th.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ag(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Av(e){return new Rv({type:"readonly",innerType:e})}var Mg=b("ZodCustom",(e,t)=>{Oh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Km(e,r,n,o)});function Lg(e,t){return _m(Mg,e??(()=>!0),t)}function Cv(e,t={}){return bm(Mg,e,t)}function Iv(e,t){return wm(e,t)}function jc(e,t){return new Ov({type:"pipe",in:Ig(e),out:t})}var qg={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 Ug;Ug||(Ug={});var Ks={};aa(Ks,{ZodISODate:()=>qn,ZodISODateTime:()=>Un,ZodISODuration:()=>Bn,ZodISOTime:()=>Fn,date:()=>Zv,datetime:()=>jv,duration:()=>Mv,time:()=>Dv});function jv(e){return Is(Un,e)}function Zv(e){return Ns(qn,e)}function Dv(e){return js(Fn,e)}function Mv(e){return Zs(Bn,e)}var Js={};aa(Js,{bigint:()=>Fv,boolean:()=>qv,date:()=>Bv,number:()=>Uv,string:()=>Lv});function Lv(e){return Dh(Cc,e)}function Uv(e){return am(Vs,e)}function qv(e){return lm(Ic,e)}function Fv(e){return dm(Eg,e)}function Bv(e){return gm(Rg,e)}var Ut="2025-11-25";var Gs=[Ut,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],qt="io.modelcontextprotocol/related-task",Xs="2.0",he=Lg(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Fg=re([g(),K().int()]),Bg=g(),KC=pe({ttl:K().optional(),pollInterval:K().optional()}),Hv=k({ttl:K().optional()}),Kv=k({taskId:g()}),Dc=pe({progressToken:Fg.optional(),[qt]:Kv.optional()}),Be=k({_meta:Dc.optional()}),Vn=Be.extend({task:Hv.optional()}),Vg=e=>Vn.safeParse(e).success,we=k({method:g(),params:Be.loose().optional()}),He=k({_meta:Dc.optional()}),Ke=k({method:g(),params:He.loose().optional()}),xe=pe({_meta:Dc.optional()}),Ys=re([g(),K().int()]),Hg=k({jsonrpc:R(Xs),id:Ys,...we.shape}).strict(),Hn=e=>Hg.safeParse(e).success,Kg=k({jsonrpc:R(Xs),...Ke.shape}).strict(),Jg=e=>Kg.safeParse(e).success,Mc=k({jsonrpc:R(Xs),id:Ys,result:xe}).strict(),cr=e=>Mc.safeParse(e).success;var N;(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"})(N||(N={}));var Lc=k({jsonrpc:R(Xs),id:Ys.optional(),error:k({code:K().int(),message:g(),data:ie().optional()})}).strict();var Wg=e=>Lc.safeParse(e).success;var Gr=re([Hg,Kg,Mc,Lc]),JC=re([Mc,Lc]),zt=xe.strict(),Jv=He.extend({requestId:Ys.optional(),reason:g().optional()}),Qs=Ke.extend({method:R("notifications/cancelled"),params:Jv}),Wv=k({src:g(),mimeType:g().optional(),sizes:z(g()).optional(),theme:je(["light","dark"]).optional()}),Kn=k({icons:z(Wv).optional()}),Wr=k({name:g(),title:g().optional()}),Gg=Wr.extend({...Wr.shape,...Kn.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),Gv=Hs(k({applyDefaults:Y().optional()}),ee(g(),ie())),Xv=jc(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Hs(k({form:Gv.optional(),url:he.optional()}),ee(g(),ie()).optional())),Yv=pe({list:he.optional(),cancel:he.optional(),requests:pe({sampling:pe({createMessage:he.optional()}).optional(),elicitation:pe({create:he.optional()}).optional()}).optional()}),Qv=pe({list:he.optional(),cancel:he.optional(),requests:pe({tools:pe({call:he.optional()}).optional()}).optional()}),e$=k({experimental:ee(g(),he).optional(),sampling:k({context:he.optional(),tools:he.optional()}).optional(),elicitation:Xv.optional(),roots:k({listChanged:Y().optional()}).optional(),tasks:Yv.optional(),extensions:ee(g(),he).optional()}),t$=Be.extend({protocolVersion:g(),capabilities:e$,clientInfo:Gg}),Uc=we.extend({method:R("initialize"),params:t$});var r$=k({experimental:ee(g(),he).optional(),logging:he.optional(),completions:he.optional(),prompts:k({listChanged:Y().optional()}).optional(),resources:k({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:k({listChanged:Y().optional()}).optional(),tasks:Qv.optional(),extensions:ee(g(),he).optional()}),qc=xe.extend({protocolVersion:g(),capabilities:r$,serverInfo:Gg,instructions:g().optional()}),ei=Ke.extend({method:R("notifications/initialized"),params:He.optional()}),Xg=e=>ei.safeParse(e).success,ti=we.extend({method:R("ping"),params:Be.optional()}),n$=k({progress:K(),total:ae(K()),message:ae(g())}),o$=k({...He.shape,...n$.shape,progressToken:Fg}),ri=Ke.extend({method:R("notifications/progress"),params:o$}),s$=Be.extend({cursor:Bg.optional()}),Jn=we.extend({params:s$.optional()}),Wn=xe.extend({nextCursor:Bg.optional()}),i$=je(["working","input_required","completed","failed","cancelled"]),Gn=k({taskId:g(),status:i$,ttl:re([K(),Tg()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:ae(K()),statusMessage:ae(g())}),kt=xe.extend({task:Gn}),a$=He.merge(Gn),Xn=Ke.extend({method:R("notifications/tasks/status"),params:a$}),ni=we.extend({method:R("tasks/get"),params:Be.extend({taskId:g()})}),oi=xe.merge(Gn),si=we.extend({method:R("tasks/result"),params:Be.extend({taskId:g()})}),WC=xe.loose(),ii=Jn.extend({method:R("tasks/list")}),ai=Wn.extend({tasks:z(Gn)}),ci=we.extend({method:R("tasks/cancel"),params:Be.extend({taskId:g()})}),Yg=xe.merge(Gn),Qg=k({uri:g(),mimeType:ae(g()),_meta:ee(g(),ie()).optional()}),ey=Qg.extend({text:g()}),Fc=g().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ty=Qg.extend({blob:Fc}),Yn=je(["user","assistant"]),Xr=k({audience:z(Yn).optional(),priority:K().min(0).max(1).optional(),lastModified:Ks.datetime({offset:!0}).optional()}),ry=k({...Wr.shape,...Kn.shape,uri:g(),description:ae(g()),mimeType:ae(g()),size:ae(K()),annotations:Xr.optional(),_meta:ae(pe({}))}),c$=k({...Wr.shape,...Kn.shape,uriTemplate:g(),description:ae(g()),mimeType:ae(g()),annotations:Xr.optional(),_meta:ae(pe({}))}),u$=Jn.extend({method:R("resources/list")}),Bc=Wn.extend({resources:z(ry)}),l$=Jn.extend({method:R("resources/templates/list")}),Vc=Wn.extend({resourceTemplates:z(c$)}),Hc=Be.extend({uri:g()}),d$=Hc,f$=we.extend({method:R("resources/read"),params:d$}),Kc=xe.extend({contents:z(re([ey,ty]))}),Jc=Ke.extend({method:R("notifications/resources/list_changed"),params:He.optional()}),p$=Hc,h$=we.extend({method:R("resources/subscribe"),params:p$}),m$=Hc,g$=we.extend({method:R("resources/unsubscribe"),params:m$}),y$=He.extend({uri:g()}),_$=Ke.extend({method:R("notifications/resources/updated"),params:y$}),b$=k({name:g(),description:ae(g()),required:ae(Y())}),w$=k({...Wr.shape,...Kn.shape,description:ae(g()),arguments:ae(z(b$)),_meta:ae(pe({}))}),x$=Jn.extend({method:R("prompts/list")}),Wc=Wn.extend({prompts:z(w$)}),v$=Be.extend({name:g(),arguments:ee(g(),g()).optional()}),$$=we.extend({method:R("prompts/get"),params:v$}),Gc=k({type:R("text"),text:g(),annotations:Xr.optional(),_meta:ee(g(),ie()).optional()}),Xc=k({type:R("image"),data:Fc,mimeType:g(),annotations:Xr.optional(),_meta:ee(g(),ie()).optional()}),Yc=k({type:R("audio"),data:Fc,mimeType:g(),annotations:Xr.optional(),_meta:ee(g(),ie()).optional()}),S$=k({type:R("tool_use"),name:g(),id:g(),input:ee(g(),ie()),_meta:ee(g(),ie()).optional()}),z$=k({type:R("resource"),resource:re([ey,ty]),annotations:Xr.optional(),_meta:ee(g(),ie()).optional()}),k$=ry.extend({type:R("resource_link")}),Qc=re([Gc,Xc,Yc,k$,z$]),P$=k({role:Yn,content:Qc}),eu=xe.extend({description:g().optional(),messages:z(P$)}),tu=Ke.extend({method:R("notifications/prompts/list_changed"),params:He.optional()}),E$=k({title:g().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),T$=k({taskSupport:je(["required","optional","forbidden"]).optional()}),ny=k({...Wr.shape,...Kn.shape,description:g().optional(),inputSchema:k({type:R("object"),properties:ee(g(),he).optional(),required:z(g()).optional()}).catchall(ie()),outputSchema:k({type:R("object"),properties:ee(g(),he).optional(),required:z(g()).optional()}).catchall(ie()).optional(),annotations:E$.optional(),execution:T$.optional(),_meta:ee(g(),ie()).optional()}),ru=Jn.extend({method:R("tools/list")}),nu=Wn.extend({tools:z(ny)}),Ft=xe.extend({content:z(Qc).default([]),structuredContent:ee(g(),ie()).optional(),isError:Y().optional()}),GC=Ft.or(xe.extend({toolResult:ie()})),O$=Vn.extend({name:g(),arguments:ee(g(),ie()).optional()}),Qn=we.extend({method:R("tools/call"),params:O$}),ou=Ke.extend({method:R("notifications/tools/list_changed"),params:He.optional()}),oy=k({autoRefresh:Y().default(!0),debounceMs:K().int().nonnegative().default(300)}),eo=je(["debug","info","notice","warning","error","critical","alert","emergency"]),R$=Be.extend({level:eo}),su=we.extend({method:R("logging/setLevel"),params:R$}),A$=He.extend({level:eo,logger:g().optional(),data:ie()}),C$=Ke.extend({method:R("notifications/message"),params:A$}),I$=k({name:g().optional()}),N$=k({hints:z(I$).optional(),costPriority:K().min(0).max(1).optional(),speedPriority:K().min(0).max(1).optional(),intelligencePriority:K().min(0).max(1).optional()}),j$=k({mode:je(["auto","required","none"]).optional()}),Z$=k({type:R("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:z(Qc).default([]),structuredContent:k({}).loose().optional(),isError:Y().optional(),_meta:ee(g(),ie()).optional()}),D$=Nc("type",[Gc,Xc,Yc]),Ws=Nc("type",[Gc,Xc,Yc,S$,Z$]),M$=k({role:Yn,content:re([Ws,z(Ws)]),_meta:ee(g(),ie()).optional()}),L$=Vn.extend({messages:z(M$),modelPreferences:N$.optional(),systemPrompt:g().optional(),includeContext:je(["none","thisServer","allServers"]).optional(),temperature:K().optional(),maxTokens:K().int(),stopSequences:z(g()).optional(),metadata:he.optional(),tools:z(ny).optional(),toolChoice:j$.optional()}),iu=we.extend({method:R("sampling/createMessage"),params:L$}),ur=xe.extend({model:g(),stopReason:ae(je(["endTurn","stopSequence","maxTokens"]).or(g())),role:Yn,content:D$}),to=xe.extend({model:g(),stopReason:ae(je(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:Yn,content:re([Ws,z(Ws)])}),U$=k({type:R("boolean"),title:g().optional(),description:g().optional(),default:Y().optional()}),q$=k({type:R("string"),title:g().optional(),description:g().optional(),minLength:K().optional(),maxLength:K().optional(),format:je(["email","uri","date","date-time"]).optional(),default:g().optional()}),F$=k({type:je(["number","integer"]),title:g().optional(),description:g().optional(),minimum:K().optional(),maximum:K().optional(),default:K().optional()}),B$=k({type:R("string"),title:g().optional(),description:g().optional(),enum:z(g()),default:g().optional()}),V$=k({type:R("string"),title:g().optional(),description:g().optional(),oneOf:z(k({const:g(),title:g()})),default:g().optional()}),H$=k({type:R("string"),title:g().optional(),description:g().optional(),enum:z(g()),enumNames:z(g()).optional(),default:g().optional()}),K$=re([B$,V$]),J$=k({type:R("array"),title:g().optional(),description:g().optional(),minItems:K().optional(),maxItems:K().optional(),items:k({type:R("string"),enum:z(g())}),default:z(g()).optional()}),W$=k({type:R("array"),title:g().optional(),description:g().optional(),minItems:K().optional(),maxItems:K().optional(),items:k({anyOf:z(k({const:g(),title:g()}))}),default:z(g()).optional()}),G$=re([J$,W$]),X$=re([H$,K$,G$]),Y$=re([X$,U$,q$,F$]),Q$=Vn.extend({mode:R("form").optional(),message:g(),requestedSchema:k({type:R("object"),properties:ee(g(),Y$),required:z(g()).optional()})}),eS=Vn.extend({mode:R("url"),message:g(),elicitationId:g(),url:g().url()}),tS=re([Q$,eS]),au=we.extend({method:R("elicitation/create"),params:tS}),rS=He.extend({elicitationId:g()}),nS=Ke.extend({method:R("notifications/elicitation/complete"),params:rS}),Bt=xe.extend({action:je(["accept","decline","cancel"]),content:jc(e=>e===null?void 0:e,ee(g(),re([g(),K(),Y(),z(g())])).optional())}),oS=k({type:R("ref/resource"),uri:g()});var sS=k({type:R("ref/prompt"),name:g()}),iS=Be.extend({ref:re([sS,oS]),argument:k({name:g(),value:g()}),context:k({arguments:ee(g(),g()).optional()}).optional()}),aS=we.extend({method:R("completion/complete"),params:iS});var cu=xe.extend({completion:pe({values:z(g()).max(100),total:ae(K().int()),hasMore:ae(Y())})}),cS=k({uri:g().startsWith("file://"),name:g().optional(),_meta:ee(g(),ie()).optional()}),uS=we.extend({method:R("roots/list"),params:Be.optional()}),uu=xe.extend({roots:z(cS)}),lS=Ke.extend({method:R("notifications/roots/list_changed"),params:He.optional()}),XC=re([ti,Uc,aS,su,$$,x$,u$,l$,f$,h$,g$,Qn,ru,ni,si,ii,ci]),YC=re([Qs,ri,ei,lS,Xn]),QC=re([zt,ur,to,Bt,uu,oi,ai,kt]),eI=re([ti,iu,au,uS,ni,si,ii,ci]),tI=re([Qs,ri,C$,_$,Jc,ou,tu,Xn,nS]),rI=re([zt,qc,cu,eu,Wc,Bc,Vc,Kc,Ft,nu,oi,ai,kt]),A=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===N.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Zc(o.elicitations,r)}return new e(t,r,n)}},Zc=class extends A{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(N.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Vt(e){return e==="completed"||e==="failed"||e==="cancelled"}var NI=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function lu(e){let r=Kr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Jr(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function du(e,t){let r=Re(e,t);if(!r.success)throw r.error;return r.data}var gS=6e4,Yr=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(Qs,r=>{this._oncancel(r)}),this.setNotificationHandler(ri,r=>{this._onprogress(r)}),this.setRequestHandler(ti,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ni,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new A(N.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(si,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.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,p=new A(d.error.code,d.error.message,d.error.data);l(p)}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:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new A(N.InvalidParams,`Task not found: ${s}`);if(!Vt(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(Vt(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[qt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(ii,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new A(N.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ci,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new A(N.InvalidParams,`Task not found: ${r.params.taskId}`);if(Vt(o.status))throw new A(N.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new A(N.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof A?o:new A(N.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),A.fromError(N.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),cr(s)||Wg(s)?this._onresponse(s):Hn(s)?this._onrequest(s,i):Jg(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 n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=A.fromError(N.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=t.params?._meta?.[qt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:N.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.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=Vg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.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,p)=>{if(i.signal.aborted)throw new A(N.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let h=f.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},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(()=>n(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()},o?.sessionId):await o?.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:N.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()},o?.sessionId):await o?.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,...n}=t.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),cr(t))n(t);else{let i=new A(t.error.code,t.error.message,t.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===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(cr(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),cr(t))o(t);else{let i=A.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(i){yield{type:"error",error:i instanceof A?i:new A(N.InternalError,String(i))}}return}let s;try{let i=await this.request(t,kt,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new A(N.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},Vt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new A(N.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new A(N.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof A?i:new A(N.InternalError,String(i))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=v=>{l(v)};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(v){d(v);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[qt]:c}});let h=v=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(v)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));let S=v instanceof A?v:new A(N.RequestTimeout,String(v));l(S)};this._responseHandlers.set(p,v=>{if(!n?.signal?.aborted){if(v instanceof Error)return l(v);try{let S=Re(r,v.result);S.success?u(S.data):l(S.error)}catch(S){l(S)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let m=n?.timeout??gS,y=()=>h(A.fromError(N.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let w=c?.taskId;if(w){let v=S=>{let T=this._responseHandlers.get(p);T?T(S):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(w,{type:"request",message:f,timestamp:Date.now()}).catch(S=>{this._cleanupTimeout(p),l(S)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(v=>{this._cleanupTimeout(p),l(v)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},oi,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},ai,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Yg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[qt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{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||{},[qt]: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||{},[qt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let n=lu(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=du(t,o);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 n=lu(t);this._notificationHandlers.set(n,o=>{let s=du(t,o);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,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Hn(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new A(N.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 n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,s)=>{if(r.aborted){s(new A(N.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new A(N.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new A(N.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=Xn.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Vt(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new A(N.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Vt(a.status))throw new A(N.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=Xn.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Vt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function sy(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ui(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];sy(i)&&sy(s)?r[o]={...i,...s}:r[o]=s}return r}var ob=ca(nd(),1),sb=ca(nb(),1);function PT(){let e=new ob.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,sb.default)(e),e}var yn=class{constructor(t){this._ajv=t??PT()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Hi=class{constructor(t){this._client=t}async*callToolStream(t,r=Ft,n){let o=this._client,s={...n,task:n?.task??(o.isToolTask(t.name)?{}:void 0)},i=o.requestStream({method:"tools/call",params:t},r,s),a=o.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 A(N.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 A(N.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof A){yield{type:"error",error:l};return}yield{type:"error",error:new A(N.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,n){return this._client.getTaskResult({taskId:t},r,n)}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,n){return this._client.requestStream(t,r,n)}};function Ki(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 Ji(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 Wi(e,t){if(!(!e||t===null||typeof t!="object")){if(e.type==="object"&&e.properties&&typeof e.properties=="object"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[o]=s.default),r[o]!==void 0&&Wi(s,r[o])}}if(Array.isArray(e.anyOf))for(let r of e.anyOf)typeof r!="boolean"&&Wi(r,t);if(Array.isArray(e.oneOf))for(let r of e.oneOf)typeof r!="boolean"&&Wi(r,t)}}function ET(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 Gi=class extends Yr{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 yn,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(t){t.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",ou,t.tools,async()=>(await this.listTools()).tools),t.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",tu,t.prompts,async()=>(await this.listPrompts()).prompts),t.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Jc,t.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Hi(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ui(this._capabilities,t)}setRequestHandler(t,r){let o=Kr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Jr(o);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=Re(au,c);if(!l.success){let v=l.error instanceof Error?l.error.message:String(l.error);throw new A(N.InvalidParams,`Invalid elicitation request: ${v}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=ET(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new A(N.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new A(N.InvalidParams,"Client does not support URL-mode elicitation requests");let h=await Promise.resolve(r(c,u));if(d.task){let v=Re(kt,h);if(!v.success){let S=v.error instanceof Error?v.error.message:String(v.error);throw new A(N.InvalidParams,`Invalid task creation result: ${S}`)}return v.data}let m=Re(Bt,h);if(!m.success){let v=m.error instanceof Error?m.error.message:String(m.error);throw new A(N.InvalidParams,`Invalid elicitation result: ${v}`)}let y=m.data,w=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&w&&this._capabilities.elicitation?.form?.applyDefaults)try{Wi(w,y.content)}catch{}return y};return super.setRequestHandler(t,a)}if(i==="sampling/createMessage"){let a=async(c,u)=>{let l=Re(iu,c);if(!l.success){let y=l.error instanceof Error?l.error.message:String(l.error);throw new A(N.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let y=Re(kt,p);if(!y.success){let w=y.error instanceof Error?y.error.message:String(y.error);throw new A(N.InvalidParams,`Invalid task creation result: ${w}`)}return y.data}let h=d.tools||d.toolChoice?to:ur,m=Re(h,p);if(!m.success){let y=m.error instanceof Error?m.error.message:String(m.error);throw new A(N.InvalidParams,`Invalid sampling result: ${y}`)}return m.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 n=await this.request({method:"initialize",params:{protocolVersion:Ut,capabilities:this._capabilities,clientInfo:this._clientInfo}},qc,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!Gs.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,t.setProtocolVersion&&t.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}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){Ki(this._serverCapabilities?.tasks?.requests,t,"Server")}assertTaskHandlerCapability(t){this._capabilities&&Ji(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},cu,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},eu,r)}async listPrompts(t,r){return this.request({method:"prompts/list",params:t},Wc,r)}async listResources(t,r){return this.request({method:"resources/list",params:t},Bc,r)}async listResourceTemplates(t,r){return this.request({method:"resources/templates/list",params:t},Vc,r)}async readResource(t,r){return this.request({method:"resources/read",params:t},Kc,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=Ft,n){if(this.isToolTaskRequired(t.name))throw new A(N.InvalidRequest,`Tool "${t.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:t},r,n),s=this.getToolOutputValidator(t.name);if(s){if(!o.structuredContent&&!o.isError)throw new A(N.InvalidRequest,`Tool ${t.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let i=s(o.structuredContent);if(!i.valid)throw new A(N.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof A?i:new A(N.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return o}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 o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(t){return this._cachedToolOutputValidators.get(t)}async listTools(t,r){let n=await this.request({method:"tools/list",params:t},nu,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(t,r,n,o){let s=oy.safeParse(n);if(!s.success)throw new Error(`Invalid ${t} listChanged options: ${s.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${t} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=n,u=async()=>{if(!i){c(null,null);return}try{let d=await o();c(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));c(p,null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(t);d&&clearTimeout(d);let p=setTimeout(u,a);this._listChangedDebounceTimers.set(t,p)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var lb=ca(ub(),1);function db(e){if(e)try{return lb.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function Xi(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function fb(e=fetch,t){return t?async(r,n)=>{let o={...t,...n,headers:n?.headers?{...Xi(t.headers),...Xi(n.headers)}:t.headers};return e(r,o)}:e}var fd;fd=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(e=>e.webcrypto);async function ZT(e){return(await fd).getRandomValues(new Uint8Array(e))}async function DT(e){let t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%t.length,n="";for(;n.length<e;){let o=await ZT(e-n.length);for(let s of o)s<r&&(n+=t[s%t.length])}return n}async function MT(e){return await DT(e)}async function LT(e){let t=await(await fd).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function pd(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await MT(e),r=await LT(t);return{code_verifier:t,code_challenge:r}}var ze=Pg().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:qg.custom,message:"URL must be parseable",fatal:!0}),qa}).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"}),hb=pe({resource:g().url(),authorization_servers:z(ze).optional(),jwks_uri:g().url().optional(),scopes_supported:z(g()).optional(),bearer_methods_supported:z(g()).optional(),resource_signing_alg_values_supported:z(g()).optional(),resource_name:g().optional(),resource_documentation:g().optional(),resource_policy_uri:g().url().optional(),resource_tos_uri:g().url().optional(),tls_client_certificate_bound_access_tokens:Y().optional(),authorization_details_types_supported:z(g()).optional(),dpop_signing_alg_values_supported:z(g()).optional(),dpop_bound_access_tokens_required:Y().optional()}),hd=pe({issuer:g(),authorization_endpoint:ze,token_endpoint:ze,registration_endpoint:ze.optional(),scopes_supported:z(g()).optional(),response_types_supported:z(g()),response_modes_supported:z(g()).optional(),grant_types_supported:z(g()).optional(),token_endpoint_auth_methods_supported:z(g()).optional(),token_endpoint_auth_signing_alg_values_supported:z(g()).optional(),service_documentation:ze.optional(),revocation_endpoint:ze.optional(),revocation_endpoint_auth_methods_supported:z(g()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(g()).optional(),introspection_endpoint:g().optional(),introspection_endpoint_auth_methods_supported:z(g()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(g()).optional(),code_challenge_methods_supported:z(g()).optional(),client_id_metadata_document_supported:Y().optional()}),UT=pe({issuer:g(),authorization_endpoint:ze,token_endpoint:ze,userinfo_endpoint:ze.optional(),jwks_uri:ze,registration_endpoint:ze.optional(),scopes_supported:z(g()).optional(),response_types_supported:z(g()),response_modes_supported:z(g()).optional(),grant_types_supported:z(g()).optional(),acr_values_supported:z(g()).optional(),subject_types_supported:z(g()),id_token_signing_alg_values_supported:z(g()),id_token_encryption_alg_values_supported:z(g()).optional(),id_token_encryption_enc_values_supported:z(g()).optional(),userinfo_signing_alg_values_supported:z(g()).optional(),userinfo_encryption_alg_values_supported:z(g()).optional(),userinfo_encryption_enc_values_supported:z(g()).optional(),request_object_signing_alg_values_supported:z(g()).optional(),request_object_encryption_alg_values_supported:z(g()).optional(),request_object_encryption_enc_values_supported:z(g()).optional(),token_endpoint_auth_methods_supported:z(g()).optional(),token_endpoint_auth_signing_alg_values_supported:z(g()).optional(),display_values_supported:z(g()).optional(),claim_types_supported:z(g()).optional(),claims_supported:z(g()).optional(),service_documentation:g().optional(),claims_locales_supported:z(g()).optional(),ui_locales_supported:z(g()).optional(),claims_parameter_supported:Y().optional(),request_parameter_supported:Y().optional(),request_uri_parameter_supported:Y().optional(),require_request_uri_registration:Y().optional(),op_policy_uri:ze.optional(),op_tos_uri:ze.optional(),client_id_metadata_document_supported:Y().optional()}),mb=k({...UT.shape,...hd.pick({code_challenge_methods_supported:!0}).shape}),gb=k({access_token:g(),id_token:g().optional(),token_type:g(),expires_in:Js.number().optional(),scope:g().optional(),refresh_token:g().optional(),issuer:g().optional().catch(void 0)}).strip(),yb=k({error:g(),error_description:g().optional(),error_uri:g().optional()}),pb=ze.optional().or(R("").transform(()=>{})),qT=k({redirect_uris:z(ze),token_endpoint_auth_method:g().optional(),grant_types:z(g()).optional(),response_types:z(g()).optional(),client_name:g().optional(),client_uri:ze.optional(),logo_uri:pb,scope:g().optional(),contacts:z(g()).optional(),tos_uri:pb,policy_uri:g().optional(),jwks_uri:ze.optional(),jwks:Og().optional(),software_id:g().optional(),software_version:g().optional(),software_statement:g().optional()}).strip(),FT=k({client_id:g(),client_secret:g().optional(),client_id_issued_at:K().optional(),client_secret_expires_at:K().optional(),issuer:g().optional().catch(void 0)}).strip(),_b=qT.merge(FT),lZ=k({error:g(),error_description:g().optional()}).strip(),dZ=k({token:g(),token_type_hint:g().optional()}).strip();function bb(e){let t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function wb({requestedResource:e,configuredResource:t}){let r=typeof e=="string"?new URL(e):new URL(e.href),n=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var fe=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}},Io=class extends fe{};Io.errorCode="invalid_request";var vr=class extends fe{};vr.errorCode="invalid_client";var $r=class extends fe{};$r.errorCode="invalid_grant";var Sr=class extends fe{};Sr.errorCode="unauthorized_client";var No=class extends fe{};No.errorCode="unsupported_grant_type";var jo=class extends fe{};jo.errorCode="invalid_scope";var Zo=class extends fe{};Zo.errorCode="access_denied";var At=class extends fe{};At.errorCode="server_error";var Do=class extends fe{};Do.errorCode="temporarily_unavailable";var Mo=class extends fe{};Mo.errorCode="unsupported_response_type";var Lo=class extends fe{};Lo.errorCode="unsupported_token_type";var Uo=class extends fe{};Uo.errorCode="invalid_token";var qo=class extends fe{};qo.errorCode="method_not_allowed";var Fo=class extends fe{};Fo.errorCode="too_many_requests";var zr=class extends fe{};zr.errorCode="invalid_client_metadata";var Bo=class extends fe{};Bo.errorCode="insufficient_scope";var Vo=class extends fe{};Vo.errorCode="invalid_target";var xb={[Io.errorCode]:Io,[vr.errorCode]:vr,[$r.errorCode]:$r,[Sr.errorCode]:Sr,[No.errorCode]:No,[jo.errorCode]:jo,[Zo.errorCode]:Zo,[At.errorCode]:At,[Do.errorCode]:Do,[Mo.errorCode]:Mo,[Lo.errorCode]:Lo,[Uo.errorCode]:Uo,[qo.errorCode]:qo,[Fo.errorCode]:Fo,[zr.errorCode]:zr,[Bo.errorCode]:Bo,[Vo.errorCode]:Vo};var Ct=class extends Error{constructor(t){super(t??"Unauthorized")}};function BT(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var md="code",gd="S256";function VT(e,t){let r=e.client_secret!==void 0;return"token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&BT(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 HT(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":KT(o,s,r);return;case"client_secret_post":JT(o,s,n);return;case"none":WT(o,n);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function KT(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function JT(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function WT(e,t){t.set("client_id",e)}async function $b(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=yb.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n,a=xb[o]||At;return new a(s||"",i)}catch(n){let o=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new At(o)}}function GT(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith("/")&&r.slice(0,-1)===n||n.endsWith("/")&&n.slice(0,-1)===r}function bd(e,t){if(e)return typeof e.issuer!="string"?e.issuer==null?e:{...e,issuer:void 0}:GT(e.issuer,t)?e:void 0}var XT=gb.omit({issuer:!0}),YT=_b.omit({issuer:!0});function Sb(e,t){return new Error(`OAuth client information is bound to authorization server ${e.issuer} and is not presented to ${t}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`)}async function Ho(e,t){try{return await yd(e,t)}catch(r){if(r instanceof vr||r instanceof Sr)return await e.invalidateCredentials?.("all"),await yd(e,t);if(r instanceof $r)return await e.invalidateCredentials?.("tokens"),await yd(e,t);throw r}}async function yd(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,c,u,l=o;if(!l&&i?.resourceMetadataUrl&&(l=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await kb(c,{fetchFn:s}),!a)try{a=await zb(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 O=await sO(t,{resourceMetadataUrl:l,fetchFn:s});c=O.authorizationServerUrl,u=O.authorizationServerMetadata,a=O.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}let d=String(c),p=await eO(t,e,a),f=p&&a&&!e.validateResourceURL?a.resource:p,h=n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation()),y=bd(m,d),w=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(m&&!y&&!w)throw Sb(m,d);let v=y?.issuer==null?y:void 0,S=async()=>{try{v&&await e.saveClientInformation?.({...v,issuer:d})}catch{}};if(!y){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let O=u?.client_id_metadata_document_supported===!0,D=e.clientMetadataUrl;if(D&&!QT(D))throw new zr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${D}`);if(O&&D)y={client_id:D,issuer:d},await e.saveClientInformation?.(y);else{if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");y={...await lO(c,{metadata:u,clientMetadata:e.clientMetadata,scope:h,fetchFn:s}),issuer:d},await e.saveClientInformation(y)}}let T=!e.redirectUrl;if(r!==void 0||T){let O=await uO(e,c,{metadata:u,resource:f,authorizationCode:r,fetchFn:s});return await S(),await e.saveTokens({...O,issuer:d}),"AUTHORIZED"}let _=bd(await e.tokens(),d);if(_?.refresh_token&&_.issuer==null&&console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged."),_?.refresh_token)try{let O=await cO(c,{metadata:u,clientInformation:y,refreshToken:_.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await S(),await e.saveTokens({...O,issuer:d}),"AUTHORIZED"}catch(O){if(!(!(O instanceof fe)||O instanceof At))throw O}let x=e.state?await e.state():void 0,{authorizationUrl:$,codeVerifier:P}=await iO(c,{metadata:u,clientInformation:y,state:x,redirectUrl:e.redirectUrl,scope:h,resource:f});return await e.saveCodeVerifier(P),await e.redirectToAuthorization($),"REDIRECT"}function QT(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function eO(e,t,r){let n=bb(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(r){if(!wb({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function wd(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=_d(e,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=_d(e,"scope")||void 0,a=_d(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function _d(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function zb(e,t,r=fetch){let n=await nO(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return hb.parse(await n.json())}async function xd(e,t,r=fetch){try{return await r(e,{headers:t})}catch(n){if(n instanceof TypeError)return t?xd(e,void 0,r):void 0;throw n}}function tO(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function vb(e,t,r=fetch){return await xd(e,{"MCP-Protocol-Version":t},r)}function rO(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function nO(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??Ut,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let c=tO(t,o.pathname);i=new URL(c,n?.metadataServerUrl??o),i.search=o.search}let a=await vb(i,s,r);if(!n?.metadataUrl&&rO(a,o.pathname)){let c=new URL(`/.well-known/${t}`,o);a=await vb(c,s,r)}return a}function oO(e){let t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function kb(e,{fetchFn:t=fetch,protocolVersion:r=Ut}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=oO(e);for(let{url:s,type:i}of o){let a=await xd(s,n,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"?hd.parse(await a.json()):mb.parse(await a.json())}}}async function sO(e,t){let r,n;try{r=await zb(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",e)));let o=await kb(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function Pb(e){return typeof e=="string"?e:e.href}async function iO(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(md))throw new Error(`Incompatible auth server: does not support response type ${md}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(gd))throw new Error(`Incompatible auth server: does not support code challenge method ${gd}`)}else a=new URL("/authorize",e);let c=await pd(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",md),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",gd),a.searchParams.set("redirect_uri",String(n)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",Pb(i)),{authorizationUrl:a,codeVerifier:u}}function aO(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Eb(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,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",Pb(s)),o)await o(c,r,a,t);else if(n){let l=t?.token_endpoint_auth_methods_supported??[],d=VT(n,l);HT(d,n,c,r)}let u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await $b(u);return XT.parse(await u.json())}async function cO(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await Eb(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...c}}async function uO(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let l=await e.clientInformation(),d=bd(l,String(t));if(l&&!d)throw Sb(l,String(t));return d},a=await i(),c=e.clientMetadata.scope,u;if(e.prepareTokenRequest&&(u=await e.prepareTokenRequest(c)),!u){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();u=aO(o,l,e.redirectUrl)}return a??(a=await i()),Eb(t,{metadata:r,tokenRequestParams:u,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function lO(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){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(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await $b(i);return YT.parse(await i.json())}var Ko=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}},Tb=10,dO=13,kr=32;function vd(e){}function Ab(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=vd,onError:r=vd,onRetry:n=vd,onComment:o,maxBufferSize:s}=e,i=[],a=0,c=!0,u,l="",d=0,p,f=!1;function h(_){if(f)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,_.charCodeAt(0)===239&&_.charCodeAt(1)===187&&_.charCodeAt(2)===191&&(_=_.slice(3))),i.length===0){let P=y(_);P!==""&&(i.push(P),a=P.length),m();return}if(_.indexOf(`
|
|
70
|
+
`)===-1&&_.indexOf("\r")===-1){i.push(_),a+=_.length,m();return}i.push(_);let x=i.join("");i.length=0,a=0;let $=y(x);$!==""&&(i.push($),a=$.length),m()}function m(){s!==void 0&&(a+l.length<=s||(f=!0,i.length=0,a=0,u=void 0,l="",d=0,p=void 0,r(new Ko(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function y(_){let x=0;if(_.indexOf("\r")===-1){let $=_.indexOf(`
|
|
71
|
+
`,x);for(;$!==-1;){if(x===$){d>0&&t({id:u,event:p,data:l}),u=void 0,l="",d=0,p=void 0,x=$+1,$=_.indexOf(`
|
|
72
|
+
`,x);continue}let P=_.charCodeAt(x);if(Ob(_,x,P)){let O=_.charCodeAt(x+5)===kr?x+6:x+5,D=_.slice(O,$);if(d===0&&_.charCodeAt($+1)===Tb){t({id:u,event:p,data:D}),u=void 0,l="",p=void 0,x=$+2,$=_.indexOf(`
|
|
73
|
+
`,x);continue}l=d===0?D:`${l}
|
|
74
|
+
${D}`,d++}else Rb(_,x,P)?p=_.slice(_.charCodeAt(x+6)===kr?x+7:x+6,$)||void 0:w(_,x,$);x=$+1,$=_.indexOf(`
|
|
75
|
+
`,x)}return _.slice(x)}for(;x<_.length;){let $=_.indexOf("\r",x),P=_.indexOf(`
|
|
76
|
+
`,x),O=-1;if($!==-1&&P!==-1?O=$<P?$:P:$!==-1?$===_.length-1?O=-1:O=$:P!==-1&&(O=P),O===-1)break;w(_,x,O),x=O+1,_.charCodeAt(x-1)===dO&&_.charCodeAt(x)===Tb&&x++}return _.slice(x)}function w(_,x,$){if(x===$){S();return}let P=_.charCodeAt(x);if(Ob(_,x,P)){let ct=_.charCodeAt(x+5)===kr?x+6:x+5,sa=_.slice(ct,$);l=d===0?sa:`${l}
|
|
77
|
+
${sa}`,d++;return}if(Rb(_,x,P)){p=_.slice(_.charCodeAt(x+6)===kr?x+7:x+6,$)||void 0;return}if(P===105&&_.charCodeAt(x+1)===100&&_.charCodeAt(x+2)===58){let ct=_.slice(_.charCodeAt(x+3)===kr?x+4:x+3,$);ct.includes("\0")||(u=ct);return}if(P===58){if(o){let ct=_.slice(x,$);o(ct.slice(_.charCodeAt(x+1)===kr?2:1))}return}let O=_.slice(x,$),D=O.indexOf(":");if(D===-1){v(O,"",O);return}let se=O.slice(0,D),ye=O.charCodeAt(D+1)===kr?2:1,yt=O.slice(D+ye);v(se,yt,O)}function v(_,x,$){switch(_){case"event":p=x||void 0;break;case"data":l=d===0?x:`${l}
|
|
78
|
+
${x}`,d++;break;case"id":x.includes("\0")||(u=x);break;case"retry":/^\d+$/.test(x)?n(parseInt(x,10)):r(new Ko(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:$}));break;default:r(new Ko(`Unknown field "${_.length>20?`${_.slice(0,20)}\u2026`:_}"`,{type:"unknown-field",field:_,value:x,line:$}));break}}function S(){d>0&&t({id:u,event:p,data:l}),u=void 0,l="",d=0,p=void 0}function T(_={}){if(_.consume&&i.length>0){let x=i.join("");w(x,0,x.length)}c=!0,u=void 0,l="",d=0,p=void 0,i.length=0,a=0,f=!1}return{feed:h,reset:T}}function Ob(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 Rb(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 Yi=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:n,maxBufferSize:o}={}){let s;super({start(i){s=Ab({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:n,maxBufferSize:o})},transform(i){s.feed(i)}})}};var fO={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},er=class extends Error{constructor(t,r){super(`Streamable HTTP error: ${r}`),this.code=t}},Qi=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=fb(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??fO}async _authThenStart(){if(!this._authProvider)throw new Ct("No auth provider");let t;try{t=await Ho(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 Ct;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let t={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(t.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let r=Xi(this._requestInit?.headers);return new Headers({...t,...r})}async _startOrAuthSse(t){let{resumptionToken:r}=t;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new er(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,t,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(t){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,t),o)}_scheduleReconnection(t,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=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)})},o)}_handleSseStream(t,r,n){if(!t)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=t.pipeThrough(new TextDecoderStream).pipeThrough(new Yi({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:h}=await l.read();if(h)break;if(f.id&&(i=f.id,a=!0,o?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let m=Gr.parse(JSON.parse(f.data));cr(m)&&(c=!0,s!==void 0&&(m.id=s)),this.onmessage?.(m)}catch(m){this.onerror?.(m)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}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 Ct("No auth provider");if(await Ho(this._authProvider,{serverUrl:this._url,authorizationCode:t,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ct("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:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Hn(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 er(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:h,scope:m}=wd(a);if(this._resourceMetadataUrl=h,this._scope=m,await Ho(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new Ct;return this._hasCompletedAuthFlow=!0,this.send(t)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:h,scope:m,error:y}=wd(a);if(y==="insufficient_scope"){let w=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===w)throw new er(403,"Server returned 403 after trying upscoping");if(m&&(this._scope=m),h&&(this._resourceMetadataUrl=h),this._lastUpscopingHeader=w??void 0,await Ho(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new Ct;return this.send(t)}}throw new er(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),Xg(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"),p=db(d);if(l)if(p==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:o},!1);else if(p==="application/json"){let f=await a.json(),h=Array.isArray(f)?f.map(m=>Gr.parse(m)):[Gr.parse(f)];for(let m of h)this.onmessage?.(m)}else throw await a.body?.cancel(),new er(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}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},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new er(n.status,`Failed to terminate session: ${n.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 ea=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],s=Array.isArray(o.content)?o.content:[o.content],i=s.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},ur,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Bt,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};var ta=class extends Yr{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(eo.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new yn,this.setRequestHandler(Uc,n=>this._oninitialize(n)),this.setNotificationHandler(ei,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(su,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=eo.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ea(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ui(this._capabilities,t)}setRequestHandler(t,r){let o=Kr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s=Jr(o);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=Re(Qn,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new A(N.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=Re(kt,p);if(!h.success){let m=h.error instanceof Error?h.error.message:String(h.error);throw new A(N.InvalidParams,`Invalid task creation result: ${m}`)}return h.data}let f=Re(Ft,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new A(N.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){Ji(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Ki(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Gs.includes(r)?r:Ut,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},zt)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},to,r):this.request({method:"sampling/createMessage",params:t},ur,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Bt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:o},Bt,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new A(N.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof A?i:new A(N.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},uu,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import Ib from"node:process";var pO=10*1024*1024,ra=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??pO}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
79
|
+
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),hO(r)}clear(){this._buffer=void 0}};function hO(e){return Gr.parse(JSON.parse(e))}function Cb(e){return JSON.stringify(e)+`
|
|
80
|
+
`}var na=class{constructor(t=Ib.stdin,r=Ib.stdout,n){this._stdin=t,this._stdout=r,this._started=!1,this._ondata=o=>{try{this._readBuffer.append(o),this.processReadBuffer()}catch(s){this.onerror?.(s),this.close().catch(()=>{})}},this._onerror=o=>{this.onerror?.(o)},this._readBuffer=new ra({maxBufferSize:n?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=Cb(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var yO=64*1024;globalThis.crypto||(globalThis.crypto=mO);var oa=e=>process.stderr.write(`[jotbus] ${e}
|
|
81
|
+
`);function $d(e){oa(e),process.exit(1)}async function Sd(e){let t=process.env.JOTBUS_TOKEN;t||$d("Missing JOTBUS_TOKEN. Copy the connection string from the dashboard when you mint a token.");let r;try{r=Vd(t)}catch{$d("JOTBUS_TOKEN is not a valid Jotbus token or connection string.")}r.token||$d("JOTBUS_TOKEN contains only a key; use the full connection string from the dashboard.");let n=r.token,o=r.key?await Pn(r.key):null,s=$=>$.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");function i($){if(process.env.JOTBUS_AGENT)return process.env.JOTBUS_AGENT.slice(0,64);let P=s($??""),O=/claude/.test(P)?"claude":/codex/.test(P)?"codex":/cursor/.test(P)?"cursor":P.split("-")[0]||"agent",D=s(gO().split(".")[0].replace(/-?(local|lan|home)$/i,""))||"machine";return`${O}-${D}`.slice(0,64)}let a=null;async function c(){if(a)return a;let $=new Gi({name:"jotbus",version:nr});return await $.connect(new Qi(new URL(e),{requestInit:{headers:{Authorization:`Bearer ${n}`,"x-jotbus-e2e":"1",...o?{"x-jotbus-key-check":o.check}:{},"User-Agent":`jotbus/${nr}`}}})),a=$,$}async function u($,P){try{return await(await c()).callTool({name:$,arguments:P})}catch(O){throw a=null,O}}let l=$=>$.content?.[0]?.type==="text"?$.content[0].text:"",d=$=>({content:[{type:"text",text:JSON.stringify($,null,2)}]}),p=$=>({isError:!0,content:[{type:"text",text:$}]}),f=null;async function h($=!1){if(f&&!$)return f;let P=await u("list_workspaces",{});if(P.isError)throw new Error(l(P));return f=JSON.parse(l(P)),f}async function m($){let P=await h();if($==null||$==="")return P.length===1?P[0]:void 0;let O=String($).trim();return P.find(D=>D.id===O)??P.find(D=>D.name===O.toLowerCase())}function y($){return $.encrypted?o?o.check!==$.key_check?`The encryption key in JOTBUS_TOKEN doesn't match workspace "${$.name}". Mint a new token from a browser where the workspace is unlocked.`:null:`Workspace "${$.name}" is end-to-end encrypted, but JOTBUS_TOKEN has no key. Use the full connection string (token.key) shown when the token was minted.`:null}async function w($){if($.isError)return $;let P=JSON.parse(l($));if(!P.encrypted)return $;let O=(await h()).find(se=>se.id===P.workspace_id),D=O?y(O):"Unknown workspace";return D?p(D):(P.messages=await Promise.all(P.messages.map(async se=>{if(!Bd(se.content))return{...se,content:"[unreadable: not an encrypted message]"};try{let ye=await o.decrypt(P.workspace_id,se.content);return{...se,author:ye.a??se.author,content:ye.c,metadata:ye.m??null}}catch{return{...se,content:"[unreadable: could not decrypt with this key]"}}})),delete P.workspace_id,d(P))}async function v($,P){switch($){case"list_workspaces":{let O=await h(!0);return d(O.map(({key_check:D,...se},ye)=>({...se,...se.encrypted?{key_ok:!y(O[ye])}:{}})))}case"write_workspace":{let O=typeof P.author=="string"&&P.author.trim()||_(),D=await m(P.workspace);if(!D?.encrypted)return u($,{...P,author:O});let se=y(D);if(se)return p(se);let ye=String(P.content??"");if(!ye.trim())return p("content must be a non-empty string");if(Buffer.byteLength(ye)>yO)return p("Message is too large; the maximum is 64 KB of text.");let yt=P.metadata,ct=await o.encrypt(D.id,{c:ye,a:O,...yt?{m:yt}:{}}),{metadata:sa,author:vO,...jb}=P;return u($,{...jb,workspace:D.id,content:ct})}case"read_workspace":case"listen_workspace":return w(await u($,P));default:return u($,P)}}let S="Shared scratchpad for coding agents (Jotbus).";try{S=(await c()).getInstructions()??S;let P=await h();for(let O of P){let D=y(O);D&&oa(D)}oa(`connected: ${P.length} workspace(s)${P.some(O=>O.encrypted)?", end-to-end encrypted":""}`)}catch($){oa(`could not reach ${e} yet (${$.message}); will retry on first use`)}o&&(S+=`
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
Messages in encrypted workspaces are encrypted and decrypted on this machine; the server only stores ciphertext. Still never post secrets.`),S=S.replace(/\n*Other agents see your messages as written by[^\n]*/,"");let T=new ta({name:"jotbus",version:nr},{capabilities:{tools:{}},instructions:S}),_=()=>i(T.getClientVersion()?.name);T.setRequestHandler(ru,async()=>{let{tools:$}=await(await c()).listTools();return{tools:$.map(P=>P.name==="write_workspace"?{...P,description:`${P.description} You appear to other agents as "${_()}"; they can @mention you as @${_()}.`+(o?" In encrypted workspaces the text is encrypted on this machine before upload.":"")}:P)}}),T.setRequestHandler(Qn,async $=>{try{return await v($.params.name,$.params.arguments??{})}catch(P){return p(`Jotbus request failed: ${P.message}`)}});let x=()=>process.exit(0);process.stdin.on("end",x),process.stdin.on("close",x),T.onclose=x,await T.connect(new na)}globalThis.crypto||(globalThis.crypto=_O);var{values:_n,positionals:wO}=bO({allowPositionals:!0,strict:!1,options:{url:{type:"string"},origin:{type:"string"},yes:{type:"boolean",short:"y"},"no-install":{type:"boolean"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"}}}),Nb=`jotbus ${nr}: a shared, end-to-end encrypted scratchpad for your coding agents
|
|
82
84
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
Try it now (no account):
|
|
86
|
+
npx jotbus create a temporary workspace (60 min) and connect your agents
|
|
87
|
+
npx jotbus join <invite> join one from another machine, or share with someone
|
|
88
|
+
|
|
89
|
+
Options:
|
|
90
|
+
-y, --yes don't ask before replacing an existing Jotbus connection
|
|
91
|
+
--no-install just print the commands instead of configuring Claude Code / Codex
|
|
92
|
+
-h, --help, -v, --version
|
|
88
93
|
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
Persistent workspaces: sign in at ${or} and paste the install command it shows.
|
|
95
|
+
|
|
96
|
+
When launched by an agent this runs the MCP server:
|
|
97
|
+
JOTBUS_TOKEN connection string (jb_live_<token>.<key>)
|
|
98
|
+
JOTBUS_AGENT name other agents see (default: <agent>-<hostname>, e.g. claude-macbook)
|
|
99
|
+
--url MCP endpoint (or JOTBUS_URL). Default: ${as}
|
|
100
|
+
`,[Pr,...xO]=wO;if(_n.version)process.stdout.write(`${nr}
|
|
101
|
+
`);else if(_n.help||Pr==="help")process.stdout.write(Nb);else{let e=_n.url??process.env.JOTBUS_URL,r={origin:(_n.origin??process.env.JOTBUS_ORIGIN??e?.replace(/\/mcp\/?$/,"")??or).replace(/\/$/,""),yes:!!_n.yes,install:!_n["no-install"]};Pr==="join"?await tf(r,xO[0]):Pr==="new"||Pr==="create"?await Pa(r):Pr==="mcp"?await Sd(e??as):Pr?(process.stderr.write(`Unknown command "${Pr}".
|
|
91
102
|
|
|
92
|
-
|
|
103
|
+
${Nb}`),process.exit(1)):process.stdin.isTTY&&!process.env.JOTBUS_TOKEN?await Pa(r):await Sd(e??as)}
|