@cosmic-chimps/speckit-atlas 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +1 -1
  2. package/cli.js +27 -12
  3. package/mcp.js +38 -38
  4. package/package.json +1 -1
package/mcp.js CHANGED
@@ -1,75 +1,75 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var Kh=Object.create;var os=Object.defineProperty;var Hh=Object.getOwnPropertyDescriptor;var Wh=Object.getOwnPropertyNames;var Bh=Object.getPrototypeOf,Qh=Object.prototype.hasOwnProperty;var $=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wc=(e,t)=>{for(var r in t)os(e,r,{get:t[r],enumerable:!0})},Yh=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Wh(t))!Qh.call(e,n)&&n!==r&&os(e,n,{get:()=>t[n],enumerable:!(o=Hh(t,n))||o.enumerable});return e};var dr=(e,t,r)=>(r=e!=null?Kh(Bh(e)):{},Yh(t||!e||!e.__esModule?os(r,"default",{value:e,enumerable:!0}):r,e));var Fr=$(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.regexpCode=L.getEsmExportName=L.getProperty=L.safeStringify=L.stringify=L.strConcat=L.addCodeArg=L.str=L._=L.nil=L._Code=L.Name=L.IDENTIFIER=L._CodeOrName=void 0;var Dr=class{};L._CodeOrName=Dr;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var bt=class extends Dr{constructor(t){if(super(),!L.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}}};L.Name=bt;var Oe=class extends Dr{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,o)=>(o instanceof bt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};L._Code=Oe;L.nil=new Oe("");function Md(e,...t){let r=[e[0]],o=0;for(;o<t.length;)gi(r,t[o]),r.push(e[++o]);return new Oe(r)}L._=Md;var hi=new Oe("+");function qd(e,...t){let r=[Lr(e[0])],o=0;for(;o<t.length;)r.push(hi),gi(r,t[o]),r.push(hi,Lr(e[++o]));return $v(r),new Oe(r)}L.str=qd;function gi(e,t){t instanceof Oe?e.push(...t._items):t instanceof bt?e.push(t):e.push(zv(t))}L.addCodeArg=gi;function $v(e){let t=1;for(;t<e.length-1;){if(e[t]===hi){let r=bv(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function bv(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof bt||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 bt))return`"${e}${t.slice(1)}`}function wv(e,t){return t.emptyStr()?e:e.emptyStr()?t:qd`${e}${t}`}L.strConcat=wv;function zv(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Lr(Array.isArray(e)?e.join(","):e)}function xv(e){return new Oe(Lr(e))}L.stringify=xv;function Lr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Lr;function Sv(e){return typeof e=="string"&&L.IDENTIFIER.test(e)?new Oe(`.${e}`):Md`[${e}]`}L.getProperty=Sv;function kv(e){if(typeof e=="string"&&L.IDENTIFIER.test(e))return new Oe(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}L.getEsmExportName=kv;function Pv(e){return new Oe(e.toString())}L.regexpCode=Pv});var vi=$(be=>{"use strict";Object.defineProperty(be,"__esModule",{value:!0});be.ValueScope=be.ValueScopeName=be.Scope=be.varKinds=be.UsedValueState=void 0;var $e=Fr(),_i=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},on;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(on||(be.UsedValueState=on={}));be.varKinds={const:new $e.Name("const"),let:new $e.Name("let"),var:new $e.Name("var")};var nn=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof $e.Name?t:this.name(t)}name(t){return new $e.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};be.Scope=nn;var sn=class extends $e.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:o}){this.value=t,this.scopePath=(0,$e._)`.${new $e.Name(r)}[${o}]`}};be.ValueScopeName=sn;var Ev=(0,$e._)`\n`,yi=class extends nn{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?Ev:$e.nil}}get(){return this._scope}name(t){return new sn(t,this._newName(t))}value(t,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(t),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(t,r){let o=this._values[t];if(o)return o.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,$e._)`${t}${o.scopePath}`})}scopeCode(t=this._values,r,o){return this._reduceValues(t,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(t,r,o={},n){let s=$e.nil;for(let i in t){let a=t[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,on.Started);let l=r(u);if(l){let p=this.opts.es5?be.varKinds.var:be.varKinds.const;s=(0,$e._)`${s}${p} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,$e._)`${s}${l}${this.opts._n}`;else throw new _i(u);c.set(u,on.Completed)})}return s}};be.ValueScope=yi});var O=$(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.or=j.and=j.not=j.CodeGen=j.operators=j.varKinds=j.ValueScopeName=j.ValueScope=j.Scope=j.Name=j.regexpCode=j.stringify=j.getProperty=j.nil=j.strConcat=j.str=j._=void 0;var Z=Fr(),Ze=vi(),pt=Fr();Object.defineProperty(j,"_",{enumerable:!0,get:function(){return pt._}});Object.defineProperty(j,"str",{enumerable:!0,get:function(){return pt.str}});Object.defineProperty(j,"strConcat",{enumerable:!0,get:function(){return pt.strConcat}});Object.defineProperty(j,"nil",{enumerable:!0,get:function(){return pt.nil}});Object.defineProperty(j,"getProperty",{enumerable:!0,get:function(){return pt.getProperty}});Object.defineProperty(j,"stringify",{enumerable:!0,get:function(){return pt.stringify}});Object.defineProperty(j,"regexpCode",{enumerable:!0,get:function(){return pt.regexpCode}});Object.defineProperty(j,"Name",{enumerable:!0,get:function(){return pt.Name}});var ln=vi();Object.defineProperty(j,"Scope",{enumerable:!0,get:function(){return ln.Scope}});Object.defineProperty(j,"ValueScope",{enumerable:!0,get:function(){return ln.ValueScope}});Object.defineProperty(j,"ValueScopeName",{enumerable:!0,get:function(){return ln.ValueScopeName}});Object.defineProperty(j,"varKinds",{enumerable:!0,get:function(){return ln.varKinds}});j.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var et=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},$i=class extends et{constructor(t,r,o){super(),this.varKind=t,this.name=r,this.rhs=o}render({es5:t,_n:r}){let o=t?Ze.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Jt(this.rhs,t,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},an=class extends et{constructor(t,r,o){super(),this.lhs=t,this.rhs=r,this.sideEffects=o}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Z.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Jt(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return un(t,this.rhs)}},bi=class extends an{constructor(t,r,o,n){super(t,o,n),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},wi=class extends et{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},zi=class extends et{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},xi=class extends et{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Si=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=Jt(this.code,t,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Ur=class extends et{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,o)=>r+o.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let o=t[r].optimizeNodes();Array.isArray(o)?t.splice(r,1,...o):o?t[r]=o:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(t,r)||(Tv(t,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>xt(t,r.names),{})}},tt=class extends Ur{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},ki=class extends Ur{},Vt=class extends tt{};Vt.kind="else";var wt=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 o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Vt(o):o}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Dd(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Jt(this.condition,t,r),this}get names(){let t=super.names;return un(t,this.condition),this.else&&xt(t,this.else.names),t}};wt.kind="if";var zt=class extends tt{};zt.kind="for";var Pi=class extends zt{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=Jt(this.iteration,t,r),this}get names(){return xt(super.names,this.iteration.names)}},Ei=class extends zt{constructor(t,r,o,n){super(),this.varKind=t,this.name=r,this.from=o,this.to=n}render(t){let r=t.es5?Ze.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(t)}get names(){let t=un(super.names,this.from);return un(t,this.to)}},cn=class extends zt{constructor(t,r,o,n){super(),this.loop=t,this.varKind=r,this.name=o,this.iterable=n}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=Jt(this.iterable,t,r),this}get names(){return xt(super.names,this.iterable.names)}},Vr=class extends tt{constructor(t,r,o){super(),this.name=t,this.args=r,this.async=o}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Vr.kind="func";var Jr=class extends Ur{render(t){return"return "+super.render(t)}};Jr.kind="return";var Ti=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 o,n;return super.optimizeNames(t,r),(o=this.catch)===null||o===void 0||o.optimizeNames(t,r),(n=this.finally)===null||n===void 0||n.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&xt(t,this.catch.names),this.finally&&xt(t,this.finally.names),t}},Gr=class extends tt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Gr.kind="catch";var Kr=class extends tt{render(t){return"finally"+super.render(t)}};Kr.kind="finally";var Ri=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
- `:""},this._extScope=t,this._scope=new Ze.Scope({parent:t}),this._nodes=[new ki]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let o=this._extScope.value(t,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new $i(t,s,o)),s}const(t,r,o){return this._def(Ze.varKinds.const,t,r,o)}let(t,r,o){return this._def(Ze.varKinds.let,t,r,o)}var(t,r,o){return this._def(Ze.varKinds.var,t,r,o)}assign(t,r,o){return this._leafNode(new an(t,r,o))}add(t,r){return this._leafNode(new bi(t,j.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Z.nil&&this._leafNode(new Si(t)),this}object(...t){let r=["{"];for(let[o,n]of t)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,n));return r.push("}"),new Z._Code(r)}if(t,r,o){if(this._blockNode(new wt(t)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new wt(t))}else(){return this._elseNode(new Vt)}endIf(){return this._endBlockNode(wt,Vt)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Pi(t),r)}forRange(t,r,o,n,s=this.opts.es5?Ze.varKinds.var:Ze.varKinds.let){let i=this._scope.toName(t);return this._for(new Ei(s,i,r,o),()=>n(i))}forOf(t,r,o,n=Ze.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),o(s)})}return this._for(new cn("of",n,s,r),()=>o(s))}forIn(t,r,o,n=this.opts.es5?Ze.varKinds.var:Ze.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Z._)`Object.keys(${r})`,o);let s=this._scope.toName(t);return this._for(new cn("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(zt)}label(t){return this._leafNode(new wi(t))}break(t){return this._leafNode(new zi(t))}return(t){let r=new Jr;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jr)}try(t,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new Ti;if(this._blockNode(n),this.code(t),r){let s=this.name("e");this._currNode=n.catch=new Gr(s),r(s)}return o&&(this._currNode=n.finally=new Kr,this.code(o)),this._endBlockNode(Gr,Kr)}throw(t){return this._leafNode(new xi(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||t!==void 0&&o!==t)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Z.nil,o,n){return this._blockNode(new Vr(t,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Vr)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let o=this._currNode;if(o instanceof t||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof wt))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}};j.CodeGen=Ri;function xt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function un(e,t){return t instanceof Z._CodeOrName?xt(e,t.names):e}function Jt(e,t,r){if(e instanceof Z.Name)return o(e);if(!n(e))return e;return new Z._Code(e._items.reduce((s,i)=>(i instanceof Z.Name&&(i=o(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function n(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Tv(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Dd(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Z._)`!${Ii(e)}`}j.not=Dd;var Rv=Ld(j.operators.AND);function Iv(...e){return e.reduce(Rv)}j.and=Iv;var Ov=Ld(j.operators.OR);function jv(...e){return e.reduce(Ov)}j.or=jv;function Ld(e){return(t,r)=>t===Z.nil?r:r===Z.nil?t:(0,Z._)`${Ii(t)} ${e} ${Ii(r)}`}function Ii(e){return e instanceof Z.Name?e:(0,Z._)`(${e})`}});var q=$(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.checkStrictMode=N.getErrorPath=N.Type=N.useFunc=N.setEvaluated=N.evaluatedPropsToName=N.mergeEvaluated=N.eachItem=N.unescapeJsonPointer=N.escapeJsonPointer=N.escapeFragment=N.unescapeFragment=N.schemaRefOrVal=N.schemaHasRulesButRef=N.schemaHasRules=N.checkUnknownRules=N.alwaysValidSchema=N.toHash=void 0;var J=O(),Nv=Fr();function Av(e){let t={};for(let r of e)t[r]=!0;return t}N.toHash=Av;function Cv(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Vd(e,t),!Jd(t,e.self.RULES.all))}N.alwaysValidSchema=Cv;function Vd(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=o.RULES.keywords;for(let s in t)n[s]||Hd(e,`unknown keyword: "${s}"`)}N.checkUnknownRules=Vd;function Jd(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}N.schemaHasRules=Jd;function Zv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}N.schemaHasRulesButRef=Zv;function Mv({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,J._)`${r}`}return(0,J._)`${e}${t}${(0,J.getProperty)(o)}`}N.schemaRefOrVal=Mv;function qv(e){return Gd(decodeURIComponent(e))}N.unescapeFragment=qv;function Dv(e){return encodeURIComponent(ji(e))}N.escapeFragment=Dv;function ji(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}N.escapeJsonPointer=ji;function Gd(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}N.unescapeJsonPointer=Gd;function Lv(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}N.eachItem=Lv;function Fd({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof J.Name?(s instanceof J.Name?e(n,s,i):t(n,s,i),i):s instanceof J.Name?(t(n,i,s),s):r(s,i);return a===J.Name&&!(c instanceof J.Name)?o(n,c):c}}N.mergeEvaluated={props:Fd({mergeNames:(e,t,r)=>e.if((0,J._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,J._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,J._)`${r} || {}`).code((0,J._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,J._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,J._)`${r} || {}`),Ni(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Kd}),items:Fd({mergeNames:(e,t,r)=>e.if((0,J._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,J._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,J._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,J._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Kd(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,J._)`{}`);return t!==void 0&&Ni(e,r,t),r}N.evaluatedPropsToName=Kd;function Ni(e,t,r){Object.keys(r).forEach(o=>e.assign((0,J._)`${t}${(0,J.getProperty)(o)}`,!0))}N.setEvaluated=Ni;var Ud={};function Fv(e,t){return e.scopeValue("func",{ref:t,code:Ud[t.code]||(Ud[t.code]=new Nv._Code(t.code))})}N.useFunc=Fv;var Oi;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Oi||(N.Type=Oi={}));function Uv(e,t,r){if(e instanceof J.Name){let o=t===Oi.Num;return r?o?(0,J._)`"[" + ${e} + "]"`:(0,J._)`"['" + ${e} + "']"`:o?(0,J._)`"/" + ${e}`:(0,J._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,J.getProperty)(e).toString():"/"+ji(e)}N.getErrorPath=Uv;function Hd(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}N.checkStrictMode=Hd});var rt=$(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});var de=O(),Vv={data:new de.Name("data"),valCxt:new de.Name("valCxt"),instancePath:new de.Name("instancePath"),parentData:new de.Name("parentData"),parentDataProperty:new de.Name("parentDataProperty"),rootData:new de.Name("rootData"),dynamicAnchors:new de.Name("dynamicAnchors"),vErrors:new de.Name("vErrors"),errors:new de.Name("errors"),this:new de.Name("this"),self:new de.Name("self"),scope:new de.Name("scope"),json:new de.Name("json"),jsonPos:new de.Name("jsonPos"),jsonLen:new de.Name("jsonLen"),jsonPart:new de.Name("jsonPart")};Ai.default=Vv});var Hr=$(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.extendErrors=fe.resetErrorsCount=fe.reportExtraError=fe.reportError=fe.keyword$DataError=fe.keywordError=void 0;var D=O(),pn=q(),_e=rt();fe.keywordError={message:({keyword:e})=>(0,D.str)`must pass "${e}" keyword validation`};fe.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,D.str)`"${e}" keyword must be ${t} ($data)`:(0,D.str)`"${e}" keyword is invalid ($data)`};function Jv(e,t=fe.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,c=Qd(e,t,r);o??(i||a)?Wd(s,c):Bd(n,(0,D._)`[${c}]`)}fe.reportError=Jv;function Gv(e,t=fe.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=Qd(e,t,r);Wd(n,a),s||i||Bd(o,_e.default.vErrors)}fe.reportExtraError=Gv;function Kv(e,t){e.assign(_e.default.errors,t),e.if((0,D._)`${_e.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,D._)`${_e.default.vErrors}.length`,t),()=>e.assign(_e.default.vErrors,null)))}fe.resetErrorsCount=Kv;function Hv({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,_e.default.errors,a=>{e.const(i,(0,D._)`${_e.default.vErrors}[${a}]`),e.if((0,D._)`${i}.instancePath === undefined`,()=>e.assign((0,D._)`${i}.instancePath`,(0,D.strConcat)(_e.default.instancePath,s.errorPath))),e.assign((0,D._)`${i}.schemaPath`,(0,D.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,D._)`${i}.schema`,r),e.assign((0,D._)`${i}.data`,o))})}fe.extendErrors=Hv;function Wd(e,t){let r=e.const("err",t);e.if((0,D._)`${_e.default.vErrors} === null`,()=>e.assign(_e.default.vErrors,(0,D._)`[${r}]`),(0,D._)`${_e.default.vErrors}.push(${r})`),e.code((0,D._)`${_e.default.errors}++`)}function Bd(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;n.$async?r.throw((0,D._)`new ${e.ValidationError}(${t})`):(r.assign((0,D._)`${o}.errors`,t),r.return(!1))}var St={keyword:new D.Name("keyword"),schemaPath:new D.Name("schemaPath"),params:new D.Name("params"),propertyName:new D.Name("propertyName"),message:new D.Name("message"),schema:new D.Name("schema"),parentSchema:new D.Name("parentSchema")};function Qd(e,t,r){let{createErrors:o}=e.it;return o===!1?(0,D._)`{}`:Wv(e,t,r)}function Wv(e,t,r={}){let{gen:o,it:n}=e,s=[Bv(n,r),Qv(e,r)];return Yv(e,t,s),o.object(...s)}function Bv({errorPath:e},{instancePath:t}){let r=t?(0,D.str)`${e}${(0,pn.getErrorPath)(t,pn.Type.Str)}`:e;return[_e.default.instancePath,(0,D.strConcat)(_e.default.instancePath,r)]}function Qv({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:(0,D.str)`${t}/${e}`;return r&&(n=(0,D.str)`${n}${(0,pn.getErrorPath)(r,pn.Type.Str)}`),[St.schemaPath,n]}function Yv(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:p}=a;o.push([St.keyword,n],[St.params,typeof t=="function"?t(e):t||(0,D._)`{}`]),c.messages&&o.push([St.message,typeof r=="function"?r(e):r]),c.verbose&&o.push([St.schema,i],[St.parentSchema,(0,D._)`${l}${p}`],[_e.default.data,s]),u&&o.push([St.propertyName,u])}});var Xd=$(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.boolOrEmptySchema=Gt.topBoolOrEmptySchema=void 0;var Xv=Hr(),e$=O(),t$=rt(),r$={message:"boolean schema is false"};function o$(e){let{gen:t,schema:r,validateName:o}=e;r===!1?Yd(e,!1):typeof r=="object"&&r.$async===!0?t.return(t$.default.data):(t.assign((0,e$._)`${o}.errors`,null),t.return(!0))}Gt.topBoolOrEmptySchema=o$;function n$(e,t){let{gen:r,schema:o}=e;o===!1?(r.var(t,!1),Yd(e)):r.var(t,!0)}Gt.boolOrEmptySchema=n$;function Yd(e,t){let{gen:r,data:o}=e,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Xv.reportError)(n,r$,void 0,t)}});var Ci=$(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.getRules=Kt.isJSONType=void 0;var s$=["string","number","integer","boolean","null","object","array"],i$=new Set(s$);function a$(e){return typeof e=="string"&&i$.has(e)}Kt.isJSONType=a$;function c$(){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:{}}}Kt.getRules=c$});var Zi=$(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.shouldUseRule=dt.shouldUseGroup=dt.schemaHasRulesForType=void 0;function u$({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&ef(e,o)}dt.schemaHasRulesForType=u$;function ef(e,t){return t.rules.some(r=>tf(e,r))}dt.shouldUseGroup=ef;function tf(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(o=>e[o]!==void 0))}dt.shouldUseRule=tf});var Wr=$(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.reportTypeError=me.checkDataTypes=me.checkDataType=me.coerceAndCheckDataType=me.getJSONTypes=me.getSchemaTypes=me.DataType=void 0;var l$=Ci(),p$=Zi(),d$=Hr(),I=O(),rf=q(),Ht;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ht||(me.DataType=Ht={}));function f$(e){let t=of(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}me.getSchemaTypes=f$;function of(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(l$.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}me.getJSONTypes=of;function m$(e,t){let{gen:r,data:o,opts:n}=e,s=h$(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,p$.schemaHasRulesForType)(e,t[0]));if(i){let a=qi(t,o,n.strictNumbers,Ht.Wrong);r.if(a,()=>{s.length?g$(e,t,s):Di(e)})}return i}me.coerceAndCheckDataType=m$;var nf=new Set(["string","number","integer","boolean","null"]);function h$(e,t){return t?e.filter(r=>nf.has(r)||t==="array"&&r==="array"):[]}function g$(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(qi(t,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let u of r)(nf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Di(e),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),_$(e,a)});function c(u){switch(u){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null
2
+ "use strict";var og=Object.create;var cs=Object.defineProperty;var ng=Object.getOwnPropertyDescriptor;var sg=Object.getOwnPropertyNames;var ig=Object.getPrototypeOf,ag=Object.prototype.hasOwnProperty;var $=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Oc=(t,e)=>{for(var r in e)cs(t,r,{get:e[r],enumerable:!0})},cg=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of sg(e))!ag.call(t,n)&&n!==r&&cs(t,n,{get:()=>e[n],enumerable:!(o=ng(e,n))||o.enumerable});return t};var hr=(t,e,r)=>(r=t!=null?og(ig(t)):{},cg(e||!t||!t.__esModule?cs(r,"default",{value:t,enumerable:!0}):r,t));var Hr=$(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.regexpCode=L.getEsmExportName=L.getProperty=L.safeStringify=L.stringify=L.strConcat=L.addCodeArg=L.str=L._=L.nil=L._Code=L.Name=L.IDENTIFIER=L._CodeOrName=void 0;var Ur=class{};L._CodeOrName=Ur;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var bt=class extends Ur{constructor(e){if(super(),!L.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};L.Name=bt;var Ne=class extends Ur{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof bt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};L._Code=Ne;L.nil=new Ne("");function Jd(t,...e){let r=[t[0]],o=0;for(;o<e.length;)bi(r,e[o]),r.push(t[++o]);return new Ne(r)}L._=Jd;var $i=new Ne("+");function Wd(t,...e){let r=[Vr(t[0])],o=0;for(;o<e.length;)r.push($i),bi(r,e[o]),r.push($i,Vr(t[++o]));return Rv(r),new Ne(r)}L.str=Wd;function bi(t,e){e instanceof Ne?t.push(...e._items):e instanceof bt?t.push(e):t.push(Nv(e))}L.addCodeArg=bi;function Rv(t){let e=1;for(;e<t.length-1;){if(t[e]===$i){let r=Iv(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Iv(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof bt||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof bt))return`"${t}${e.slice(1)}`}function Ov(t,e){return e.emptyStr()?t:t.emptyStr()?e:Wd`${t}${e}`}L.strConcat=Ov;function Nv(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Vr(Array.isArray(t)?t.join(","):t)}function jv(t){return new Ne(Vr(t))}L.stringify=jv;function Vr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Vr;function Cv(t){return typeof t=="string"&&L.IDENTIFIER.test(t)?new Ne(`.${t}`):Jd`[${t}]`}L.getProperty=Cv;function Av(t){if(typeof t=="string"&&L.IDENTIFIER.test(t))return new Ne(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}L.getEsmExportName=Av;function Zv(t){return new Ne(t.toString())}L.regexpCode=Zv});var Si=$(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.ValueScope=we.ValueScopeName=we.Scope=we.varKinds=we.UsedValueState=void 0;var be=Hr(),wi=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},ln;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(ln||(we.UsedValueState=ln={}));we.varKinds={const:new be.Name("const"),let:new be.Name("let"),var:new be.Name("var")};var pn=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof be.Name?e:this.name(e)}name(e){return new be.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};we.Scope=pn;var dn=class extends be.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,be._)`.${new be.Name(r)}[${o}]`}};we.ValueScopeName=dn;var Mv=(0,be._)`\n`,xi=class extends pn{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Mv:be.nil}}get(){return this._scope}name(e){return new dn(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,be._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=be.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,ln.Started);let l=r(u);if(l){let p=this.opts.es5?we.varKinds.var:we.varKinds.const;s=(0,be._)`${s}${p} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,be._)`${s}${l}${this.opts._n}`;else throw new wi(u);c.set(u,ln.Completed)})}return s}};we.ValueScope=xi});var O=$(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var Z=Hr(),Me=Si(),pt=Hr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return pt._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return pt.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return pt.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return pt.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return pt.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return pt.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return pt.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return pt.Name}});var gn=Si();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return gn.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return gn.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return gn.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return gn.varKinds}});N.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var et=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},zi=class extends et{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?Me.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Kt(this.rhs,e,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},fn=class extends et{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Z.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Kt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return hn(e,this.rhs)}},ki=class extends fn{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Pi=class extends et{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Ei=class extends et{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Ti=class extends et{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Ri=class extends et{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Kt(this.code,e,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Gr=class extends et{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Dv(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>St(e,r.names),{})}},tt=class extends Gr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Ii=class extends Gr{},Gt=class extends tt{};Gt.kind="else";var wt=class t extends tt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Gt(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Bd(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Kt(this.condition,e,r),this}get names(){let e=super.names;return hn(e,this.condition),this.else&&St(e,this.else.names),e}};wt.kind="if";var xt=class extends tt{};xt.kind="for";var Oi=class extends xt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Kt(this.iteration,e,r),this}get names(){return St(super.names,this.iteration.names)}},Ni=class extends xt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?Me.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=hn(super.names,this.from);return hn(e,this.to)}},mn=class extends xt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Kt(this.iterable,e,r),this}get names(){return St(super.names,this.iterable.names)}},Kr=class extends tt{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Kr.kind="func";var Jr=class extends Gr{render(e){return"return "+super.render(e)}};Jr.kind="return";var ji=class extends tt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&St(e,this.catch.names),this.finally&&St(e,this.finally.names),e}},Wr=class extends tt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Wr.kind="catch";var Br=class extends tt{render(e){return"finally"+super.render(e)}};Br.kind="finally";var Ci=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=e,this._scope=new Me.Scope({parent:e}),this._nodes=[new Ii]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new zi(e,s,o)),s}const(e,r,o){return this._def(Me.varKinds.const,e,r,o)}let(e,r,o){return this._def(Me.varKinds.let,e,r,o)}var(e,r,o){return this._def(Me.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new fn(e,r,o))}add(e,r){return this._leafNode(new ki(e,N.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Z.nil&&this._leafNode(new Ri(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,n));return r.push("}"),new Z._Code(r)}if(e,r,o){if(this._blockNode(new wt(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new wt(e))}else(){return this._elseNode(new Gt)}endIf(){return this._endBlockNode(wt,Gt)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Oi(e),r)}forRange(e,r,o,n,s=this.opts.es5?Me.varKinds.var:Me.varKinds.let){let i=this._scope.toName(e);return this._for(new Ni(s,i,r,o),()=>n(i))}forOf(e,r,o,n=Me.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),o(s)})}return this._for(new mn("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?Me.varKinds.var:Me.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Z._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new mn("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(xt)}label(e){return this._leafNode(new Pi(e))}break(e){return this._leafNode(new Ei(e))}return(e){let r=new Jr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Jr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new ji;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Wr(s),r(s)}return o&&(this._currNode=n.finally=new Br,this.code(o)),this._endBlockNode(Wr,Br)}throw(e){return this._leafNode(new Ti(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Z.nil,o,n){return this._blockNode(new Kr(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Kr)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof wt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};N.CodeGen=Ci;function St(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function hn(t,e){return e instanceof Z._CodeOrName?St(t,e.names):t}function Kt(t,e,r){if(t instanceof Z.Name)return o(t);if(!n(t))return t;return new Z._Code(t._items.reduce((s,i)=>(i instanceof Z.Name&&(i=o(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Dv(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Bd(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Z._)`!${Ai(t)}`}N.not=Bd;var qv=Qd(N.operators.AND);function Lv(...t){return t.reduce(qv)}N.and=Lv;var Fv=Qd(N.operators.OR);function Uv(...t){return t.reduce(Fv)}N.or=Uv;function Qd(t){return(e,r)=>e===Z.nil?r:r===Z.nil?e:(0,Z._)`${Ai(e)} ${t} ${Ai(r)}`}function Ai(t){return t instanceof Z.Name?t:(0,Z._)`(${t})`}});var D=$(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});j.checkStrictMode=j.getErrorPath=j.Type=j.useFunc=j.setEvaluated=j.evaluatedPropsToName=j.mergeEvaluated=j.eachItem=j.unescapeJsonPointer=j.escapeJsonPointer=j.escapeFragment=j.unescapeFragment=j.schemaRefOrVal=j.schemaHasRulesButRef=j.schemaHasRules=j.checkUnknownRules=j.alwaysValidSchema=j.toHash=void 0;var H=O(),Vv=Hr();function Hv(t){let e={};for(let r of t)e[r]=!0;return e}j.toHash=Hv;function Gv(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(ef(t,e),!tf(e,t.self.RULES.all))}j.alwaysValidSchema=Gv;function ef(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||nf(t,`unknown keyword: "${s}"`)}j.checkUnknownRules=ef;function tf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}j.schemaHasRules=tf;function Kv(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}j.schemaHasRulesButRef=Kv;function Jv({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,H._)`${r}`}return(0,H._)`${t}${e}${(0,H.getProperty)(o)}`}j.schemaRefOrVal=Jv;function Wv(t){return rf(decodeURIComponent(t))}j.unescapeFragment=Wv;function Bv(t){return encodeURIComponent(Mi(t))}j.escapeFragment=Bv;function Mi(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}j.escapeJsonPointer=Mi;function rf(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}j.unescapeJsonPointer=rf;function Qv(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}j.eachItem=Qv;function Yd({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof H.Name?(s instanceof H.Name?t(n,s,i):e(n,s,i),i):s instanceof H.Name?(e(n,i,s),s):r(s,i);return a===H.Name&&!(c instanceof H.Name)?o(n,c):c}}j.mergeEvaluated={props:Yd({mergeNames:(t,e,r)=>t.if((0,H._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,H._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,H._)`${r} || {}`).code((0,H._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,H._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,H._)`${r} || {}`),Di(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:of}),items:Yd({mergeNames:(t,e,r)=>t.if((0,H._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,H._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,H._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,H._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function of(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,H._)`{}`);return e!==void 0&&Di(t,r,e),r}j.evaluatedPropsToName=of;function Di(t,e,r){Object.keys(r).forEach(o=>t.assign((0,H._)`${e}${(0,H.getProperty)(o)}`,!0))}j.setEvaluated=Di;var Xd={};function Yv(t,e){return t.scopeValue("func",{ref:e,code:Xd[e.code]||(Xd[e.code]=new Vv._Code(e.code))})}j.useFunc=Yv;var Zi;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Zi||(j.Type=Zi={}));function Xv(t,e,r){if(t instanceof H.Name){let o=e===Zi.Num;return r?o?(0,H._)`"[" + ${t} + "]"`:(0,H._)`"['" + ${t} + "']"`:o?(0,H._)`"/" + ${t}`:(0,H._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,H.getProperty)(t).toString():"/"+Mi(t)}j.getErrorPath=Xv;function nf(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}j.checkStrictMode=nf});var rt=$(qi=>{"use strict";Object.defineProperty(qi,"__esModule",{value:!0});var fe=O(),e$={data:new fe.Name("data"),valCxt:new fe.Name("valCxt"),instancePath:new fe.Name("instancePath"),parentData:new fe.Name("parentData"),parentDataProperty:new fe.Name("parentDataProperty"),rootData:new fe.Name("rootData"),dynamicAnchors:new fe.Name("dynamicAnchors"),vErrors:new fe.Name("vErrors"),errors:new fe.Name("errors"),this:new fe.Name("this"),self:new fe.Name("self"),scope:new fe.Name("scope"),json:new fe.Name("json"),jsonPos:new fe.Name("jsonPos"),jsonLen:new fe.Name("jsonLen"),jsonPart:new fe.Name("jsonPart")};qi.default=e$});var Qr=$(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.extendErrors=me.resetErrorsCount=me.reportExtraError=me.reportError=me.keyword$DataError=me.keywordError=void 0;var q=O(),_n=D(),ye=rt();me.keywordError={message:({keyword:t})=>(0,q.str)`must pass "${t}" keyword validation`};me.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,q.str)`"${t}" keyword must be ${e} ($data)`:(0,q.str)`"${t}" keyword is invalid ($data)`};function t$(t,e=me.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=cf(t,e,r);o??(i||a)?sf(s,c):af(n,(0,q._)`[${c}]`)}me.reportError=t$;function r$(t,e=me.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=cf(t,e,r);sf(n,a),s||i||af(o,ye.default.vErrors)}me.reportExtraError=r$;function o$(t,e){t.assign(ye.default.errors,e),t.if((0,q._)`${ye.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,q._)`${ye.default.vErrors}.length`,e),()=>t.assign(ye.default.vErrors,null)))}me.resetErrorsCount=o$;function n$({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ye.default.errors,a=>{t.const(i,(0,q._)`${ye.default.vErrors}[${a}]`),t.if((0,q._)`${i}.instancePath === undefined`,()=>t.assign((0,q._)`${i}.instancePath`,(0,q.strConcat)(ye.default.instancePath,s.errorPath))),t.assign((0,q._)`${i}.schemaPath`,(0,q.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,q._)`${i}.schema`,r),t.assign((0,q._)`${i}.data`,o))})}me.extendErrors=n$;function sf(t,e){let r=t.const("err",e);t.if((0,q._)`${ye.default.vErrors} === null`,()=>t.assign(ye.default.vErrors,(0,q._)`[${r}]`),(0,q._)`${ye.default.vErrors}.push(${r})`),t.code((0,q._)`${ye.default.errors}++`)}function af(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,q._)`new ${t.ValidationError}(${e})`):(r.assign((0,q._)`${o}.errors`,e),r.return(!1))}var zt={keyword:new q.Name("keyword"),schemaPath:new q.Name("schemaPath"),params:new q.Name("params"),propertyName:new q.Name("propertyName"),message:new q.Name("message"),schema:new q.Name("schema"),parentSchema:new q.Name("parentSchema")};function cf(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,q._)`{}`:s$(t,e,r)}function s$(t,e,r={}){let{gen:o,it:n}=t,s=[i$(n,r),a$(t,r)];return c$(t,e,s),o.object(...s)}function i$({errorPath:t},{instancePath:e}){let r=e?(0,q.str)`${t}${(0,_n.getErrorPath)(e,_n.Type.Str)}`:t;return[ye.default.instancePath,(0,q.strConcat)(ye.default.instancePath,r)]}function a$({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,q.str)`${e}/${t}`;return r&&(n=(0,q.str)`${n}${(0,_n.getErrorPath)(r,_n.Type.Str)}`),[zt.schemaPath,n]}function c$(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:p}=a;o.push([zt.keyword,n],[zt.params,typeof e=="function"?e(t):e||(0,q._)`{}`]),c.messages&&o.push([zt.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([zt.schema,i],[zt.parentSchema,(0,q._)`${l}${p}`],[ye.default.data,s]),u&&o.push([zt.propertyName,u])}});var lf=$(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.boolOrEmptySchema=Jt.topBoolOrEmptySchema=void 0;var u$=Qr(),l$=O(),p$=rt(),d$={message:"boolean schema is false"};function f$(t){let{gen:e,schema:r,validateName:o}=t;r===!1?uf(t,!1):typeof r=="object"&&r.$async===!0?e.return(p$.default.data):(e.assign((0,l$._)`${o}.errors`,null),e.return(!0))}Jt.topBoolOrEmptySchema=f$;function m$(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),uf(t)):r.var(e,!0)}Jt.boolOrEmptySchema=m$;function uf(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,u$.reportError)(n,d$,void 0,e)}});var Li=$(Wt=>{"use strict";Object.defineProperty(Wt,"__esModule",{value:!0});Wt.getRules=Wt.isJSONType=void 0;var h$=["string","number","integer","boolean","null","object","array"],g$=new Set(h$);function _$(t){return typeof t=="string"&&g$.has(t)}Wt.isJSONType=_$;function y$(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Wt.getRules=y$});var Fi=$(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.shouldUseRule=dt.shouldUseGroup=dt.schemaHasRulesForType=void 0;function v$({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&pf(t,o)}dt.schemaHasRulesForType=v$;function pf(t,e){return e.rules.some(r=>df(t,r))}dt.shouldUseGroup=pf;function df(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}dt.shouldUseRule=df});var Yr=$(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.reportTypeError=he.checkDataTypes=he.checkDataType=he.coerceAndCheckDataType=he.getJSONTypes=he.getSchemaTypes=he.DataType=void 0;var $$=Li(),b$=Fi(),w$=Qr(),I=O(),ff=D(),Bt;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Bt||(he.DataType=Bt={}));function x$(t){let e=mf(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}he.getSchemaTypes=x$;function mf(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every($$.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}he.getJSONTypes=mf;function S$(t,e){let{gen:r,data:o,opts:n}=t,s=z$(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,b$.schemaHasRulesForType)(t,e[0]));if(i){let a=Vi(e,o,n.strictNumbers,Bt.Wrong);r.if(a,()=>{s.length?k$(t,e,s):Hi(t)})}return i}he.coerceAndCheckDataType=S$;var hf=new Set(["string","number","integer","boolean","null"]);function z$(t,e){return e?t.filter(r=>hf.has(r)||e==="array"&&r==="array"):[]}function k$(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(Vi(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let u of r)(hf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Hi(t),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),P$(t,a)});function c(u){switch(u){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null
4
4
  || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,I._)`+${n}`);return;case"integer":o.elseIf((0,I._)`${i} === "boolean" || ${n} === null
5
5
  || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,I._)`+${n}`);return;case"boolean":o.elseIf((0,I._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,I._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,I._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,I._)`${i} === "string" || ${i} === "number"
6
- || ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function _$({gen:e,parentData:t,parentDataProperty:r},o){e.if((0,I._)`${t} !== undefined`,()=>e.assign((0,I._)`${t}[${r}]`,o))}function Mi(e,t,r,o=Ht.Correct){let n=o===Ht.Correct?I.operators.EQ:I.operators.NEQ,s;switch(e){case"null":return(0,I._)`${t} ${n} null`;case"array":s=(0,I._)`Array.isArray(${t})`;break;case"object":s=(0,I._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,I._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${t} ${n} ${e}`}return o===Ht.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${t} == "number"`,a,r?(0,I._)`isFinite(${t})`:I.nil)}}me.checkDataType=Mi;function qi(e,t,r,o){if(e.length===1)return Mi(e[0],t,r,o);let n,s=(0,rf.toHash)(e);if(s.array&&s.object){let i=(0,I._)`typeof ${t} != "object"`;n=s.null?i:(0,I._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,Mi(i,t,r,o));return n}me.checkDataTypes=qi;var y$={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,I._)`{type: ${e}}`:(0,I._)`{type: ${t}}`};function Di(e){let t=v$(e);(0,d$.reportError)(t,y$)}me.reportTypeError=Di;function v$(e){let{gen:t,data:r,schema:o}=e,n=(0,rf.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var af=$(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.assignDefaults=void 0;var Wt=O(),$$=q();function b$(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)sf(e,n,r[n].default);else t==="array"&&Array.isArray(o)&&o.forEach((n,s)=>sf(e,s,n.default))}dn.assignDefaults=b$;function sf(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=(0,Wt._)`${s}${(0,Wt.getProperty)(t)}`;if(n){(0,$$.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,Wt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Wt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Wt._)`${a} = ${(0,Wt.stringify)(r)}`)}});var je=$(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var B=O(),Li=q(),ft=rt(),w$=q();function z$(e,t){let{gen:r,data:o,it:n}=e;r.if(Ui(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,B._)`${t}`},!0),e.error()})}V.checkReportMissingProp=z$;function x$({gen:e,data:t,it:{opts:r}},o,n){return(0,B.or)(...o.map(s=>(0,B.and)(Ui(e,t,s,r.ownProperties),(0,B._)`${n} = ${s}`)))}V.checkMissingProp=x$;function S$(e,t){e.setParams({missingProperty:t},!0),e.error()}V.reportMissingProp=S$;function cf(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,B._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=cf;function Fi(e,t,r){return(0,B._)`${cf(e)}.call(${t}, ${r})`}V.isOwnProperty=Fi;function k$(e,t,r,o){let n=(0,B._)`${t}${(0,B.getProperty)(r)} !== undefined`;return o?(0,B._)`${n} && ${Fi(e,t,r)}`:n}V.propertyInData=k$;function Ui(e,t,r,o){let n=(0,B._)`${t}${(0,B.getProperty)(r)} === undefined`;return o?(0,B.or)(n,(0,B.not)(Fi(e,t,r))):n}V.noPropertyInData=Ui;function uf(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}V.allSchemaProperties=uf;function P$(e,t){return uf(t).filter(r=>!(0,Li.alwaysValidSchema)(e,t[r]))}V.schemaProperties=P$;function E$({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,B._)`${e}, ${t}, ${o}${n}`:t,p=[[ft.default.instancePath,(0,B.strConcat)(ft.default.instancePath,s)],[ft.default.parentData,i.parentData],[ft.default.parentDataProperty,i.parentDataProperty],[ft.default.rootData,ft.default.rootData]];i.opts.dynamicRef&&p.push([ft.default.dynamicAnchors,ft.default.dynamicAnchors]);let d=(0,B._)`${l}, ${r.object(...p)}`;return c!==B.nil?(0,B._)`${a}.call(${c}, ${d})`:(0,B._)`${a}(${d})`}V.callValidateCode=E$;var T$=(0,B._)`new RegExp`;function R$({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,B._)`${n.code==="new RegExp"?T$:(0,w$.useFunc)(e,n)}(${r}, ${o})`})}V.usePattern=R$;function I$(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,B._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:o,dataProp:u,dataPropType:Li.Type.Num},s),t.if((0,B.not)(s),a)})}}V.validateArray=I$;function O$(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Li.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,B._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,B.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}V.validateUnion=O$});var df=$(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.validateKeywordUsage=Je.validSchemaType=Je.funcKeywordCode=Je.macroKeywordCode=void 0;var ye=O(),kt=rt(),j$=je(),N$=Hr();function A$(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),c=pf(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:ye.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Je.macroKeywordCode=A$;function C$(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=e;M$(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=pf(o,n,u),p=o.let("valid");e.block$data(p,d),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function d(){if(t.errors===!1)_(),t.modifying&&lf(e),y(()=>e.error());else{let v=t.async?f():m();t.modifying&&lf(e),y(()=>Z$(e,v))}}function f(){let v=o.let("ruleErrs",null);return o.try(()=>_((0,ye._)`await `),P=>o.assign(p,!1).if((0,ye._)`${P} instanceof ${c.ValidationError}`,()=>o.assign(v,(0,ye._)`${P}.errors`),()=>o.throw(P))),v}function m(){let v=(0,ye._)`${l}.errors`;return o.assign(v,null),_(ye.nil),v}function _(v=t.async?(0,ye._)`await `:ye.nil){let P=c.opts.passContext?kt.default.this:kt.default.self,z=!("compile"in t&&!a||t.schema===!1);o.assign(p,(0,ye._)`${v}${(0,j$.callValidateCode)(e,l,P,z)}`,t.modifying)}function y(v){var P;o.if((0,ye.not)((P=t.valid)!==null&&P!==void 0?P:p),v)}}Je.funcKeywordCode=C$;function lf(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,(0,ye._)`${o.parentData}[${o.parentDataProperty}]`))}function Z$(e,t){let{gen:r}=e;r.if((0,ye._)`Array.isArray(${t})`,()=>{r.assign(kt.default.vErrors,(0,ye._)`${kt.default.vErrors} === null ? ${t} : ${kt.default.vErrors}.concat(${t})`).assign(kt.default.errors,(0,ye._)`${kt.default.vErrors}.length`),(0,N$.extendErrors)(e)},()=>e.error())}function M$({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function pf(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,ye.stringify)(r)})}function q$(e,t,r=!1){return!t.length||t.some(o=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}Je.validSchemaType=q$;function D$({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Je.validateKeywordUsage=D$});var mf=$(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.extendSubschemaMode=mt.extendSubschemaData=mt.getSubschema=void 0;var Ge=O(),ff=q();function L$(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Ge._)`${e.schemaPath}${(0,Ge.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Ge._)`${e.schemaPath}${(0,Ge.getProperty)(t)}${(0,Ge.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,ff.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}mt.getSubschema=L$;function F$(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:p}=t,d=a.let("data",(0,Ge._)`${t.data}${(0,Ge.getProperty)(r)}`,!0);c(d),e.errorPath=(0,Ge.str)`${u}${(0,ff.getErrorPath)(r,o,p.jsPropertySyntax)}`,e.parentDataProperty=(0,Ge._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let u=n instanceof Ge.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}mt.extendSubschemaData=F$;function U$(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(e.compositeRule=o),n!==void 0&&(e.createErrors=n),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}mt.extendSubschemaMode=U$});var Vi=$((TI,hf)=>{"use strict";hf.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var _f=$((RI,gf)=>{"use strict";var ht=gf.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};fn(t,o,n,e,"",e)};ht.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ht.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ht.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ht.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 fn(e,t,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,c,u);for(var l in o){var p=o[l];if(Array.isArray(p)){if(l in ht.arrayKeywords)for(var d=0;d<p.length;d++)fn(e,t,r,p[d],n+"/"+l+"/"+d,s,n,l,o,d)}else if(l in ht.propsKeywords){if(p&&typeof p=="object")for(var f in p)fn(e,t,r,p[f],n+"/"+l+"/"+V$(f),s,n,l,o,f)}else(l in ht.keywords||e.allKeys&&!(l in ht.skipKeywords))&&fn(e,t,r,p,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function V$(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Br=$(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getSchemaRefs=we.resolveUrl=we.normalizeId=we._getFullPath=we.getFullPath=we.inlineRef=void 0;var J$=q(),G$=Vi(),K$=_f(),H$=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function W$(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Ji(e):t?yf(e)<=t:!1}we.inlineRef=W$;var B$=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ji(e){for(let t in e){if(B$.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ji)||typeof r=="object"&&Ji(r))return!0}return!1}function yf(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!H$.has(r)&&(typeof e[r]=="object"&&(0,J$.eachItem)(e[r],o=>t+=yf(o)),t===1/0))return 1/0}return t}function vf(e,t="",r){r!==!1&&(t=Bt(t));let o=e.parse(t);return $f(e,o)}we.getFullPath=vf;function $f(e,t){return e.serialize(t).split("#")[0]+"#"}we._getFullPath=$f;var Q$=/#\/?$/;function Bt(e){return e?e.replace(Q$,""):""}we.normalizeId=Bt;function Y$(e,t,r){return r=Bt(r),e.resolve(t,r)}we.resolveUrl=Y$;var X$=/^[a-z_][-a-z0-9._]*$/i;function eb(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Bt(e[r]||t),s={"":n},i=vf(o,n,!1),a={},c=new Set;return K$(e,{allKeys:!0},(p,d,f,m)=>{if(m===void 0)return;let _=i+d,y=s[m];typeof p[r]=="string"&&(y=v.call(this,p[r])),P.call(this,p.$anchor),P.call(this,p.$dynamicAnchor),s[d]=y;function v(z){let k=this.opts.uriResolver.resolve;if(z=Bt(y?k(y,z):z),c.has(z))throw l(z);c.add(z);let w=this.refs[z];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?u(p,w.schema,z):z!==Bt(_)&&(z[0]==="#"?(u(p,a[z],z),a[z]=p):this.refs[z]=_),z}function P(z){if(typeof z=="string"){if(!X$.test(z))throw new Error(`invalid anchor "${z}"`);v.call(this,`#${z}`)}}}),a;function u(p,d,f){if(d!==void 0&&!G$(p,d))throw l(f)}function l(p){return new Error(`reference "${p}" resolves to more than one schema`)}}we.getSchemaRefs=eb});var Xr=$(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.getData=gt.KeywordCxt=gt.validateFunctionCode=void 0;var Sf=Xd(),bf=Wr(),Ki=Zi(),mn=Wr(),tb=af(),Yr=df(),Gi=mf(),S=O(),T=rt(),rb=Br(),ot=q(),Qr=Hr();function ob(e){if(Ef(e)&&(Tf(e),Pf(e))){ib(e);return}kf(e,()=>(0,Sf.topBoolOrEmptySchema)(e))}gt.validateFunctionCode=ob;function kf({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){n.code.es5?e.func(t,(0,S._)`${T.default.data}, ${T.default.valCxt}`,o.$async,()=>{e.code((0,S._)`"use strict"; ${wf(r,n)}`),sb(e,n),e.code(s)}):e.func(t,(0,S._)`${T.default.data}, ${nb(n)}`,o.$async,()=>e.code(wf(r,n)).code(s))}function nb(e){return(0,S._)`{${T.default.instancePath}="", ${T.default.parentData}, ${T.default.parentDataProperty}, ${T.default.rootData}=${T.default.data}${e.dynamicRef?(0,S._)`, ${T.default.dynamicAnchors}={}`:S.nil}}={}`}function sb(e,t){e.if(T.default.valCxt,()=>{e.var(T.default.instancePath,(0,S._)`${T.default.valCxt}.${T.default.instancePath}`),e.var(T.default.parentData,(0,S._)`${T.default.valCxt}.${T.default.parentData}`),e.var(T.default.parentDataProperty,(0,S._)`${T.default.valCxt}.${T.default.parentDataProperty}`),e.var(T.default.rootData,(0,S._)`${T.default.valCxt}.${T.default.rootData}`),t.dynamicRef&&e.var(T.default.dynamicAnchors,(0,S._)`${T.default.valCxt}.${T.default.dynamicAnchors}`)},()=>{e.var(T.default.instancePath,(0,S._)`""`),e.var(T.default.parentData,(0,S._)`undefined`),e.var(T.default.parentDataProperty,(0,S._)`undefined`),e.var(T.default.rootData,T.default.data),t.dynamicRef&&e.var(T.default.dynamicAnchors,(0,S._)`{}`)})}function ib(e){let{schema:t,opts:r,gen:o}=e;kf(e,()=>{r.$comment&&t.$comment&&If(e),pb(e),o.let(T.default.vErrors,null),o.let(T.default.errors,0),r.unevaluated&&ab(e),Rf(e),mb(e)})}function ab(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,S._)`${r}.evaluated`),t.if((0,S._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,S._)`${e.evaluated}.props`,(0,S._)`undefined`)),t.if((0,S._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,S._)`${e.evaluated}.items`,(0,S._)`undefined`))}function wf(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,S._)`/*# sourceURL=${r} */`:S.nil}function cb(e,t){if(Ef(e)&&(Tf(e),Pf(e))){ub(e,t);return}(0,Sf.boolOrEmptySchema)(e,t)}function Pf({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 Ef(e){return typeof e.schema!="boolean"}function ub(e,t){let{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&If(e),db(e),fb(e);let s=o.const("_errs",T.default.errors);Rf(e,s),o.var(t,(0,S._)`${s} === ${T.default.errors}`)}function Tf(e){(0,ot.checkUnknownRules)(e),lb(e)}function Rf(e,t){if(e.opts.jtd)return zf(e,[],!1,t);let r=(0,bf.getSchemaTypes)(e.schema),o=(0,bf.coerceAndCheckDataType)(e,r);zf(e,r,!o,t)}function lb(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,ot.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function pb(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ot.checkStrictMode)(e,"default is ignored in the schema root")}function db(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,rb.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function fb(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function If({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code((0,S._)`${T.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,S.str)`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,S._)`${T.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function mb(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;r.$async?t.if((0,S._)`${T.default.errors} === 0`,()=>t.return(T.default.data),()=>t.throw((0,S._)`new ${n}(${T.default.vErrors})`)):(t.assign((0,S._)`${o}.errors`,T.default.vErrors),s.unevaluated&&hb(e),t.return((0,S._)`${T.default.errors} === 0`))}function hb({gen:e,evaluated:t,props:r,items:o}){r instanceof S.Name&&e.assign((0,S._)`${t}.props`,r),o instanceof S.Name&&e.assign((0,S._)`${t}.items`,o)}function zf(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ot.schemaHasRulesButRef)(s,l))){n.block(()=>jf(e,"$ref",l.all.$ref.definition));return}c.jtd||gb(e,t),n.block(()=>{for(let d of l.rules)p(d);p(l.post)});function p(d){(0,Ki.shouldUseGroup)(s,d)&&(d.type?(n.if((0,mn.checkDataType)(d.type,i,c.strictNumbers)),xf(e,d),t.length===1&&t[0]===d.type&&r&&(n.else(),(0,mn.reportTypeError)(e)),n.endIf()):xf(e,d),a||n.if((0,S._)`${T.default.errors} === ${o||0}`))}}function xf(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;n&&(0,tb.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,Ki.shouldUseRule)(o,s)&&jf(e,s.keyword,s.definition,t.type)})}function gb(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(_b(e,t),e.opts.allowUnionTypes||yb(e,t),vb(e,e.dataTypes))}function _b(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Of(e.dataTypes,r)||Hi(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),bb(e,t)}}function yb(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Hi(e,"use allowUnionTypes to allow union type keyword")}function vb(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Ki.shouldUseRule)(e.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>$b(t,i))&&Hi(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function $b(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Of(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function bb(e,t){let r=[];for(let o of e.dataTypes)Of(t,o)?r.push(o):t.includes("integer")&&o==="number"&&r.push("integer");e.dataTypes=r}function Hi(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,ot.checkStrictMode)(e,t,e.opts.strictTypes)}var hn=class{constructor(t,r,o){if((0,Yr.validateKeywordUsage)(t,r,o),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=o,this.data=t.data,this.schema=t.schema[o],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ot.schemaRefOrVal)(t,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Nf(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Yr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",T.default.errors))}result(t,r,o){this.failResult((0,S.not)(t),r,o)}failResult(t,r,o){this.gen.if(t),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,S.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,S._)`${r} !== undefined && (${(0,S.or)(this.invalid$data(),t)})`)}error(t,r,o){if(r){this.setParams(r),this._error(t,o),this.setParams({});return}this._error(t,o)}_error(t,r){(t?Qr.reportExtraError:Qr.reportError)(this,this.def.error,r)}$dataError(){(0,Qr.reportError)(this,this.def.$dataError||Qr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Qr.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,o=S.nil){this.gen.block(()=>{this.check$data(t,o),r()})}check$data(t=S.nil,r=S.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,S.or)((0,S._)`${n} === undefined`,r)),t!==S.nil&&o.assign(t,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),t!==S.nil&&o.assign(t,!1)),o.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,S.or)(i(),a());function i(){if(o.length){if(!(r instanceof S.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,S._)`${(0,mn.checkDataTypes)(c,r,s.opts.strictNumbers,mn.DataType.Wrong)}`}return S.nil}function a(){if(n.validateSchema){let c=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,S._)`!${c}(${r})`}return S.nil}}subschema(t,r){let o=(0,Gi.getSubschema)(this.it,t);(0,Gi.extendSubschemaData)(o,this.it,t),(0,Gi.extendSubschemaMode)(o,t);let n={...this.it,...o,items:void 0,props:void 0};return cb(n,r),n}mergeEvaluated(t,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&t.props!==void 0&&(o.props=ot.mergeEvaluated.props(n,t.props,o.props,r)),o.items!==!0&&t.items!==void 0&&(o.items=ot.mergeEvaluated.items(n,t.items,o.items,r)))}mergeValidEvaluated(t,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,S.Name)),!0}};gt.KeywordCxt=hn;function jf(e,t,r,o){let n=new hn(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Yr.funcKeywordCode)(n,r):"macro"in r?(0,Yr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Yr.funcKeywordCode)(n,r)}var wb=/^\/(?:[^~]|~0|~1)*$/,zb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Nf(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return T.default.rootData;if(e[0]==="/"){if(!wb.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,s=T.default.rootData}else{let u=zb.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=t)throw new Error(c("property/index",l));return o[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,S._)`${s}${(0,S.getProperty)((0,ot.unescapeJsonPointer)(u))}`,i=(0,S._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}gt.getData=Nf});var gn=$(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var Wi=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Bi.default=Wi});var eo=$(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var Qi=Br(),Yi=class extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Qi.resolveUrl)(t,r,o),this.missingSchema=(0,Qi.normalizeId)((0,Qi.getFullPath)(t,this.missingRef))}};Xi.default=Yi});var yn=$(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.resolveSchema=Ne.getCompilingSchema=Ne.resolveRef=Ne.compileSchema=Ne.SchemaEnv=void 0;var Me=O(),xb=gn(),Pt=rt(),qe=Br(),Af=q(),Sb=Xr(),Qt=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let o;typeof t.schema=="object"&&(o=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,qe.normalizeId)(o?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=o?.$async,this.refs={}}};Ne.SchemaEnv=Qt;function ta(e){let t=Cf.call(this,e);if(t)return t;let r=(0,qe.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Me.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:xb.default,code:(0,Me._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Pt.default.data,parentData:Pt.default.parentData,parentDataProperty:Pt.default.parentDataProperty,dataNames:[Pt.default.data],dataPathArr:[Me.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Me.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Me.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Me._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Sb.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let p=i.toString();l=`${i.scopeRefs(Pt.default.scope)}return ${p}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Pt.default.self}`,`${Pt.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:p,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:_}=u;f.evaluated={props:m instanceof Me.Name?void 0:m,items:_ instanceof Me.Name?void 0:_,dynamicProps:m instanceof Me.Name,dynamicItems:_ instanceof Me.Name},f.source&&(f.source.evaluated=(0,Me.stringify)(f.evaluated))}return e.validate=f,e}catch(p){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),p}finally{this._compilations.delete(e)}}Ne.compileSchema=ta;function kb(e,t,r){var o;r=(0,qe.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=Tb.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Qt({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=Pb.call(this,s)}Ne.resolveRef=kb;function Pb(e){return(0,qe.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ta.call(this,e)}function Cf(e){for(let t of this._compilations)if(Eb(t,e))return t}Ne.getCompilingSchema=Cf;function Eb(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Tb(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||_n.call(this,e,t)}function _n(e,t){let r=this.opts.uriResolver.parse(t),o=(0,qe._getFullPath)(this.opts.uriResolver,r),n=(0,qe.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return ea.call(this,r,e);let s=(0,qe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=_n.call(this,e,i);return typeof a?.schema!="object"?void 0:ea.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ta.call(this,i),s===(0,qe.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,qe.resolveUrl)(this.opts.uriResolver,n,u)),new Qt({schema:a,schemaId:c,root:e,baseId:n})}return ea.call(this,r,i)}}Ne.resolveSchema=_n;var Rb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ea(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Af.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Rb.has(a)&&u&&(t=(0,qe.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Af.schemaHasRulesButRef)(r,this.RULES)){let a=(0,qe.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=_n.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Qt({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s}});var Zf=$((CI,Ib)=>{Ib.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 na=$((ZI,Uf)=>{"use strict";var Ob=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),qf=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),ra=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Df=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),jb=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function oa(e){let t="",r=0,o=0;for(o=0;o<e.length;o++)if(r=e[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Nb=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Mf(e){return e.length=0,!0}function Ab(e,t,r){if(e.length){let o=oa(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function Cb(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Ab;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=Mf}else{n.push(u);continue}}return n.length&&(a===Mf?r.zone=n.join(""):i?o.push(n.join("")):o.push(oa(n))),r.address=o.join(""),r}function Lf(e){if(Zb(e,":")<2)return{host:e,isIPV6:!1};let t=Cb(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,o=t.address;return t.zone&&(r+="%"+t.zone,o+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:o}}}function Zb(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}function Mb(e){let t=e,r=[],o=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(n===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var qb={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Db=/[@/?#:]/g,Lb=/[@/?#]/g;function Ff(e,t){let r=t?Lb:Db;return r.lastIndex=0,e.replace(r,o=>qb[o])}function Fb(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(ra(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&Df(i)?r+=i:r+="%"+s,o+=2;continue}}r+=e[o]}return r}function Ub(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(ra(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&Df(s)?t+=s:t+="%"+n,r+=2;continue}}jb(e[r])?t+=e[r]:t+=escape(e[r])}return t}function Vb(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(ra(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Jb(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!qf(r)){let o=Lf(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=Ff(r,!1)}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}Uf.exports={nonSimpleDomain:Nb,recomposeAuthority:Jb,reescapeHostDelimiters:Ff,normalizePercentEncoding:Fb,normalizePathEncoding:Ub,escapePreservingEscapes:Vb,removeDotSegments:Mb,isIPv4:qf,isUUID:Ob,normalizeIPv6:Lf,stringArrayToHexStripped:oa}});var Hf=$((MI,Kf)=>{"use strict";var{isUUID:Gb}=na(),Kb=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Hb=["http","https","ws","wss","urn","urn:uuid"];function Wb(e){return Hb.indexOf(e)!==-1}function sa(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 Vf(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Jf(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 Bb(e){return e.secure=sa(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Qb(e){if((e.port===(sa(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Yb(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Kb);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=ia(n);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Xb(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=ia(n);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function e0(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Gb(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function t0(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Gf={scheme:"http",domainHost:!0,parse:Vf,serialize:Jf},r0={scheme:"https",domainHost:Gf.domainHost,parse:Vf,serialize:Jf},vn={scheme:"ws",domainHost:!0,parse:Bb,serialize:Qb},o0={scheme:"wss",domainHost:vn.domainHost,parse:vn.parse,serialize:vn.serialize},n0={scheme:"urn",parse:Yb,serialize:Xb,skipNormalize:!0},s0={scheme:"urn:uuid",parse:e0,serialize:t0,skipNormalize:!0},$n={http:Gf,https:r0,ws:vn,wss:o0,urn:n0,"urn:uuid":s0};Object.setPrototypeOf($n,null);function ia(e){return e&&($n[e]||$n[e.toLowerCase()])||void 0}Kf.exports={wsIsSecure:sa,SCHEMES:$n,isValidSchemeName:Wb,getSchemeHandler:ia}});var em=$((qI,bn)=>{"use strict";var{normalizeIPv6:i0,removeDotSegments:to,recomposeAuthority:a0,normalizePercentEncoding:c0,normalizePathEncoding:u0,escapePreservingEscapes:l0,reescapeHostDelimiters:p0,isIPv4:d0,nonSimpleDomain:f0}=na(),{SCHEMES:m0,getSchemeHandler:Bf}=Hf();function h0(e,t){return typeof e=="string"?e=$0(e,t):typeof e=="object"&&(e=Yt(Et(e,t),t)),e}function g0(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=Qf(Yt(e,o),Yt(t,o),o,!0);return o.skipEscape=!0,Et(n,o)}function Qf(e,t,r,o){let n={};return o||(e=Yt(Et(e,r),r),t=Yt(Et(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=to(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=to(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=to(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=to(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function _0(e,t,r){let o=Wf(e,r),n=Wf(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Et(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],s=Bf(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=c0(r.path):(r.path=l0(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=a0(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=to(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var y0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function v0(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 Yf(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(y0);if(i){o.scheme=i[1],o.userinfo=i[3],o.host=i[4],o.port=parseInt(i[5],10),o.path=i[6]||"",o.query=i[7],o.fragment=i[8],isNaN(o.port)&&(o.port=i[5]);let a=v0(o,i);if(a!==void 0&&(o.error=o.error||a,n=!0),o.host)if(d0(o.host)===!1){let l=i0(o.host);o.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let c=Bf(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&o.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&f0(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(e.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=p0(unescape(o.host),s))),o.path&&(o.path=u0(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}c&&c.parse&&c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function Yt(e,t){return Yf(e,t).parsed}function $0(e,t){return Xf(e,t).normalized}function Xf(e,t){let{parsed:r,malformedAuthorityOrPort:o}=Yf(e,t);return{normalized:o?e:Et(r,t),malformedAuthorityOrPort:o}}function Wf(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:o}=Xf(e,t);return o?void 0:r}if(typeof e=="object")return Et(e,t)}var aa={SCHEMES:m0,normalize:h0,resolve:g0,resolveComponent:Qf,equal:_0,serialize:Et,parse:Yt};bn.exports=aa;bn.exports.default=aa;bn.exports.fastUri=aa});var rm=$(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var tm=em();tm.code='require("ajv/dist/runtime/uri").default';ca.default=tm});var lm=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var b0=Xr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return b0.KeywordCxt}});var Xt=O();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Xt._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Xt.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Xt.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Xt.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Xt.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return Xt.CodeGen}});var w0=gn(),am=eo(),z0=Ci(),ro=yn(),x0=O(),oo=Br(),wn=Wr(),la=q(),om=Zf(),S0=rm(),cm=(e,t)=>new RegExp(e,t);cm.code="new RegExp";var k0=["removeAdditional","useDefaults","coerceTypes"],P0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),E0={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."},T0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},nm=200;function R0(e){var t,r,o,n,s,i,a,c,u,l,p,d,f,m,_,y,v,P,z,k,w,xe,Ee,lr,ts;let pr=e.strict,rs=(t=e.code)===null||t===void 0?void 0:t.optimize,$c=rs===!0||rs===void 0?1:rs||0,bc=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:cm,Gh=(n=e.uriResolver)!==null&&n!==void 0?n:S0.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:pr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:pr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:pr)!==null&&l!==void 0?l:"log",strictTuples:(d=(p=e.strictTuples)!==null&&p!==void 0?p:pr)!==null&&d!==void 0?d:"log",strictRequired:(m=(f=e.strictRequired)!==null&&f!==void 0?f:pr)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:$c,regExp:bc}:{optimize:$c,regExp:bc},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:nm,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:nm,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(z=e.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(k=e.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(w=e.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(xe=e.validateSchema)!==null&&xe!==void 0?xe:!0,validateFormats:(Ee=e.validateFormats)!==null&&Ee!==void 0?Ee:!0,unicodeRegExp:(lr=e.unicodeRegExp)!==null&&lr!==void 0?lr:!0,int32range:(ts=e.int32range)!==null&&ts!==void 0?ts:!0,uriResolver:Gh}}var no=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,...R0(t)};let{es5:r,lines:o}=this.opts.code;this.scope=new x0.ValueScope({scope:{},prefixes:P0,es5:r,lines:o}),this.logger=C0(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,z0.getRules)(),sm.call(this,E0,t,"NOT SUPPORTED"),sm.call(this,T0,t,"DEPRECATED","warn"),this._metaOpts=N0.call(this),t.formats&&O0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&j0.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),I0.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:o}=this.opts,n=om;o==="id"&&(n={...om},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let o;if(typeof t=="string"){if(o=this.getSchema(t),!o)throw new Error(`no schema with key or ref "${t}"`)}else o=this.compile(t);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(t,r){let o=this._addSchema(t,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,t,r);async function n(l,p){await s.call(this,l.$schema);let d=this._addSchema(l,p);return d.validate||i.call(this,d)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(p){if(!(p instanceof am.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:p}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${p} cannot be resolved`)}async function c(l){let p=await u.call(this,l);this.refs[l]||await s.call(this,p.$schema),this.refs[l]||this.addSchema(p,l,r)}async function u(l){let p=this._loading[l];if(p)return p;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(t,r,o,n=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,o,n);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,oo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,o,r,n,!0),this}addMetaSchema(t,r,o=this.opts.validateSchema){return this.addSchema(t,r,!0,o),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let o;if(o=t.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,t);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(t){let r;for(;typeof(r=im.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:o}=this.opts,n=new ro.SchemaEnv({schema:{},schemaId:o});if(r=ro.resolveSchema.call(this,n,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=im.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let o=t[this.opts.schemaId];return o&&(o=(0,oo.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let o;if(typeof t=="string")o=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof t=="object"&&r===void 0){if(r=t,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(M0.call(this,o,r),!r)return(0,la.eachItem)(o,s=>ua.call(this,s)),this;D0.call(this,r);let n={...r,type:(0,wn.getJSONTypes)(r.type),schemaType:(0,wn.getJSONTypes)(r.schemaType)};return(0,la.eachItem)(o,n.type.length===0?s=>ua.call(this,s,n):s=>n.type.forEach(i=>ua.call(this,s,n,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===t);n>=0&&o.rules.splice(n,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(t,r){let o=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let s=n.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=um(l))}}return t}_removeAllSchemas(t,r){for(let o in t){let n=t[o];(!r||r.test(o))&&(typeof n=="string"?delete t[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[o]))}}_addSchema(t,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;o=(0,oo.normalizeId)(i||o);let u=oo.getSchemaRefs.call(this,t,o);return c=new ro.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):ro.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{ro.compileSchema.call(this,t)}finally{this.opts=r}}};no.ValidationError=w0.default;no.MissingRefError=am.default;le.default=no;function sm(e,t,r,o="error"){for(let n in e){let s=n;s in t&&this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function im(e){return e=(0,oo.normalizeId)(e),this.schemas[e]||this.refs[e]}function I0(){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 O0(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function j0(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function N0(){let e={...this.opts};for(let t of k0)delete e[t];return e}var A0={log(){},warn(){},error(){}};function C0(e){if(e===!1)return A0;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 Z0=/^[a-z_$][a-z0-9_$:-]*$/i;function M0(e,t){let{RULES:r}=this;if((0,la.eachItem)(e,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Z0.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function ua(e,t,r){var o;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,wn.getJSONTypes)(t.type),schemaType:(0,wn.getJSONTypes)(t.schemaType)}};t.before?q0.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function q0(e,t,r){let o=e.rules.findIndex(n=>n.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function D0(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=um(t)),e.validateSchema=this.compile(t,!0))}var L0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function um(e){return{anyOf:[e,L0]}}});var pm=$(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var F0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};pa.default=F0});var hm=$(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.callRef=Tt.getValidate=void 0;var U0=eo(),dm=je(),ze=O(),er=rt(),fm=yn(),zn=q(),V0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return p();let l=fm.resolveRef.call(c,u,n,r);if(l===void 0)throw new U0.default(o.opts.uriResolver,n,r);if(l instanceof fm.SchemaEnv)return d(l);return f(l);function p(){if(s===u)return xn(e,i,s,s.$async);let m=t.scopeValue("root",{ref:u});return xn(e,(0,ze._)`${m}.validate`,u,u.$async)}function d(m){let _=mm(e,m);xn(e,_,m,m.$async)}function f(m){let _=t.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,ze.stringify)(m)}:{ref:m}),y=t.name("valid"),v=e.subschema({schema:m,dataTypes:[],schemaPath:ze.nil,topSchemaRef:_,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function mm(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,ze._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Tt.getValidate=mm;function xn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?er.default.this:ze.nil;o?l():p();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,ze._)`await ${(0,dm.callValidateCode)(e,t,u)}`),f(t),i||n.assign(m,!0)},_=>{n.if((0,ze._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),d(_),i||n.assign(m,!1)}),e.ok(m)}function p(){e.result((0,dm.callValidateCode)(e,t,u),()=>f(t),()=>d(t))}function d(m){let _=(0,ze._)`${m}.errors`;n.assign(er.default.vErrors,(0,ze._)`${er.default.vErrors} === null ? ${_} : ${er.default.vErrors}.concat(${_})`),n.assign(er.default.errors,(0,ze._)`${er.default.vErrors}.length`)}function f(m){var _;if(!s.opts.unevaluated)return;let y=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=zn.mergeEvaluated.props(n,y.props,s.props));else{let v=n.var("props",(0,ze._)`${m}.evaluated.props`);s.props=zn.mergeEvaluated.props(n,v,s.props,ze.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=zn.mergeEvaluated.items(n,y.items,s.items));else{let v=n.var("items",(0,ze._)`${m}.evaluated.items`);s.items=zn.mergeEvaluated.items(n,v,s.items,ze.Name)}}}Tt.callRef=xn;Tt.default=V0});var gm=$(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var J0=pm(),G0=hm(),K0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",J0.default,G0.default];da.default=K0});var _m=$(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var Sn=O(),_t=Sn.operators,kn={maximum:{okStr:"<=",ok:_t.LTE,fail:_t.GT},minimum:{okStr:">=",ok:_t.GTE,fail:_t.LT},exclusiveMaximum:{okStr:"<",ok:_t.LT,fail:_t.GTE},exclusiveMinimum:{okStr:">",ok:_t.GT,fail:_t.LTE}},H0={message:({keyword:e,schemaCode:t})=>(0,Sn.str)`must be ${kn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Sn._)`{comparison: ${kn[e].okStr}, limit: ${t}}`},W0={keyword:Object.keys(kn),type:"number",schemaType:"number",$data:!0,error:H0,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data((0,Sn._)`${r} ${kn[t].fail} ${o} || isNaN(${r})`)}};fa.default=W0});var ym=$(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var so=O(),B0={message:({schemaCode:e})=>(0,so.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,so._)`{multipleOf: ${e}}`},Q0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:B0,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.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._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};ma.default=Q0});var $m=$(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});function vm(e){let t=e.length,r=0,o=0,n;for(;o<t;)r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t&&(n=e.charCodeAt(o),(n&64512)===56320&&o++);return r}ha.default=vm;vm.code='require("ajv/dist/runtime/ucs2length").default'});var bm=$(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var Rt=O(),Y0=q(),X0=$m(),ew={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Rt.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Rt._)`{limit: ${e}}`},tw={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ew,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Rt.operators.GT:Rt.operators.LT,i=n.opts.unicode===!1?(0,Rt._)`${r}.length`:(0,Rt._)`${(0,Y0.useFunc)(e.gen,X0.default)}(${r})`;e.fail$data((0,Rt._)`${i} ${s} ${o}`)}};ga.default=tw});var wm=$(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var rw=je(),ow=q(),tr=O(),nw={message:({schemaCode:e})=>(0,tr.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,tr._)`{pattern: ${e}}`},sw={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:nw,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,tr._)`new RegExp`:(0,ow.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,tr._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,tr._)`!${l}`)}else{let c=(0,rw.usePattern)(e,n);e.fail$data((0,tr._)`!${c}.test(${r})`)}}};_a.default=sw});var zm=$(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var io=O(),iw={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,io.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,io._)`{limit: ${e}}`},aw={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:iw,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?io.operators.GT:io.operators.LT;e.fail$data((0,io._)`Object.keys(${r}).length ${n} ${o}`)}};ya.default=aw});var xm=$(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var ao=je(),co=O(),cw=q(),uw={message:({params:{missingProperty:e}})=>(0,co.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,co._)`{missingProperty: ${e}}`},lw={keyword:"required",type:"object",schemaType:"array",$data:!0,error:uw,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:m}=e.it;for(let _ of r)if(f?.[_]===void 0&&!m.has(_)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,cw.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(co.nil,p);else for(let f of r)(0,ao.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let m=t.let("valid",!0);e.block$data(m,()=>d(f,m)),e.ok(m)}else t.if((0,ao.checkMissingProp)(e,r,f)),(0,ao.reportMissingProp)(e,f),t.else()}function p(){t.forOf("prop",o,f=>{e.setParams({missingProperty:f}),t.if((0,ao.noPropertyInData)(t,n,f,a.ownProperties),()=>e.error())})}function d(f,m){e.setParams({missingProperty:f}),t.forOf(f,o,()=>{t.assign(m,(0,ao.propertyInData)(t,n,f,a.ownProperties)),t.if((0,co.not)(m),()=>{e.error(),t.break()})},co.nil)}}};va.default=lw});var Sm=$($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var uo=O(),pw={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,uo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,uo._)`{limit: ${e}}`},dw={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:pw,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?uo.operators.GT:uo.operators.LT;e.fail$data((0,uo._)`${r}.length ${n} ${o}`)}};$a.default=dw});var Pn=$(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var km=Vi();km.code='require("ajv/dist/runtime/equal").default';ba.default=km});var Pm=$(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var wa=Wr(),pe=O(),fw=q(),mw=Pn(),hw={message:({params:{i:e,j:t}})=>(0,pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,pe._)`{i: ${e}, j: ${t}}`},gw={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:hw,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let c=t.let("valid"),u=s.items?(0,wa.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,pe._)`${i} === false`),e.ok(c);function l(){let m=t.let("i",(0,pe._)`${r}.length`),_=t.let("j");e.setParams({i:m,j:_}),t.assign(c,!0),t.if((0,pe._)`${m} > 1`,()=>(p()?d:f)(m,_))}function p(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function d(m,_){let y=t.name("item"),v=(0,wa.checkDataTypes)(u,y,a.opts.strictNumbers,wa.DataType.Wrong),P=t.const("indices",(0,pe._)`{}`);t.for((0,pe._)`;${m}--;`,()=>{t.let(y,(0,pe._)`${r}[${m}]`),t.if(v,(0,pe._)`continue`),u.length>1&&t.if((0,pe._)`typeof ${y} == "string"`,(0,pe._)`${y} += "_"`),t.if((0,pe._)`typeof ${P}[${y}] == "number"`,()=>{t.assign(_,(0,pe._)`${P}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,pe._)`${P}[${y}] = ${m}`)})}function f(m,_){let y=(0,fw.useFunc)(t,mw.default),v=t.name("outer");t.label(v).for((0,pe._)`;${m}--;`,()=>t.for((0,pe._)`${_} = ${m}; ${_}--;`,()=>t.if((0,pe._)`${y}(${r}[${m}], ${r}[${_}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};za.default=gw});var Em=$(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var xa=O(),_w=q(),yw=Pn(),vw={message:"must be equal to constant",params:({schemaCode:e})=>(0,xa._)`{allowedValue: ${e}}`},$w={keyword:"const",$data:!0,error:vw,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;o||s&&typeof s=="object"?e.fail$data((0,xa._)`!${(0,_w.useFunc)(t,yw.default)}(${r}, ${n})`):e.fail((0,xa._)`${s} !== ${r}`)}};Sa.default=$w});var Tm=$(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var lo=O(),bw=q(),ww=Pn(),zw={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,lo._)`{allowedValues: ${e}}`},xw={keyword:"enum",schemaType:"array",$data:!0,error:zw,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,bw.useFunc)(t,ww.default)),l;if(a||o)l=t.let("valid"),e.block$data(l,p);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,lo.or)(...n.map((m,_)=>d(f,_)))}e.pass(l);function p(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,lo._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function d(f,m){let _=n[m];return typeof _=="object"&&_!==null?(0,lo._)`${u()}(${r}, ${f}[${m}])`:(0,lo._)`${r} === ${_}`}}};ka.default=xw});var Rm=$(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var Sw=_m(),kw=ym(),Pw=bm(),Ew=wm(),Tw=zm(),Rw=xm(),Iw=Sm(),Ow=Pm(),jw=Em(),Nw=Tm(),Aw=[Sw.default,kw.default,Pw.default,Ew.default,Tw.default,Rw.default,Iw.default,Ow.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},jw.default,Nw.default];Pa.default=Aw});var Ta=$(po=>{"use strict";Object.defineProperty(po,"__esModule",{value:!0});po.validateAdditionalItems=void 0;var It=O(),Ea=q(),Cw={message:({params:{len:e}})=>(0,It.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,It._)`{limit: ${e}}`},Zw={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Cw,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,Ea.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Im(e,o)}};function Im(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,It._)`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass((0,It._)`${a} <= ${t.length}`);else if(typeof o=="object"&&!(0,Ea.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,It._)`${a} <= ${t.length}`);r.if((0,It.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:Ea.Type.Num},u),i.allErrors||r.if((0,It.not)(u),()=>r.break())})}}po.validateAdditionalItems=Im;po.default=Zw});var Ra=$(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.validateTuple=void 0;var Om=O(),En=q(),Mw=je(),qw={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return jm(e,"additionalItems",t);r.items=!0,!(0,En.alwaysValidSchema)(r,t)&&e.ok((0,Mw.validateArray)(e))}};function jm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=En.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Om._)`${s}.length`);r.forEach((p,d)=>{(0,En.alwaysValidSchema)(a,p)||(o.if((0,Om._)`${u} > ${d}`,()=>e.subschema({keyword:i,schemaProp:d,dataProp:d},c)),e.ok(c))});function l(p){let{opts:d,errSchemaPath:f}=a,m=r.length,_=m===p.minItems&&(m===p.maxItems||p[t]===!1);if(d.strictTuples&&!_){let y=`"${i}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,En.checkStrictMode)(a,y,d.strictTuples)}}}fo.validateTuple=jm;fo.default=qw});var Nm=$(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var Dw=Ra(),Lw={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,Dw.validateTuple)(e,"items")};Ia.default=Lw});var Cm=$(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Am=O(),Fw=q(),Uw=je(),Vw=Ta(),Jw={message:({params:{len:e}})=>(0,Am.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Am._)`{limit: ${e}}`},Gw={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Jw,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;o.items=!0,!(0,Fw.alwaysValidSchema)(o,t)&&(n?(0,Vw.validateAdditionalItems)(e,n):e.ok((0,Uw.validateArray)(e)))}};Oa.default=Gw});var Zm=$(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var Ae=O(),Tn=q(),Kw={message:({params:{min:e,max:t}})=>t===void 0?(0,Ae.str)`must contain at least ${e} valid item(s)`:(0,Ae.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Ae._)`{minContains: ${e}}`:(0,Ae._)`{minContains: ${e}, maxContains: ${t}}`},Hw={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Kw,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,Ae._)`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Tn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Tn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Tn.alwaysValidSchema)(s,r)){let _=(0,Ae._)`${l} >= ${i}`;a!==void 0&&(_=(0,Ae._)`${_} && ${l} <= ${a}`),e.pass(_);return}s.items=!0;let p=t.name("valid");a===void 0&&i===1?f(p,()=>t.if(p,()=>t.break())):i===0?(t.let(p,!0),a!==void 0&&t.if((0,Ae._)`${n}.length > 0`,d)):(t.let(p,!1),d()),e.result(p,()=>e.reset());function d(){let _=t.name("_valid"),y=t.let("count",0);f(_,()=>t.if(_,()=>m(y)))}function f(_,y){t.forRange("i",0,l,v=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Tn.Type.Num,compositeRule:!0},_),y()})}function m(_){t.code((0,Ae._)`${_}++`),a===void 0?t.if((0,Ae._)`${_} >= ${i}`,()=>t.assign(p,!0).break()):(t.if((0,Ae._)`${_} > ${a}`,()=>t.assign(p,!1).break()),i===1?t.assign(p,!0):t.if((0,Ae._)`${_} >= ${i}`,()=>t.assign(p,!0)))}}};ja.default=Hw});var Dm=$(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateSchemaDeps=Ke.validatePropertyDeps=Ke.error=void 0;var Na=O(),Ww=q(),mo=je();Ke.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return(0,Na.str)`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>(0,Na._)`{property: ${e},
6
+ || ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function P$({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,I._)`${e} !== undefined`,()=>t.assign((0,I._)`${e}[${r}]`,o))}function Ui(t,e,r,o=Bt.Correct){let n=o===Bt.Correct?I.operators.EQ:I.operators.NEQ,s;switch(t){case"null":return(0,I._)`${e} ${n} null`;case"array":s=(0,I._)`Array.isArray(${e})`;break;case"object":s=(0,I._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,I._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${e} ${n} ${t}`}return o===Bt.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${e} == "number"`,a,r?(0,I._)`isFinite(${e})`:I.nil)}}he.checkDataType=Ui;function Vi(t,e,r,o){if(t.length===1)return Ui(t[0],e,r,o);let n,s=(0,ff.toHash)(t);if(s.array&&s.object){let i=(0,I._)`typeof ${e} != "object"`;n=s.null?i:(0,I._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,Ui(i,e,r,o));return n}he.checkDataTypes=Vi;var E$={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,I._)`{type: ${t}}`:(0,I._)`{type: ${e}}`};function Hi(t){let e=T$(t);(0,w$.reportError)(e,E$)}he.reportTypeError=Hi;function T$(t){let{gen:e,data:r,schema:o}=t,n=(0,ff.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var _f=$(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.assignDefaults=void 0;var Qt=O(),R$=D();function I$(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)gf(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>gf(t,s,n.default))}yn.assignDefaults=I$;function gf(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Qt._)`${s}${(0,Qt.getProperty)(e)}`;if(n){(0,R$.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Qt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Qt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Qt._)`${a} = ${(0,Qt.stringify)(r)}`)}});var je=$(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var B=O(),Gi=D(),ft=rt(),O$=D();function N$(t,e){let{gen:r,data:o,it:n}=t;r.if(Ji(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,B._)`${e}`},!0),t.error()})}V.checkReportMissingProp=N$;function j$({gen:t,data:e,it:{opts:r}},o,n){return(0,B.or)(...o.map(s=>(0,B.and)(Ji(t,e,s,r.ownProperties),(0,B._)`${n} = ${s}`)))}V.checkMissingProp=j$;function C$(t,e){t.setParams({missingProperty:e},!0),t.error()}V.reportMissingProp=C$;function yf(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,B._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=yf;function Ki(t,e,r){return(0,B._)`${yf(t)}.call(${e}, ${r})`}V.isOwnProperty=Ki;function A$(t,e,r,o){let n=(0,B._)`${e}${(0,B.getProperty)(r)} !== undefined`;return o?(0,B._)`${n} && ${Ki(t,e,r)}`:n}V.propertyInData=A$;function Ji(t,e,r,o){let n=(0,B._)`${e}${(0,B.getProperty)(r)} === undefined`;return o?(0,B.or)(n,(0,B.not)(Ki(t,e,r))):n}V.noPropertyInData=Ji;function vf(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}V.allSchemaProperties=vf;function Z$(t,e){return vf(e).filter(r=>!(0,Gi.alwaysValidSchema)(t,e[r]))}V.schemaProperties=Z$;function M$({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,B._)`${t}, ${e}, ${o}${n}`:e,p=[[ft.default.instancePath,(0,B.strConcat)(ft.default.instancePath,s)],[ft.default.parentData,i.parentData],[ft.default.parentDataProperty,i.parentDataProperty],[ft.default.rootData,ft.default.rootData]];i.opts.dynamicRef&&p.push([ft.default.dynamicAnchors,ft.default.dynamicAnchors]);let d=(0,B._)`${l}, ${r.object(...p)}`;return c!==B.nil?(0,B._)`${a}.call(${c}, ${d})`:(0,B._)`${a}(${d})`}V.callValidateCode=M$;var D$=(0,B._)`new RegExp`;function q$({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,B._)`${n.code==="new RegExp"?D$:(0,O$.useFunc)(t,n)}(${r}, ${o})`})}V.usePattern=q$;function L$(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,B._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:Gi.Type.Num},s),e.if((0,B.not)(s),a)})}}V.validateArray=L$;function F$(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Gi.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,B._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,B.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}V.validateUnion=F$});var wf=$(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.validateKeywordUsage=He.validSchemaType=He.funcKeywordCode=He.macroKeywordCode=void 0;var ve=O(),kt=rt(),U$=je(),V$=Qr();function H$(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=bf(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ve.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}He.macroKeywordCode=H$;function G$(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;J$(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=bf(o,n,u),p=o.let("valid");t.block$data(p,d),t.ok((r=e.valid)!==null&&r!==void 0?r:p);function d(){if(e.errors===!1)_(),e.modifying&&$f(t),y(()=>t.error());else{let v=e.async?f():m();e.modifying&&$f(t),y(()=>K$(t,v))}}function f(){let v=o.let("ruleErrs",null);return o.try(()=>_((0,ve._)`await `),P=>o.assign(p,!1).if((0,ve._)`${P} instanceof ${c.ValidationError}`,()=>o.assign(v,(0,ve._)`${P}.errors`),()=>o.throw(P))),v}function m(){let v=(0,ve._)`${l}.errors`;return o.assign(v,null),_(ve.nil),v}function _(v=e.async?(0,ve._)`await `:ve.nil){let P=c.opts.passContext?kt.default.this:kt.default.self,w=!("compile"in e&&!a||e.schema===!1);o.assign(p,(0,ve._)`${v}${(0,U$.callValidateCode)(t,l,P,w)}`,e.modifying)}function y(v){var P;o.if((0,ve.not)((P=e.valid)!==null&&P!==void 0?P:p),v)}}He.funcKeywordCode=G$;function $f(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ve._)`${o.parentData}[${o.parentDataProperty}]`))}function K$(t,e){let{gen:r}=t;r.if((0,ve._)`Array.isArray(${e})`,()=>{r.assign(kt.default.vErrors,(0,ve._)`${kt.default.vErrors} === null ? ${e} : ${kt.default.vErrors}.concat(${e})`).assign(kt.default.errors,(0,ve._)`${kt.default.vErrors}.length`),(0,V$.extendErrors)(t)},()=>t.error())}function J$({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function bf(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ve.stringify)(r)})}function W$(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}He.validSchemaType=W$;function B$({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}He.validateKeywordUsage=B$});var Sf=$(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.extendSubschemaMode=mt.extendSubschemaData=mt.getSubschema=void 0;var Ge=O(),xf=D();function Q$(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ge._)`${t.schemaPath}${(0,Ge.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ge._)`${t.schemaPath}${(0,Ge.getProperty)(e)}${(0,Ge.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,xf.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}mt.getSubschema=Q$;function Y$(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:p}=e,d=a.let("data",(0,Ge._)`${e.data}${(0,Ge.getProperty)(r)}`,!0);c(d),t.errorPath=(0,Ge.str)`${u}${(0,xf.getErrorPath)(r,o,p.jsPropertySyntax)}`,t.parentDataProperty=(0,Ge._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Ge.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}mt.extendSubschemaData=Y$;function X$(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}mt.extendSubschemaMode=X$});var Wi=$((YI,zf)=>{"use strict";zf.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Pf=$((XI,kf)=>{"use strict";var ht=kf.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};vn(e,o,n,t,"",t)};ht.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ht.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ht.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ht.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 vn(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var p=o[l];if(Array.isArray(p)){if(l in ht.arrayKeywords)for(var d=0;d<p.length;d++)vn(t,e,r,p[d],n+"/"+l+"/"+d,s,n,l,o,d)}else if(l in ht.propsKeywords){if(p&&typeof p=="object")for(var f in p)vn(t,e,r,p[f],n+"/"+l+"/"+eb(f),s,n,l,o,f)}else(l in ht.keywords||t.allKeys&&!(l in ht.skipKeywords))&&vn(t,e,r,p,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function eb(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Xr=$(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.getSchemaRefs=xe.resolveUrl=xe.normalizeId=xe._getFullPath=xe.getFullPath=xe.inlineRef=void 0;var tb=D(),rb=Wi(),ob=Pf(),nb=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function sb(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Bi(t):e?Ef(t)<=e:!1}xe.inlineRef=sb;var ib=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Bi(t){for(let e in t){if(ib.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Bi)||typeof r=="object"&&Bi(r))return!0}return!1}function Ef(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!nb.has(r)&&(typeof t[r]=="object"&&(0,tb.eachItem)(t[r],o=>e+=Ef(o)),e===1/0))return 1/0}return e}function Tf(t,e="",r){r!==!1&&(e=Yt(e));let o=t.parse(e);return Rf(t,o)}xe.getFullPath=Tf;function Rf(t,e){return t.serialize(e).split("#")[0]+"#"}xe._getFullPath=Rf;var ab=/#\/?$/;function Yt(t){return t?t.replace(ab,""):""}xe.normalizeId=Yt;function cb(t,e,r){return r=Yt(r),t.resolve(e,r)}xe.resolveUrl=cb;var ub=/^[a-z_][-a-z0-9._]*$/i;function lb(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Yt(t[r]||e),s={"":n},i=Tf(o,n,!1),a={},c=new Set;return ob(t,{allKeys:!0},(p,d,f,m)=>{if(m===void 0)return;let _=i+d,y=s[m];typeof p[r]=="string"&&(y=v.call(this,p[r])),P.call(this,p.$anchor),P.call(this,p.$dynamicAnchor),s[d]=y;function v(w){let S=this.opts.uriResolver.resolve;if(w=Yt(y?S(y,w):w),c.has(w))throw l(w);c.add(w);let x=this.refs[w];return typeof x=="string"&&(x=this.refs[x]),typeof x=="object"?u(p,x.schema,w):w!==Yt(_)&&(w[0]==="#"?(u(p,a[w],w),a[w]=p):this.refs[w]=_),w}function P(w){if(typeof w=="string"){if(!ub.test(w))throw new Error(`invalid anchor "${w}"`);v.call(this,`#${w}`)}}}),a;function u(p,d,f){if(d!==void 0&&!rb(p,d))throw l(f)}function l(p){return new Error(`reference "${p}" resolves to more than one schema`)}}xe.getSchemaRefs=lb});var ro=$(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.getData=gt.KeywordCxt=gt.validateFunctionCode=void 0;var Cf=lf(),If=Yr(),Yi=Fi(),$n=Yr(),pb=_f(),to=wf(),Qi=Sf(),k=O(),T=rt(),db=Xr(),ot=D(),eo=Qr();function fb(t){if(Mf(t)&&(Df(t),Zf(t))){gb(t);return}Af(t,()=>(0,Cf.topBoolOrEmptySchema)(t))}gt.validateFunctionCode=fb;function Af({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,k._)`${T.default.data}, ${T.default.valCxt}`,o.$async,()=>{t.code((0,k._)`"use strict"; ${Of(r,n)}`),hb(t,n),t.code(s)}):t.func(e,(0,k._)`${T.default.data}, ${mb(n)}`,o.$async,()=>t.code(Of(r,n)).code(s))}function mb(t){return(0,k._)`{${T.default.instancePath}="", ${T.default.parentData}, ${T.default.parentDataProperty}, ${T.default.rootData}=${T.default.data}${t.dynamicRef?(0,k._)`, ${T.default.dynamicAnchors}={}`:k.nil}}={}`}function hb(t,e){t.if(T.default.valCxt,()=>{t.var(T.default.instancePath,(0,k._)`${T.default.valCxt}.${T.default.instancePath}`),t.var(T.default.parentData,(0,k._)`${T.default.valCxt}.${T.default.parentData}`),t.var(T.default.parentDataProperty,(0,k._)`${T.default.valCxt}.${T.default.parentDataProperty}`),t.var(T.default.rootData,(0,k._)`${T.default.valCxt}.${T.default.rootData}`),e.dynamicRef&&t.var(T.default.dynamicAnchors,(0,k._)`${T.default.valCxt}.${T.default.dynamicAnchors}`)},()=>{t.var(T.default.instancePath,(0,k._)`""`),t.var(T.default.parentData,(0,k._)`undefined`),t.var(T.default.parentDataProperty,(0,k._)`undefined`),t.var(T.default.rootData,T.default.data),e.dynamicRef&&t.var(T.default.dynamicAnchors,(0,k._)`{}`)})}function gb(t){let{schema:e,opts:r,gen:o}=t;Af(t,()=>{r.$comment&&e.$comment&&Lf(t),bb(t),o.let(T.default.vErrors,null),o.let(T.default.errors,0),r.unevaluated&&_b(t),qf(t),Sb(t)})}function _b(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,k._)`${r}.evaluated`),e.if((0,k._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,k._)`${t.evaluated}.props`,(0,k._)`undefined`)),e.if((0,k._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,k._)`${t.evaluated}.items`,(0,k._)`undefined`))}function Of(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,k._)`/*# sourceURL=${r} */`:k.nil}function yb(t,e){if(Mf(t)&&(Df(t),Zf(t))){vb(t,e);return}(0,Cf.boolOrEmptySchema)(t,e)}function Zf({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Mf(t){return typeof t.schema!="boolean"}function vb(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&Lf(t),wb(t),xb(t);let s=o.const("_errs",T.default.errors);qf(t,s),o.var(e,(0,k._)`${s} === ${T.default.errors}`)}function Df(t){(0,ot.checkUnknownRules)(t),$b(t)}function qf(t,e){if(t.opts.jtd)return Nf(t,[],!1,e);let r=(0,If.getSchemaTypes)(t.schema),o=(0,If.coerceAndCheckDataType)(t,r);Nf(t,r,!o,e)}function $b(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,ot.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function bb(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ot.checkStrictMode)(t,"default is ignored in the schema root")}function wb(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,db.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function xb(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Lf({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,k._)`${T.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,k.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,k._)`${T.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Sb(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,k._)`${T.default.errors} === 0`,()=>e.return(T.default.data),()=>e.throw((0,k._)`new ${n}(${T.default.vErrors})`)):(e.assign((0,k._)`${o}.errors`,T.default.vErrors),s.unevaluated&&zb(t),e.return((0,k._)`${T.default.errors} === 0`))}function zb({gen:t,evaluated:e,props:r,items:o}){r instanceof k.Name&&t.assign((0,k._)`${e}.props`,r),o instanceof k.Name&&t.assign((0,k._)`${e}.items`,o)}function Nf(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ot.schemaHasRulesButRef)(s,l))){n.block(()=>Uf(t,"$ref",l.all.$ref.definition));return}c.jtd||kb(t,e),n.block(()=>{for(let d of l.rules)p(d);p(l.post)});function p(d){(0,Yi.shouldUseGroup)(s,d)&&(d.type?(n.if((0,$n.checkDataType)(d.type,i,c.strictNumbers)),jf(t,d),e.length===1&&e[0]===d.type&&r&&(n.else(),(0,$n.reportTypeError)(t)),n.endIf()):jf(t,d),a||n.if((0,k._)`${T.default.errors} === ${o||0}`))}}function jf(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,pb.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Yi.shouldUseRule)(o,s)&&Uf(t,s.keyword,s.definition,e.type)})}function kb(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Pb(t,e),t.opts.allowUnionTypes||Eb(t,e),Tb(t,t.dataTypes))}function Pb(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Ff(t.dataTypes,r)||Xi(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Ib(t,e)}}function Eb(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Xi(t,"use allowUnionTypes to allow union type keyword")}function Tb(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Yi.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Rb(e,i))&&Xi(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Rb(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Ff(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Ib(t,e){let r=[];for(let o of t.dataTypes)Ff(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Xi(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,ot.checkStrictMode)(t,e,t.opts.strictTypes)}var bn=class{constructor(e,r,o){if((0,to.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ot.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Vf(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,to.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",T.default.errors))}result(e,r,o){this.failResult((0,k.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,k.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,k._)`${r} !== undefined && (${(0,k.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?eo.reportExtraError:eo.reportError)(this,this.def.error,r)}$dataError(){(0,eo.reportError)(this,this.def.$dataError||eo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,eo.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=k.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=k.nil,r=k.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,k.or)((0,k._)`${n} === undefined`,r)),e!==k.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==k.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,k.or)(i(),a());function i(){if(o.length){if(!(r instanceof k.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,k._)`${(0,$n.checkDataTypes)(c,r,s.opts.strictNumbers,$n.DataType.Wrong)}`}return k.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,k._)`!${c}(${r})`}return k.nil}}subschema(e,r){let o=(0,Qi.getSubschema)(this.it,e);(0,Qi.extendSubschemaData)(o,this.it,e),(0,Qi.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return yb(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=ot.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=ot.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,k.Name)),!0}};gt.KeywordCxt=bn;function Uf(t,e,r,o){let n=new bn(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,to.funcKeywordCode)(n,r):"macro"in r?(0,to.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,to.funcKeywordCode)(n,r)}var Ob=/^\/(?:[^~]|~0|~1)*$/,Nb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Vf(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return T.default.rootData;if(t[0]==="/"){if(!Ob.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=T.default.rootData}else{let u=Nb.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,k._)`${s}${(0,k.getProperty)((0,ot.unescapeJsonPointer)(u))}`,i=(0,k._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}gt.getData=Vf});var wn=$(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});var ea=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};ta.default=ea});var oo=$(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var ra=Xr(),oa=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,ra.resolveUrl)(e,r,o),this.missingSchema=(0,ra.normalizeId)((0,ra.getFullPath)(e,this.missingRef))}};na.default=oa});var Sn=$(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.resolveSchema=Ce.getCompilingSchema=Ce.resolveRef=Ce.compileSchema=Ce.SchemaEnv=void 0;var De=O(),jb=wn(),Pt=rt(),qe=Xr(),Hf=D(),Cb=ro(),Xt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,qe.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};Ce.SchemaEnv=Xt;function ia(t){let e=Gf.call(this,t);if(e)return e;let r=(0,qe.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new De.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:jb.default,code:(0,De._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Pt.default.data,parentData:Pt.default.parentData,parentDataProperty:Pt.default.parentDataProperty,dataNames:[Pt.default.data],dataPathArr:[De.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,De.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:De.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,De._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Cb.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let p=i.toString();l=`${i.scopeRefs(Pt.default.scope)}return ${p}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Pt.default.self}`,`${Pt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:p,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:_}=u;f.evaluated={props:m instanceof De.Name?void 0:m,items:_ instanceof De.Name?void 0:_,dynamicProps:m instanceof De.Name,dynamicItems:_ instanceof De.Name},f.source&&(f.source.evaluated=(0,De.stringify)(f.evaluated))}return t.validate=f,t}catch(p){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),p}finally{this._compilations.delete(t)}}Ce.compileSchema=ia;function Ab(t,e,r){var o;r=(0,qe.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=Db.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Xt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=Zb.call(this,s)}Ce.resolveRef=Ab;function Zb(t){return(0,qe.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ia.call(this,t)}function Gf(t){for(let e of this._compilations)if(Mb(e,t))return e}Ce.getCompilingSchema=Gf;function Mb(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Db(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||xn.call(this,t,e)}function xn(t,e){let r=this.opts.uriResolver.parse(e),o=(0,qe._getFullPath)(this.opts.uriResolver,r),n=(0,qe.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return sa.call(this,r,t);let s=(0,qe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=xn.call(this,t,i);return typeof a?.schema!="object"?void 0:sa.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ia.call(this,i),s===(0,qe.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,qe.resolveUrl)(this.opts.uriResolver,n,u)),new Xt({schema:a,schemaId:c,root:t,baseId:n})}return sa.call(this,r,i)}}Ce.resolveSchema=xn;var qb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function sa(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Hf.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!qb.has(a)&&u&&(e=(0,qe.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Hf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,qe.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=xn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Xt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var Kf=$((sO,Lb)=>{Lb.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 ua=$((iO,Xf)=>{"use strict";var Fb=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Wf=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),aa=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Bf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Ub=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function ca(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var Vb=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Jf(t){return t.length=0,!0}function Hb(t,e,r){if(t.length){let o=ca(t);if(o!=="")e.push(o);else return r.error=!0,!1;t.length=0}return!0}function Gb(t){let e=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Hb;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=Jf}else{n.push(u);continue}}return n.length&&(a===Jf?r.zone=n.join(""):i?o.push(n.join("")):o.push(ca(n))),r.address=o.join(""),r}function Qf(t){if(Kb(t,":")<2)return{host:t,isIPV6:!1};let e=Gb(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,o=e.address;return e.zone&&(r+="%"+e.zone,o+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:o}}}function Kb(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function Jb(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var Wb={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Bb=/[@/?#:]/g,Qb=/[@/?#]/g;function Yf(t,e){let r=e?Qb:Bb;return r.lastIndex=0,t.replace(r,o=>Wb[o])}function Yb(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(aa(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&Bf(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function Xb(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(aa(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&Bf(s)?e+=s:e+="%"+n,r+=2;continue}}Ub(t[r])?e+=t[r]:e+=escape(t[r])}return e}function e0(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(aa(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function t0(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Wf(r)){let o=Qf(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=Yf(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Xf.exports={nonSimpleDomain:Vb,recomposeAuthority:t0,reescapeHostDelimiters:Yf,normalizePercentEncoding:Yb,normalizePathEncoding:Xb,escapePreservingEscapes:e0,removeDotSegments:Jb,isIPv4:Wf,isUUID:Fb,normalizeIPv6:Qf,stringArrayToHexStripped:ca}});var nm=$((aO,om)=>{"use strict";var{isUUID:r0}=ua(),o0=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n0=["http","https","ws","wss","urn","urn:uuid"];function s0(t){return n0.indexOf(t)!==-1}function la(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function em(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function tm(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function i0(t){return t.secure=la(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function a0(t){if((t.port===(la(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function c0(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(o0);if(r){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=pa(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function u0(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=pa(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function l0(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!r0(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function p0(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var rm={scheme:"http",domainHost:!0,parse:em,serialize:tm},d0={scheme:"https",domainHost:rm.domainHost,parse:em,serialize:tm},zn={scheme:"ws",domainHost:!0,parse:i0,serialize:a0},f0={scheme:"wss",domainHost:zn.domainHost,parse:zn.parse,serialize:zn.serialize},m0={scheme:"urn",parse:c0,serialize:u0,skipNormalize:!0},h0={scheme:"urn:uuid",parse:l0,serialize:p0,skipNormalize:!0},kn={http:rm,https:d0,ws:zn,wss:f0,urn:m0,"urn:uuid":h0};Object.setPrototypeOf(kn,null);function pa(t){return t&&(kn[t]||kn[t.toLowerCase()])||void 0}om.exports={wsIsSecure:la,SCHEMES:kn,isValidSchemeName:s0,getSchemeHandler:pa}});var lm=$((cO,Pn)=>{"use strict";var{normalizeIPv6:g0,removeDotSegments:no,recomposeAuthority:_0,normalizePercentEncoding:y0,normalizePathEncoding:v0,escapePreservingEscapes:$0,reescapeHostDelimiters:b0,isIPv4:w0,nonSimpleDomain:x0}=ua(),{SCHEMES:S0,getSchemeHandler:im}=nm();function z0(t,e){return typeof t=="string"?t=R0(t,e):typeof t=="object"&&(t=er(Et(t,e),e)),t}function k0(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=am(er(t,o),er(e,o),o,!0);return o.skipEscape=!0,Et(n,o)}function am(t,e,r,o){let n={};return o||(t=er(Et(t,r),r),e=er(Et(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=no(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=no(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=no(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=no(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function P0(t,e,r){let o=sm(t,r),n=sm(e,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Et(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[],s=im(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=y0(r.path):(r.path=$0(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=_0(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=no(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var E0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function T0(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function cm(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(E0);if(i){o.scheme=i[1],o.userinfo=i[3],o.host=i[4],o.port=parseInt(i[5],10),o.path=i[6]||"",o.query=i[7],o.fragment=i[8],isNaN(o.port)&&(o.port=i[5]);let a=T0(o,i);if(a!==void 0&&(o.error=o.error||a,n=!0),o.host)if(w0(o.host)===!1){let l=g0(o.host);o.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let c=im(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&o.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&x0(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=b0(unescape(o.host),s))),o.path&&(o.path=v0(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}c&&c.parse&&c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function er(t,e){return cm(t,e).parsed}function R0(t,e){return um(t,e).normalized}function um(t,e){let{parsed:r,malformedAuthorityOrPort:o}=cm(t,e);return{normalized:o?t:Et(r,e),malformedAuthorityOrPort:o}}function sm(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:o}=um(t,e);return o?void 0:r}if(typeof t=="object")return Et(t,e)}var da={SCHEMES:S0,normalize:z0,resolve:k0,resolveComponent:am,equal:P0,serialize:Et,parse:er};Pn.exports=da;Pn.exports.default=da;Pn.exports.fastUri=da});var dm=$(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var pm=lm();pm.code='require("ajv/dist/runtime/uri").default';fa.default=pm});var $m=$(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var I0=ro();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return I0.KeywordCxt}});var tr=O();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return tr._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return tr.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return tr.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return tr.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return tr.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return tr.CodeGen}});var O0=wn(),_m=oo(),N0=Li(),so=Sn(),j0=O(),io=Xr(),En=Yr(),ha=D(),fm=Kf(),C0=dm(),ym=(t,e)=>new RegExp(t,e);ym.code="new RegExp";var A0=["removeAdditional","useDefaults","coerceTypes"],Z0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),M0={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."},D0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},mm=200;function q0(t){var e,r,o,n,s,i,a,c,u,l,p,d,f,m,_,y,v,P,w,S,x,ze,Te,fr,is;let mr=t.strict,as=(e=t.code)===null||e===void 0?void 0:e.optimize,Rc=as===!0||as===void 0?1:as||0,Ic=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:ym,rg=(n=t.uriResolver)!==null&&n!==void 0?n:C0.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:mr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:mr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:mr)!==null&&l!==void 0?l:"log",strictTuples:(d=(p=t.strictTuples)!==null&&p!==void 0?p:mr)!==null&&d!==void 0?d:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:mr)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Rc,regExp:Ic}:{optimize:Rc,regExp:Ic},loopRequired:(_=t.loopRequired)!==null&&_!==void 0?_:mm,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:mm,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(P=t.messages)!==null&&P!==void 0?P:!0,inlineRefs:(w=t.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(S=t.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(x=t.addUsedSchema)!==null&&x!==void 0?x:!0,validateSchema:(ze=t.validateSchema)!==null&&ze!==void 0?ze:!0,validateFormats:(Te=t.validateFormats)!==null&&Te!==void 0?Te:!0,unicodeRegExp:(fr=t.unicodeRegExp)!==null&&fr!==void 0?fr:!0,int32range:(is=t.int32range)!==null&&is!==void 0?is:!0,uriResolver:rg}}var ao=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...q0(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new j0.ValueScope({scope:{},prefixes:Z0,es5:r,lines:o}),this.logger=G0(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,N0.getRules)(),hm.call(this,M0,e,"NOT SUPPORTED"),hm.call(this,D0,e,"DEPRECATED","warn"),this._metaOpts=V0.call(this),e.formats&&F0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&U0.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),L0.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=fm;o==="id"&&(n={...fm},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,p){await s.call(this,l.$schema);let d=this._addSchema(l,p);return d.validate||i.call(this,d)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(p){if(!(p instanceof _m.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:p}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${p} cannot be resolved`)}async function c(l){let p=await u.call(this,l);this.refs[l]||await s.call(this,p.$schema),this.refs[l]||this.addSchema(p,l,r)}async function u(l){let p=this._loading[l];if(p)return p;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,io.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=gm.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new so.SchemaEnv({schema:{},schemaId:o});if(r=so.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=gm.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,io.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(J0.call(this,o,r),!r)return(0,ha.eachItem)(o,s=>ma.call(this,s)),this;B0.call(this,r);let n={...r,type:(0,En.getJSONTypes)(r.type),schemaType:(0,En.getJSONTypes)(r.schemaType)};return(0,ha.eachItem)(o,n.type.length===0?s=>ma.call(this,s,n):s=>n.type.forEach(i=>ma.call(this,s,n,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=vm(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,io.normalizeId)(i||o);let u=io.getSchemaRefs.call(this,e,o);return c=new so.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):so.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{so.compileSchema.call(this,e)}finally{this.opts=r}}};ao.ValidationError=O0.default;ao.MissingRefError=_m.default;le.default=ao;function hm(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function gm(t){return t=(0,io.normalizeId)(t),this.schemas[t]||this.refs[t]}function L0(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function F0(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function U0(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function V0(){let t={...this.opts};for(let e of A0)delete t[e];return t}var H0={log(){},warn(){},error(){}};function G0(t){if(t===!1)return H0;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var K0=/^[a-z_$][a-z0-9_$:-]*$/i;function J0(t,e){let{RULES:r}=this;if((0,ha.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!K0.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function ma(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,En.getJSONTypes)(e.type),schemaType:(0,En.getJSONTypes)(e.schemaType)}};e.before?W0.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function W0(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function B0(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=vm(e)),t.validateSchema=this.compile(e,!0))}var Q0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function vm(t){return{anyOf:[t,Q0]}}});var bm=$(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var Y0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ga.default=Y0});var zm=$(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.callRef=Tt.getValidate=void 0;var X0=oo(),wm=je(),Se=O(),rr=rt(),xm=Sn(),Tn=D(),ew={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return p();let l=xm.resolveRef.call(c,u,n,r);if(l===void 0)throw new X0.default(o.opts.uriResolver,n,r);if(l instanceof xm.SchemaEnv)return d(l);return f(l);function p(){if(s===u)return Rn(t,i,s,s.$async);let m=e.scopeValue("root",{ref:u});return Rn(t,(0,Se._)`${m}.validate`,u,u.$async)}function d(m){let _=Sm(t,m);Rn(t,_,m,m.$async)}function f(m){let _=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Se.stringify)(m)}:{ref:m}),y=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:Se.nil,topSchemaRef:_,errSchemaPath:r},y);t.mergeEvaluated(v),t.ok(y)}}};function Sm(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Se._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Tt.getValidate=Sm;function Rn(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?rr.default.this:Se.nil;o?l():p();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,Se._)`await ${(0,wm.callValidateCode)(t,e,u)}`),f(e),i||n.assign(m,!0)},_=>{n.if((0,Se._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),d(_),i||n.assign(m,!1)}),t.ok(m)}function p(){t.result((0,wm.callValidateCode)(t,e,u),()=>f(e),()=>d(e))}function d(m){let _=(0,Se._)`${m}.errors`;n.assign(rr.default.vErrors,(0,Se._)`${rr.default.vErrors} === null ? ${_} : ${rr.default.vErrors}.concat(${_})`),n.assign(rr.default.errors,(0,Se._)`${rr.default.vErrors}.length`)}function f(m){var _;if(!s.opts.unevaluated)return;let y=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=Tn.mergeEvaluated.props(n,y.props,s.props));else{let v=n.var("props",(0,Se._)`${m}.evaluated.props`);s.props=Tn.mergeEvaluated.props(n,v,s.props,Se.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=Tn.mergeEvaluated.items(n,y.items,s.items));else{let v=n.var("items",(0,Se._)`${m}.evaluated.items`);s.items=Tn.mergeEvaluated.items(n,v,s.items,Se.Name)}}}Tt.callRef=Rn;Tt.default=ew});var km=$(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var tw=bm(),rw=zm(),ow=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",tw.default,rw.default];_a.default=ow});var Pm=$(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var In=O(),_t=In.operators,On={maximum:{okStr:"<=",ok:_t.LTE,fail:_t.GT},minimum:{okStr:">=",ok:_t.GTE,fail:_t.LT},exclusiveMaximum:{okStr:"<",ok:_t.LT,fail:_t.GTE},exclusiveMinimum:{okStr:">",ok:_t.GT,fail:_t.LTE}},nw={message:({keyword:t,schemaCode:e})=>(0,In.str)`must be ${On[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,In._)`{comparison: ${On[t].okStr}, limit: ${e}}`},sw={keyword:Object.keys(On),type:"number",schemaType:"number",$data:!0,error:nw,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,In._)`${r} ${On[e].fail} ${o} || isNaN(${r})`)}};ya.default=sw});var Em=$(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var co=O(),iw={message:({schemaCode:t})=>(0,co.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,co._)`{multipleOf: ${t}}`},aw={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:iw,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,co._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,co._)`${i} !== parseInt(${i})`;t.fail$data((0,co._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};va.default=aw});var Rm=$($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});function Tm(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}$a.default=Tm;Tm.code='require("ajv/dist/runtime/ucs2length").default'});var Im=$(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var Rt=O(),cw=D(),uw=Rm(),lw={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Rt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Rt._)`{limit: ${t}}`},pw={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:lw,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?Rt.operators.GT:Rt.operators.LT,i=n.opts.unicode===!1?(0,Rt._)`${r}.length`:(0,Rt._)`${(0,cw.useFunc)(t.gen,uw.default)}(${r})`;t.fail$data((0,Rt._)`${i} ${s} ${o}`)}};ba.default=pw});var Om=$(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var dw=je(),fw=D(),or=O(),mw={message:({schemaCode:t})=>(0,or.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,or._)`{pattern: ${t}}`},hw={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:mw,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,or._)`new RegExp`:(0,fw.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,or._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,or._)`!${l}`)}else{let c=(0,dw.usePattern)(t,n);t.fail$data((0,or._)`!${c}.test(${r})`)}}};wa.default=hw});var Nm=$(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var uo=O(),gw={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,uo.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,uo._)`{limit: ${t}}`},_w={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:gw,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?uo.operators.GT:uo.operators.LT;t.fail$data((0,uo._)`Object.keys(${r}).length ${n} ${o}`)}};xa.default=_w});var jm=$(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var lo=je(),po=O(),yw=D(),vw={message:({params:{missingProperty:t}})=>(0,po.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,po._)`{missingProperty: ${t}}`},$w={keyword:"required",type:"object",schemaType:"array",$data:!0,error:vw,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let _ of r)if(f?.[_]===void 0&&!m.has(_)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,yw.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(po.nil,p);else for(let f of r)(0,lo.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>d(f,m)),t.ok(m)}else e.if((0,lo.checkMissingProp)(t,r,f)),(0,lo.reportMissingProp)(t,f),e.else()}function p(){e.forOf("prop",o,f=>{t.setParams({missingProperty:f}),e.if((0,lo.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function d(f,m){t.setParams({missingProperty:f}),e.forOf(f,o,()=>{e.assign(m,(0,lo.propertyInData)(e,n,f,a.ownProperties)),e.if((0,po.not)(m),()=>{t.error(),e.break()})},po.nil)}}};Sa.default=$w});var Cm=$(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var fo=O(),bw={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,fo.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,fo._)`{limit: ${t}}`},ww={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:bw,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?fo.operators.GT:fo.operators.LT;t.fail$data((0,fo._)`${r}.length ${n} ${o}`)}};za.default=ww});var Nn=$(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var Am=Wi();Am.code='require("ajv/dist/runtime/equal").default';ka.default=Am});var Zm=$(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var Pa=Yr(),pe=O(),xw=D(),Sw=Nn(),zw={message:({params:{i:t,j:e}})=>(0,pe.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,pe._)`{i: ${t}, j: ${e}}`},kw={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:zw,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,Pa.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,pe._)`${i} === false`),t.ok(c);function l(){let m=e.let("i",(0,pe._)`${r}.length`),_=e.let("j");t.setParams({i:m,j:_}),e.assign(c,!0),e.if((0,pe._)`${m} > 1`,()=>(p()?d:f)(m,_))}function p(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function d(m,_){let y=e.name("item"),v=(0,Pa.checkDataTypes)(u,y,a.opts.strictNumbers,Pa.DataType.Wrong),P=e.const("indices",(0,pe._)`{}`);e.for((0,pe._)`;${m}--;`,()=>{e.let(y,(0,pe._)`${r}[${m}]`),e.if(v,(0,pe._)`continue`),u.length>1&&e.if((0,pe._)`typeof ${y} == "string"`,(0,pe._)`${y} += "_"`),e.if((0,pe._)`typeof ${P}[${y}] == "number"`,()=>{e.assign(_,(0,pe._)`${P}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,pe._)`${P}[${y}] = ${m}`)})}function f(m,_){let y=(0,xw.useFunc)(e,Sw.default),v=e.name("outer");e.label(v).for((0,pe._)`;${m}--;`,()=>e.for((0,pe._)`${_} = ${m}; ${_}--;`,()=>e.if((0,pe._)`${y}(${r}[${m}], ${r}[${_}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Ea.default=kw});var Mm=$(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var Ta=O(),Pw=D(),Ew=Nn(),Tw={message:"must be equal to constant",params:({schemaCode:t})=>(0,Ta._)`{allowedValue: ${t}}`},Rw={keyword:"const",$data:!0,error:Tw,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,Ta._)`!${(0,Pw.useFunc)(e,Ew.default)}(${r}, ${n})`):t.fail((0,Ta._)`${s} !== ${r}`)}};Ra.default=Rw});var Dm=$(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var mo=O(),Iw=D(),Ow=Nn(),Nw={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,mo._)`{allowedValues: ${t}}`},jw={keyword:"enum",schemaType:"array",$data:!0,error:Nw,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Iw.useFunc)(e,Ow.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,p);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,mo.or)(...n.map((m,_)=>d(f,_)))}t.pass(l);function p(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,mo._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function d(f,m){let _=n[m];return typeof _=="object"&&_!==null?(0,mo._)`${u()}(${r}, ${f}[${m}])`:(0,mo._)`${r} === ${_}`}}};Ia.default=jw});var qm=$(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Cw=Pm(),Aw=Em(),Zw=Im(),Mw=Om(),Dw=Nm(),qw=jm(),Lw=Cm(),Fw=Zm(),Uw=Mm(),Vw=Dm(),Hw=[Cw.default,Aw.default,Zw.default,Mw.default,Dw.default,qw.default,Lw.default,Fw.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Uw.default,Vw.default];Oa.default=Hw});var ja=$(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.validateAdditionalItems=void 0;var It=O(),Na=D(),Gw={message:({params:{len:t}})=>(0,It.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,It._)`{limit: ${t}}`},Kw={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Gw,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,Na.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Lm(t,o)}};function Lm(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,It._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,It._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,Na.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,It._)`${a} <= ${e.length}`);r.if((0,It.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Na.Type.Num},u),i.allErrors||r.if((0,It.not)(u),()=>r.break())})}}ho.validateAdditionalItems=Lm;ho.default=Kw});var Ca=$(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.validateTuple=void 0;var Fm=O(),jn=D(),Jw=je(),Ww={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Um(t,"additionalItems",e);r.items=!0,!(0,jn.alwaysValidSchema)(r,e)&&t.ok((0,Jw.validateArray)(t))}};function Um(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=jn.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Fm._)`${s}.length`);r.forEach((p,d)=>{(0,jn.alwaysValidSchema)(a,p)||(o.if((0,Fm._)`${u} > ${d}`,()=>t.subschema({keyword:i,schemaProp:d,dataProp:d},c)),t.ok(c))});function l(p){let{opts:d,errSchemaPath:f}=a,m=r.length,_=m===p.minItems&&(m===p.maxItems||p[e]===!1);if(d.strictTuples&&!_){let y=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,jn.checkStrictMode)(a,y,d.strictTuples)}}}go.validateTuple=Um;go.default=Ww});var Vm=$(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var Bw=Ca(),Qw={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Bw.validateTuple)(t,"items")};Aa.default=Qw});var Gm=$(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var Hm=O(),Yw=D(),Xw=je(),ex=ja(),tx={message:({params:{len:t}})=>(0,Hm.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Hm._)`{limit: ${t}}`},rx={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:tx,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,Yw.alwaysValidSchema)(o,e)&&(n?(0,ex.validateAdditionalItems)(t,n):t.ok((0,Xw.validateArray)(t)))}};Za.default=rx});var Km=$(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var Ae=O(),Cn=D(),ox={message:({params:{min:t,max:e}})=>e===void 0?(0,Ae.str)`must contain at least ${t} valid item(s)`:(0,Ae.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Ae._)`{minContains: ${t}}`:(0,Ae._)`{minContains: ${t}, maxContains: ${e}}`},nx={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ox,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,Ae._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Cn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Cn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Cn.alwaysValidSchema)(s,r)){let _=(0,Ae._)`${l} >= ${i}`;a!==void 0&&(_=(0,Ae._)`${_} && ${l} <= ${a}`),t.pass(_);return}s.items=!0;let p=e.name("valid");a===void 0&&i===1?f(p,()=>e.if(p,()=>e.break())):i===0?(e.let(p,!0),a!==void 0&&e.if((0,Ae._)`${n}.length > 0`,d)):(e.let(p,!1),d()),t.result(p,()=>t.reset());function d(){let _=e.name("_valid"),y=e.let("count",0);f(_,()=>e.if(_,()=>m(y)))}function f(_,y){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:Cn.Type.Num,compositeRule:!0},_),y()})}function m(_){e.code((0,Ae._)`${_}++`),a===void 0?e.if((0,Ae._)`${_} >= ${i}`,()=>e.assign(p,!0).break()):(e.if((0,Ae._)`${_} > ${a}`,()=>e.assign(p,!1).break()),i===1?e.assign(p,!0):e.if((0,Ae._)`${_} >= ${i}`,()=>e.assign(p,!0)))}}};Ma.default=nx});var Bm=$(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateSchemaDeps=Ke.validatePropertyDeps=Ke.error=void 0;var Da=O(),sx=D(),_o=je();Ke.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,Da.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,Da._)`{property: ${t},
7
7
  missingProperty: ${o},
8
- depsCount: ${t},
9
- deps: ${r}}`};var Bw={keyword:"dependencies",type:"object",schemaType:"object",error:Ke.error,code(e){let[t,r]=Qw(e);Mm(e,t),qm(e,r)}};function Qw({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Mm(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,mo.propertyInData)(r,o,i,n.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,mo.checkReportMissingProp)(e,u)}):(r.if((0,Na._)`${c} && (${(0,mo.checkMissingProp)(e,a,s)})`),(0,mo.reportMissingProp)(e,s),r.else())}}Ke.validatePropertyDeps=Mm;function qm(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t)(0,Ww.alwaysValidSchema)(s,t[a])||(r.if((0,mo.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}Ke.validateSchemaDeps=qm;Ke.default=Bw});var Fm=$(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var Lm=O(),Yw=q(),Xw={message:"property name must be valid",params:({params:e})=>(0,Lm._)`{propertyName: ${e.propertyName}}`},ez={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Xw,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,Yw.alwaysValidSchema)(n,r))return;let s=t.name("valid");t.forIn("key",o,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,Lm.not)(s),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(s)}};Aa.default=ez});var Za=$(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var Rn=je(),De=O(),tz=rt(),In=q(),rz={message:"must NOT have additional properties",params:({params:e})=>(0,De._)`{additionalProperty: ${e.additionalProperty}}`},oz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:rz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,In.alwaysValidSchema)(i,r))return;let u=(0,Rn.allSchemaProperties)(o.properties),l=(0,Rn.allSchemaProperties)(o.patternProperties);p(),e.ok((0,De._)`${s} === ${tz.default.errors}`);function p(){t.forIn("key",n,y=>{!u.length&&!l.length?m(y):t.if(d(y),()=>m(y))})}function d(y){let v;if(u.length>8){let P=(0,In.schemaRefOrVal)(i,o.properties,"properties");v=(0,Rn.isOwnProperty)(t,P,y)}else u.length?v=(0,De.or)(...u.map(P=>(0,De._)`${y} === ${P}`)):v=De.nil;return l.length&&(v=(0,De.or)(v,...l.map(P=>(0,De._)`${(0,Rn.usePattern)(e,P)}.test(${y})`))),(0,De.not)(v)}function f(y){t.code((0,De._)`delete ${n}[${y}]`)}function m(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,In.alwaysValidSchema)(i,r)){let v=t.name("valid");c.removeAdditional==="failing"?(_(y,v,!1),t.if((0,De.not)(v),()=>{e.reset(),f(y)})):(_(y,v),a||t.if((0,De.not)(v),()=>t.break()))}}function _(y,v,P){let z={keyword:"additionalProperties",dataProp:y,dataPropType:In.Type.Str};P===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(z,v)}}};Ca.default=oz});var Jm=$(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var nz=Xr(),Um=je(),Ma=q(),Vm=Za(),sz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Vm.default.code(new nz.KeywordCxt(s,Vm.default,"additionalProperties"));let i=(0,Um.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ma.mergeEvaluated.props(t,(0,Ma.toHash)(i),s.props));let a=i.filter(p=>!(0,Ma.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=t.name("valid");for(let p of a)u(p)?l(p):(t.if((0,Um.propertyInData)(t,n,p,s.opts.ownProperties)),l(p),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(p),e.ok(c);function u(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};qa.default=sz});var Wm=$(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var Gm=je(),On=O(),Km=q(),Hm=q(),iz={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=(0,Gm.allSchemaProperties)(r),c=a.filter(_=>(0,Km.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof On.Name)&&(s.props=(0,Hm.evaluatedPropsToName)(t,s.props));let{props:p}=s;d();function d(){for(let _ of a)u&&f(_),s.allErrors?m(_):(t.var(l,!0),m(_),t.if(l))}function f(_){for(let y in u)new RegExp(_).test(y)&&(0,Km.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function m(_){t.forIn("key",o,y=>{t.if((0,On._)`${(0,Gm.usePattern)(e,_)}.test(${y})`,()=>{let v=c.includes(_);v||e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:Hm.Type.Str},l),s.opts.unevaluated&&p!==!0?t.assign((0,On._)`${p}[${y}]`,!0):!v&&!s.allErrors&&t.if((0,On.not)(l),()=>t.break())})})}}};Da.default=iz});var Bm=$(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var az=q(),cz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,az.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};La.default=cz});var Qm=$(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var uz=je(),lz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:uz.validateUnion,error:{message:"must match a schema in anyOf"}};Fa.default=lz});var Ym=$(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var jn=O(),pz=q(),dz={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,jn._)`{passingSchemas: ${e.passing}}`},fz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:dz,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,p)=>{let d;(0,pz.alwaysValidSchema)(n,l)?t.var(c,!0):d=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&t.if((0,jn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,jn._)`[${a}, ${p}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,p),d&&e.mergeEvaluated(d,jn.Name)})})}}};Ua.default=fz});var Xm=$(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var mz=q(),hz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if((0,mz.alwaysValidSchema)(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};Va.default=hz});var rh=$(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var Nn=O(),th=q(),gz={message:({params:e})=>(0,Nn.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Nn._)`{failingKeyword: ${e.ifClause}}`},_z={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:gz,code(e){let{gen:t,parentSchema:r,it:o}=e;r.then===void 0&&r.else===void 0&&(0,th.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=eh(o,"then"),s=eh(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else n?t.if(a,u("then")):t.if((0,Nn.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,p){return()=>{let d=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(d,i),p?t.assign(p,(0,Nn._)`${l}`):e.setParams({ifClause:l})}}}};function eh(e,t){let r=e.schema[t];return r!==void 0&&!(0,th.alwaysValidSchema)(e,r)}Ja.default=_z});var oh=$(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var yz=q(),vz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,yz.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Ga.default=vz});var nh=$(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var $z=Ta(),bz=Nm(),wz=Ra(),zz=Cm(),xz=Zm(),Sz=Dm(),kz=Fm(),Pz=Za(),Ez=Jm(),Tz=Wm(),Rz=Bm(),Iz=Qm(),Oz=Ym(),jz=Xm(),Nz=rh(),Az=oh();function Cz(e=!1){let t=[Rz.default,Iz.default,Oz.default,jz.default,Nz.default,Az.default,kz.default,Pz.default,Sz.default,Ez.default,Tz.default];return e?t.push(bz.default,zz.default):t.push($z.default,wz.default),t.push(xz.default),t}Ka.default=Cz});var sh=$(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});var oe=O(),Zz={message:({schemaCode:e})=>(0,oe.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,oe._)`{format: ${e}}`},Mz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Zz,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:p}=a;if(!c.validateFormats)return;n?d():f();function d(){let m=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),_=r.const("fDef",(0,oe._)`${m}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,oe._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${_}.type || "string"`).assign(v,(0,oe._)`${_}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(v,_)),e.fail$data((0,oe.or)(P(),z()));function P(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${v}`}function z(){let k=l.$async?(0,oe._)`(${_}.async ? await ${v}(${o}) : ${v}(${o}))`:(0,oe._)`${v}(${o})`,w=(0,oe._)`(typeof ${v} == "function" ? ${k} : ${v}.test(${o}))`;return(0,oe._)`${v} && ${v} !== true && ${y} === ${t} && !${w}`}}function f(){let m=p.formats[s];if(!m){P();return}if(m===!0)return;let[_,y,v]=z(m);_===t&&e.pass(k());function P(){if(c.strictSchema===!1){p.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function z(w){let xe=w instanceof RegExp?(0,oe.regexpCode)(w):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Ee=r.scopeValue("formats",{key:s,ref:w,code:xe});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,oe._)`${Ee}.validate`]:["string",w,Ee]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${v}(${o})`}return typeof y=="function"?(0,oe._)`${v}(${o})`:(0,oe._)`${v}.test(${o})`}}}};Ha.default=Mz});var ih=$(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var qz=sh(),Dz=[qz.default];Wa.default=Dz});var ah=$(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.contentVocabulary=rr.metadataVocabulary=void 0;rr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];rr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var uh=$(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var Lz=gm(),Fz=Rm(),Uz=nh(),Vz=ih(),ch=ah(),Jz=[Lz.default,Fz.default,(0,Uz.default)(),Vz.default,ch.metadataVocabulary,ch.contentVocabulary];Ba.default=Jz});var ph=$(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.DiscrError=void 0;var lh;(function(e){e.Tag="tag",e.Mapping="mapping"})(lh||(An.DiscrError=lh={}))});var fh=$(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});var or=O(),Qa=ph(),dh=yn(),Gz=eo(),Kz=q(),Hz={message:({params:{discrError:e,tagName:t}})=>e===Qa.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,or._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Wz={keyword:"discriminator",type:"object",schemaType:"object",error:Hz,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,or._)`${r}${(0,or.getProperty)(a)}`);t.if((0,or._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Qa.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=d();t.if(!1);for(let m in f)t.elseIf((0,or._)`${u} === ${m}`),t.assign(c,p(f[m]));t.else(),e.error(!1,{discrError:Qa.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function p(f){let m=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:f},m);return e.mergeEvaluated(_,or.Name),m}function d(){var f;let m={},_=v(n),y=!0;for(let k=0;k<i.length;k++){let w=i[k];if(w?.$ref&&!(0,Kz.schemaHasRulesButRef)(w,s.self.RULES)){let Ee=w.$ref;if(w=dh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Ee),w instanceof dh.SchemaEnv&&(w=w.schema),w===void 0)throw new Gz.default(s.opts.uriResolver,s.baseId,Ee)}let xe=(f=w?.properties)===null||f===void 0?void 0:f[a];if(typeof xe!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||v(w)),P(xe,k)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function v({required:k}){return Array.isArray(k)&&k.includes(a)}function P(k,w){if(k.const)z(k.const,w);else if(k.enum)for(let xe of k.enum)z(xe,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(k,w){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=w}}}};Ya.default=Wz});var mh=$((PO,Bz)=>{Bz.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 ec=$((Q,Xa)=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.MissingRefError=Q.ValidationError=Q.CodeGen=Q.Name=Q.nil=Q.stringify=Q.str=Q._=Q.KeywordCxt=Q.Ajv=void 0;var Qz=lm(),Yz=uh(),Xz=fh(),hh=mh(),ex=["/properties"],Cn="http://json-schema.org/draft-07/schema",nr=class extends Qz.default{_addVocabularies(){super._addVocabularies(),Yz.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(Xz.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(hh,ex):hh;this.addMetaSchema(t,Cn,!1),this.refs["http://json-schema.org/schema"]=Cn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Cn)?Cn:void 0)}};Q.Ajv=nr;Xa.exports=Q=nr;Xa.exports.Ajv=nr;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=nr;var tx=Xr();Object.defineProperty(Q,"KeywordCxt",{enumerable:!0,get:function(){return tx.KeywordCxt}});var sr=O();Object.defineProperty(Q,"_",{enumerable:!0,get:function(){return sr._}});Object.defineProperty(Q,"str",{enumerable:!0,get:function(){return sr.str}});Object.defineProperty(Q,"stringify",{enumerable:!0,get:function(){return sr.stringify}});Object.defineProperty(Q,"nil",{enumerable:!0,get:function(){return sr.nil}});Object.defineProperty(Q,"Name",{enumerable:!0,get:function(){return sr.Name}});Object.defineProperty(Q,"CodeGen",{enumerable:!0,get:function(){return sr.CodeGen}});var rx=gn();Object.defineProperty(Q,"ValidationError",{enumerable:!0,get:function(){return rx.default}});var ox=eo();Object.defineProperty(Q,"MissingRefError",{enumerable:!0,get:function(){return ox.default}})});var zh=$(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.formatNames=We.fastFormats=We.fullFormats=void 0;function He(e,t){return{validate:e,compare:t}}We.fullFormats={date:He(vh,nc),time:He(rc(!0),sc),"date-time":He(gh(!0),bh),"iso-time":He(rc(),$h),"iso-date-time":He(gh(),wh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:ux,"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:gx,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:lx,int32:{type:"number",validate:fx},int64:{type:"number",validate:mx},float:{type:"number",validate:yh},double:{type:"number",validate:yh},password:!0,binary:!0};We.fastFormats={...We.fullFormats,date:He(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,nc),time:He(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,sc),"date-time":He(/^\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,bh),"iso-time":He(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,$h),"iso-date-time":He(/^\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,wh),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};We.formatNames=Object.keys(We.fullFormats);function nx(e){return e%4===0&&(e%100!==0||e%400===0)}var sx=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ix=[0,31,28,31,30,31,30,31,31,30,31,30,31];function vh(e){let t=sx.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&nx(r)?29:ix[o])}function nc(e,t){if(e&&t)return e>t?1:e<t?-1:0}var tc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function rc(e){return function(r){let o=tc.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let p=s-l*c,d=n-u*c-(p<0?1:0);return(d===23||d===-1)&&(p===59||p===-1)&&i<61}}function sc(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(r&&o)return r-o}function $h(e,t){if(!(e&&t))return;let r=tc.exec(e),o=tc.exec(t);if(r&&o)return e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t?1:e<t?-1:0}var oc=/t|\s/i;function gh(e){let t=rc(e);return function(o){let n=o.split(oc);return n.length===2&&vh(n[0])&&t(n[1])}}function bh(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(r&&o)return r-o}function wh(e,t){if(!(e&&t))return;let[r,o]=e.split(oc),[n,s]=t.split(oc),i=nc(r,n);if(i!==void 0)return i||sc(o,s)}var ax=/\/|:/,cx=/^(?:[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 ux(e){return ax.test(e)&&cx.test(e)}var _h=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function lx(e){return _h.lastIndex=0,_h.test(e)}var px=-(2**31),dx=2**31-1;function fx(e){return Number.isInteger(e)&&e<=dx&&e>=px}function mx(e){return Number.isInteger(e)}function yh(){return!0}var hx=/[^\\]\\Z/;function gx(e){if(hx.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var xh=$(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.formatLimitDefinition=void 0;var _x=ec(),Le=O(),yt=Le.operators,Zn={formatMaximum:{okStr:"<=",ok:yt.LTE,fail:yt.GT},formatMinimum:{okStr:">=",ok:yt.GTE,fail:yt.LT},formatExclusiveMaximum:{okStr:"<",ok:yt.LT,fail:yt.GTE},formatExclusiveMinimum:{okStr:">",ok:yt.GT,fail:yt.LTE}},yx={message:({keyword:e,schemaCode:t})=>(0,Le.str)`should be ${Zn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Le._)`{comparison: ${Zn[e].okStr}, limit: ${t}}`};ir.formatLimitDefinition={keyword:Object.keys(Zn),type:"string",schemaType:"string",$data:!0,error:yx,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new _x.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let d=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,Le._)`${d}[${c.schemaCode}]`);e.fail$data((0,Le.or)((0,Le._)`typeof ${f} != "object"`,(0,Le._)`${f} instanceof RegExp`,(0,Le._)`typeof ${f}.compare != "function"`,p(f)))}function l(){let d=c.schema,f=a.formats[d];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${d}" does not define "compare" function`);let m=t.scopeValue("formats",{key:d,ref:f,code:i.code.formats?(0,Le._)`${i.code.formats}${(0,Le.getProperty)(d)}`:void 0});e.fail$data(p(m))}function p(d){return(0,Le._)`${d}.compare(${r}, ${o}) ${Zn[n].fail} 0`}},dependencies:["format"]};var vx=e=>(e.addKeyword(ir.formatLimitDefinition),e);ir.default=vx});var Eh=$((ho,Ph)=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});var ar=zh(),$x=xh(),ic=O(),Sh=new ic.Name("fullFormats"),bx=new ic.Name("fastFormats"),ac=(e,t={keywords:!0})=>{if(Array.isArray(t))return kh(e,t,ar.fullFormats,Sh),e;let[r,o]=t.mode==="fast"?[ar.fastFormats,bx]:[ar.fullFormats,Sh],n=t.formats||ar.formatNames;return kh(e,n,r,o),t.keywords&&(0,$x.default)(e),e};ac.get=(e,t="full")=>{let o=(t==="fast"?ar.fastFormats:ar.fullFormats)[e];if(!o)throw new Error(`Unknown format "${e}"`);return o};function kh(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,ic._)`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}Ph.exports=ho=ac;Object.defineProperty(ho,"__esModule",{value:!0});ho.default=ac});var Vh=require("node:util");var zc;function g(e,t,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let d=l[p];d in a||(a[d]=u[d].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var iS=Symbol("zod_brand"),Ve=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},jt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(zc=globalThis).__zod_globalConfig??(zc.__zod_globalConfig={});var Nt=globalThis.__zod_globalConfig;function Se(e){return e&&Object.assign(Nt,e),Nt}var M={};wc(M,{BIGINT_FORMAT_RANGES:()=>Pc,Class:()=>ss,NUMBER_FORMAT_RANGES:()=>ps,aborted:()=>it,allowsEval:()=>cs,assert:()=>og,assertEqual:()=>Xh,assertIs:()=>tg,assertNever:()=>rg,assertNotEqual:()=>eg,assignProp:()=>nt,base64ToUint8Array:()=>Tc,base64urlToUint8Array:()=>$g,cached:()=>Ct,captureStackTrace:()=>zo,cleanEnum:()=>vg,cleanRegex:()=>gr,clone:()=>Ce,cloneDef:()=>sg,createTransparentProxy:()=>pg,defineLazy:()=>F,esc:()=>wo,escapeRegex:()=>Qe,explicitlyAborted:()=>ds,extend:()=>mg,finalizeIssue:()=>Te,floatSafeRemainder:()=>is,getElementAtPath:()=>ig,getEnumValues:()=>mr,getLengthableOrigin:()=>_r,getParsedType:()=>lg,getSizableOrigin:()=>Ec,hexToUint8Array:()=>wg,isObject:()=>vt,isPlainObject:()=>st,issue:()=>Zt,joinValues:()=>bo,jsonStringifyReplacer:()=>At,merge:()=>gg,mergeDefs:()=>Be,normalizeParams:()=>E,nullish:()=>hr,numKeys:()=>ug,objectClone:()=>ng,omit:()=>fg,optionalKeys:()=>ls,parsedType:()=>fs,partial:()=>_g,pick:()=>dg,prefixIssues:()=>Ye,primitiveTypes:()=>kc,promiseAllObject:()=>ag,propertyKeyTypes:()=>us,randomString:()=>cg,required:()=>yg,safeExtend:()=>hg,shallowClone:()=>Sc,slugify:()=>as,stringifyPrimitive:()=>xo,uint8ArrayToBase64:()=>Rc,uint8ArrayToBase64url:()=>bg,uint8ArrayToHex:()=>zg,unwrapMessage:()=>fr});function Xh(e){return e}function eg(e){return e}function tg(e){}function rg(e){throw new Error("Unexpected value in exhaustive check")}function og(e){}function mr(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function bo(e,t="|"){return e.map(r=>xo(r)).join(t)}function At(e,t){return typeof t=="bigint"?t.toString():t}function Ct(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function hr(e){return e==null}function gr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function is(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var xc=Symbol("evaluating");function F(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==xc)return o===void 0&&(o=xc,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ng(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function nt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Be(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function sg(e){return Be(e._zod.def)}function ig(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function ag(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function cg(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function wo(e){return JSON.stringify(e)}function as(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var zo="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function vt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var cs=Ct(()=>{if(Nt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function st(e){if(vt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(vt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Sc(e){return st(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function ug(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var lg=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}`)}},us=new Set(["string","number","symbol"]),kc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ce(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function E(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 pg(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function xo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ls(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ps={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]},Pc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function dg(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=Be(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return nt(this,"shape",i),i},checks:[]});return Ce(e,s)}function fg(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=Be(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return nt(this,"shape",i),i},checks:[]});return Ce(e,s)}function mg(e,t){if(!st(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Be(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return nt(this,"shape",s),s}});return Ce(e,n)}function hg(e,t){if(!st(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Be(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return nt(this,"shape",o),o}});return Ce(e,r)}function gg(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Be(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return nt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ce(e,r)}function _g(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=Be(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return nt(this,"shape",c),c},checks:[]});return Ce(t,i)}function yg(e,t,r){let o=Be(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return nt(this,"shape",s),s}});return Ce(t,o)}function it(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 ds(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 Ye(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function fr(e){return typeof e=="string"?e:e?.message}function Te(e,t,r){let o=e.message?e.message:fr(e.inst?._zod.def?.error?.(e))??fr(t?.error?.(e))??fr(r.customError?.(e))??fr(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=o,t?.reportInput&&(a.input=i),a}function Ec(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function _r(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function fs(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 Zt(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function vg(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Tc(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Rc(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function $g(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Tc(t+r)}function bg(e){return Rc(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wg(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function zg(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ss=class{constructor(...t){}};var Ic=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,At,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},So=g("$ZodError",Ic),ms=g("$ZodError",Ic,{Parent:Error});function Oc(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function jc(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(e),r}var ko=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ve;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Te(c,s,Se())));throw zo(a,n?.callee),a}return i.value};var Po=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??e)(i.issues.map(c=>Te(c,s,Se())));throw zo(a,n?.callee),a}return i.value};var yr=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Ve;return s.issues.length?{success:!1,error:new(e??So)(s.issues.map(i=>Te(i,n,Se())))}:{success:!0,data:s.value}},vr=yr(ms),$r=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Te(i,n,Se())))}:{success:!0,data:s.value}},Eo=$r(ms),Nc=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ko(e)(t,r,n)};var Ac=e=>(t,r,o)=>ko(e)(t,r,o);var Cc=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Po(e)(t,r,n)};var Zc=e=>async(t,r,o)=>Po(e)(t,r,o);var Mc=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return yr(e)(t,r,n)};var qc=e=>(t,r,o)=>yr(e)(t,r,o);var Dc=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return $r(e)(t,r,n)};var Lc=e=>async(t,r,o)=>$r(e)(t,r,o);var Fc=/^[cC][0-9a-z]{6,}$/,Uc=/^[0-9a-z]+$/,Vc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Jc=/^[0-9a-vA-V]{20}$/,Gc=/^[A-Za-z0-9]{27}$/,Kc=/^[a-zA-Z0-9_-]{21}$/,Hc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Wc=/^([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})$/,hs=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 Bc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Sg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Qc(){return new RegExp(Sg,"u")}var Yc=/^(?:(?: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])$/,Xc=/^(([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 eu=/^((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])$/,tu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ru=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gs=/^[A-Za-z0-9_-]*$/;var ou=/^https?$/,nu=/^\+[1-9]\d{6,14}$/,su="(?:(?:\\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])))",iu=new RegExp(`^${su}$`);function au(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cu(e){return new RegExp(`^${au(e)}$`)}function uu(e){let t=au({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${su}T(?:${o})$`)}var lu=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var pu=/^-?\d+$/,_s=/^-?\d+(?:\.\d+)?$/,du=/^(?:true|false)$/i,fu=/^null$/i;var mu=/^[^A-Z]*$/,hu=/^[^a-z]*$/;var ie=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),gu={number:"number",bigint:"bigint",object:"date"},ys=g("$ZodCheckLessThan",(e,t)=>{ie.init(e,t);let r=gu[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vs=g("$ZodCheckGreaterThan",(e,t)=>{ie.init(e,t);let r=gu[typeof t.value];e._zod.onattach.push(o=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_u=g("$ZodCheckMultipleOf",(e,t)=>{ie.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):is(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})}}),yu=g("$ZodCheckNumberFormat",(e,t)=>{ie.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=ps[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=n,a.maximum=s,r&&(a.pattern=pu)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var vu=g("$ZodCheckMaxLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{let n=o.value;if(n.length<=t.maximum)return;let i=_r(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),$u=g("$ZodCheckMinLength",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{let n=o.value;if(n.length>=t.minimum)return;let i=_r(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),bu=g("$ZodCheckLengthEquals",(e,t)=>{var r;ie.init(e,t),(r=e._zod.def).when??(r.when=o=>{let n=o.value;return!hr(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{let n=o.value,s=n.length;if(s===t.length)return;let i=_r(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),br=g("$ZodCheckStringFormat",(e,t)=>{var r,o;ie.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),wu=g("$ZodCheckRegex",(e,t)=>{br.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})}}),zu=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=mu),br.init(e,t)}),xu=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=hu),br.init(e,t)}),Su=g("$ZodCheckIncludes",(e,t)=>{ie.init(e,t);let r=Qe(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),ku=g("$ZodCheckStartsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(`^${Qe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Pu=g("$ZodCheckEndsWith",(e,t)=>{ie.init(e,t);let r=new RegExp(`.*${Qe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Eu=g("$ZodCheckOverwrite",(e,t)=>{ie.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ro=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
10
- `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,n.join(`
11
- `))}};var Ru={major:4,minor:4,patch:3};var K=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ru;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,c)=>{let u=it(i),l;for(let p of a){if(p._zod.def.when){if(ds(i)||!p._zod.def.when(i))continue}else if(u)continue;let d=i.issues.length,f=p._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Ve;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=it(i,d)))});else{if(i.issues.length===d)continue;u||(u=it(i,d))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(it(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Ve;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Ve;return c.then(u=>n(u,o,a))}return n(c,o,a)}}F(e,"~standard",()=>({validate:n=>{try{let s=vr(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Eo(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),jo=g("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lu(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),H=g("$ZodStringFormat",(e,t)=>{br.init(e,t),jo.init(e,t)}),qu=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Wc),H.init(e,t)}),Du=g("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=hs(o))}else t.pattern??(t.pattern=hs());H.init(e,t)}),Lu=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Bc),H.init(e,t)}),Fu=g("$ZodURL",(e,t)=>{H.init(e,t),e._zod.check=r=>{try{let o=r.value.trim();if(!t.normalize&&t.protocol?.source===ou.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Uu=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Qc()),H.init(e,t)}),Vu=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Kc),H.init(e,t)}),Ju=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Fc),H.init(e,t)}),Gu=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Uc),H.init(e,t)}),Ku=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Vc),H.init(e,t)}),Hu=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Jc),H.init(e,t)}),Wu=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Gc),H.init(e,t)}),Bu=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=uu(t)),H.init(e,t)}),Qu=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=iu),H.init(e,t)}),Yu=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=cu(t)),H.init(e,t)}),Xu=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Hc),H.init(e,t)}),el=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Yc),H.init(e,t),e._zod.bag.format="ipv4"}),tl=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xc),H.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var rl=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=eu),H.init(e,t)}),ol=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tu),H.init(e,t),e._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function nl(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var sl=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ru),H.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{nl(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Eg(e){if(!gs.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return nl(r)}var il=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=gs),H.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Eg(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),al=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=nu),H.init(e,t)});function Tg(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var cl=g("$ZodJWT",(e,t)=>{H.init(e,t),e._zod.check=r=>{Tg(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var bs=g("$ZodNumber",(e,t)=>{K.init(e,t),e._zod.pattern=e._zod.bag.pattern??_s,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),ul=g("$ZodNumberFormat",(e,t)=>{yu.init(e,t),bs.init(e,t)}),ll=g("$ZodBoolean",(e,t)=>{K.init(e,t),e._zod.pattern=du,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var pl=g("$ZodNull",(e,t)=>{K.init(e,t),e._zod.pattern=fu,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}});var dl=g("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=r=>r}),fl=g("$ZodNever",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Iu(e,t,r){e.issues.length&&t.issues.push(...Ye(r,e.issues)),t.value[r]=e.value}var ml=g("$ZodArray",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=t.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>Iu(u,r,i))):Iu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Oo(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...Ye(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function hl(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=ls(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function gl(e,t,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",p=c.optout==="optional";for(let d in t){if(d==="__proto__"||a.has(d))continue;if(u==="never"){i.push(d);continue}let f=c.run({value:t[d],issues:[]},o);f instanceof Promise?e.push(f.then(m=>Oo(m,r,d,t,l,p))):Oo(f,r,d,t,l,p)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var Rg=g("$ZodObject",(e,t)=>{if(K.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let o=Ct(()=>hl(t));F(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let n=vt,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],p=i.shape;for(let d of i.keys){let f=p[d],m=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[d],issues:[]},c);y instanceof Promise?l.push(y.then(v=>Oo(v,a,d,u,m,_))):Oo(y,a,d,u,m,_)}return s?gl(l,u,a,c,o.value,e):l.length?Promise.all(l).then(()=>a):a}}),_l=g("$ZodObjectJIT",(e,t)=>{Rg.init(e,t);let r=e._zod.parse,o=Ct(()=>hl(t)),n=d=>{let f=new Ro(["shape","payload","ctx"]),m=o.value,_=z=>{let k=wo(z);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let z of m.keys)y[z]=`key_${v++}`;f.write("const newResult = {};");for(let z of m.keys){let k=y[z],w=wo(z),xe=d[z],Ee=xe?._zod?.optin==="optional",lr=xe?._zod?.optout==="optional";f.write(`const ${k} = ${_(z)};`),Ee&&lr?f.write(`
12
- if (${k}.issues.length) {
13
- if (${w} in input) {
14
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
8
+ depsCount: ${e},
9
+ deps: ${r}}`};var ix={keyword:"dependencies",type:"object",schemaType:"object",error:Ke.error,code(t){let[e,r]=ax(t);Jm(t,e),Wm(t,r)}};function ax({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function Jm(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,_o.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,_o.checkReportMissingProp)(t,u)}):(r.if((0,Da._)`${c} && (${(0,_o.checkMissingProp)(t,a,s)})`),(0,_o.reportMissingProp)(t,s),r.else())}}Ke.validatePropertyDeps=Jm;function Wm(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,sx.alwaysValidSchema)(s,e[a])||(r.if((0,_o.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Ke.validateSchemaDeps=Wm;Ke.default=ix});var Ym=$(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var Qm=O(),cx=D(),ux={message:"property name must be valid",params:({params:t})=>(0,Qm._)`{propertyName: ${t.propertyName}}`},lx={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ux,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,cx.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,Qm.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};qa.default=lx});var Fa=$(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var An=je(),Le=O(),px=rt(),Zn=D(),dx={message:"must NOT have additional properties",params:({params:t})=>(0,Le._)`{additionalProperty: ${t.additionalProperty}}`},fx={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:dx,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Zn.alwaysValidSchema)(i,r))return;let u=(0,An.allSchemaProperties)(o.properties),l=(0,An.allSchemaProperties)(o.patternProperties);p(),t.ok((0,Le._)`${s} === ${px.default.errors}`);function p(){e.forIn("key",n,y=>{!u.length&&!l.length?m(y):e.if(d(y),()=>m(y))})}function d(y){let v;if(u.length>8){let P=(0,Zn.schemaRefOrVal)(i,o.properties,"properties");v=(0,An.isOwnProperty)(e,P,y)}else u.length?v=(0,Le.or)(...u.map(P=>(0,Le._)`${y} === ${P}`)):v=Le.nil;return l.length&&(v=(0,Le.or)(v,...l.map(P=>(0,Le._)`${(0,An.usePattern)(t,P)}.test(${y})`))),(0,Le.not)(v)}function f(y){e.code((0,Le._)`delete ${n}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Zn.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(_(y,v,!1),e.if((0,Le.not)(v),()=>{t.reset(),f(y)})):(_(y,v),a||e.if((0,Le.not)(v),()=>e.break()))}}function _(y,v,P){let w={keyword:"additionalProperties",dataProp:y,dataPropType:Zn.Type.Str};P===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(w,v)}}};La.default=fx});var th=$(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var mx=ro(),Xm=je(),Ua=D(),eh=Fa(),hx={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&eh.default.code(new mx.KeywordCxt(s,eh.default,"additionalProperties"));let i=(0,Xm.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Ua.mergeEvaluated.props(e,(0,Ua.toHash)(i),s.props));let a=i.filter(p=>!(0,Ua.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=e.name("valid");for(let p of a)u(p)?l(p):(e.if((0,Xm.propertyInData)(e,n,p,s.opts.ownProperties)),l(p),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(p),t.ok(c);function u(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){t.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};Va.default=hx});var sh=$(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});var rh=je(),Mn=O(),oh=D(),nh=D(),gx={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,rh.allSchemaProperties)(r),c=a.filter(_=>(0,oh.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof Mn.Name)&&(s.props=(0,nh.evaluatedPropsToName)(e,s.props));let{props:p}=s;d();function d(){for(let _ of a)u&&f(_),s.allErrors?m(_):(e.var(l,!0),m(_),e.if(l))}function f(_){for(let y in u)new RegExp(_).test(y)&&(0,oh.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function m(_){e.forIn("key",o,y=>{e.if((0,Mn._)`${(0,rh.usePattern)(t,_)}.test(${y})`,()=>{let v=c.includes(_);v||t.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:nh.Type.Str},l),s.opts.unevaluated&&p!==!0?e.assign((0,Mn._)`${p}[${y}]`,!0):!v&&!s.allErrors&&e.if((0,Mn.not)(l),()=>e.break())})})}}};Ha.default=gx});var ih=$(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var _x=D(),yx={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,_x.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Ga.default=yx});var ah=$(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var vx=je(),$x={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:vx.validateUnion,error:{message:"must match a schema in anyOf"}};Ka.default=$x});var ch=$(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var Dn=O(),bx=D(),wx={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Dn._)`{passingSchemas: ${t.passing}}`},xx={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:wx,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,p)=>{let d;(0,bx.alwaysValidSchema)(n,l)?e.var(c,!0):d=t.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&e.if((0,Dn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Dn._)`[${a}, ${p}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,p),d&&t.mergeEvaluated(d,Dn.Name)})})}}};Ja.default=xx});var uh=$(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var Sx=D(),zx={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,Sx.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};Wa.default=zx});var dh=$(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});var qn=O(),ph=D(),kx={message:({params:t})=>(0,qn.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,qn._)`{failingKeyword: ${t.ifClause}}`},Px={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:kx,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,ph.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=lh(o,"then"),s=lh(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,qn.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,p){return()=>{let d=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(d,i),p?e.assign(p,(0,qn._)`${l}`):t.setParams({ifClause:l})}}}};function lh(t,e){let r=t.schema[e];return r!==void 0&&!(0,ph.alwaysValidSchema)(t,r)}Ba.default=Px});var fh=$(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});var Ex=D(),Tx={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Ex.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Qa.default=Tx});var mh=$(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});var Rx=ja(),Ix=Vm(),Ox=Ca(),Nx=Gm(),jx=Km(),Cx=Bm(),Ax=Ym(),Zx=Fa(),Mx=th(),Dx=sh(),qx=ih(),Lx=ah(),Fx=ch(),Ux=uh(),Vx=dh(),Hx=fh();function Gx(t=!1){let e=[qx.default,Lx.default,Fx.default,Ux.default,Vx.default,Hx.default,Ax.default,Zx.default,Cx.default,Mx.default,Dx.default];return t?e.push(Ix.default,Nx.default):e.push(Rx.default,Ox.default),e.push(jx.default),e}Ya.default=Gx});var hh=$(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});var oe=O(),Kx={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},Jx={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Kx,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:p}=a;if(!c.validateFormats)return;n?d():f();function d(){let m=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),_=r.const("fDef",(0,oe._)`${m}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,oe._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${_}.type || "string"`).assign(v,(0,oe._)`${_}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(v,_)),t.fail$data((0,oe.or)(P(),w()));function P(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${v}`}function w(){let S=l.$async?(0,oe._)`(${_}.async ? await ${v}(${o}) : ${v}(${o}))`:(0,oe._)`${v}(${o})`,x=(0,oe._)`(typeof ${v} == "function" ? ${S} : ${v}.test(${o}))`;return(0,oe._)`${v} && ${v} !== true && ${y} === ${e} && !${x}`}}function f(){let m=p.formats[s];if(!m){P();return}if(m===!0)return;let[_,y,v]=w(m);_===e&&t.pass(S());function P(){if(c.strictSchema===!1){p.logger.warn(x());return}throw new Error(x());function x(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function w(x){let ze=x instanceof RegExp?(0,oe.regexpCode)(x):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Te=r.scopeValue("formats",{key:s,ref:x,code:ze});return typeof x=="object"&&!(x instanceof RegExp)?[x.type||"string",x.validate,(0,oe._)`${Te}.validate`]:["string",x,Te]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${v}(${o})`}return typeof y=="function"?(0,oe._)`${v}(${o})`:(0,oe._)`${v}.test(${o})`}}}};Xa.default=Jx});var gh=$(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});var Wx=hh(),Bx=[Wx.default];ec.default=Bx});var _h=$(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.contentVocabulary=nr.metadataVocabulary=void 0;nr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];nr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var vh=$(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});var Qx=km(),Yx=qm(),Xx=mh(),eS=gh(),yh=_h(),tS=[Qx.default,Yx.default,(0,Xx.default)(),eS.default,yh.metadataVocabulary,yh.contentVocabulary];tc.default=tS});var bh=$(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.DiscrError=void 0;var $h;(function(t){t.Tag="tag",t.Mapping="mapping"})($h||(Ln.DiscrError=$h={}))});var xh=$(oc=>{"use strict";Object.defineProperty(oc,"__esModule",{value:!0});var sr=O(),rc=bh(),wh=Sn(),rS=oo(),oS=D(),nS={message:({params:{discrError:t,tagName:e}})=>t===rc.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,sr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},sS={keyword:"discriminator",type:"object",schemaType:"object",error:nS,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,sr._)`${r}${(0,sr.getProperty)(a)}`);e.if((0,sr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:rc.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=d();e.if(!1);for(let m in f)e.elseIf((0,sr._)`${u} === ${m}`),e.assign(c,p(f[m]));e.else(),t.error(!1,{discrError:rc.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function p(f){let m=e.name("valid"),_=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(_,sr.Name),m}function d(){var f;let m={},_=v(n),y=!0;for(let S=0;S<i.length;S++){let x=i[S];if(x?.$ref&&!(0,oS.schemaHasRulesButRef)(x,s.self.RULES)){let Te=x.$ref;if(x=wh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Te),x instanceof wh.SchemaEnv&&(x=x.schema),x===void 0)throw new rS.default(s.opts.uriResolver,s.baseId,Te)}let ze=(f=x?.properties)===null||f===void 0?void 0:f[a];if(typeof ze!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||v(x)),P(ze,S)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function v({required:S}){return Array.isArray(S)&&S.includes(a)}function P(S,x){if(S.const)w(S.const,x);else if(S.enum)for(let ze of S.enum)w(ze,x);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(S,x){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[S]=x}}}};oc.default=sS});var Sh=$((BO,iS)=>{iS.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 sc=$((Q,nc)=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.MissingRefError=Q.ValidationError=Q.CodeGen=Q.Name=Q.nil=Q.stringify=Q.str=Q._=Q.KeywordCxt=Q.Ajv=void 0;var aS=$m(),cS=vh(),uS=xh(),zh=Sh(),lS=["/properties"],Fn="http://json-schema.org/draft-07/schema",ir=class extends aS.default{_addVocabularies(){super._addVocabularies(),cS.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(uS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(zh,lS):zh;this.addMetaSchema(e,Fn,!1),this.refs["http://json-schema.org/schema"]=Fn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Fn)?Fn:void 0)}};Q.Ajv=ir;nc.exports=Q=ir;nc.exports.Ajv=ir;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=ir;var pS=ro();Object.defineProperty(Q,"KeywordCxt",{enumerable:!0,get:function(){return pS.KeywordCxt}});var ar=O();Object.defineProperty(Q,"_",{enumerable:!0,get:function(){return ar._}});Object.defineProperty(Q,"str",{enumerable:!0,get:function(){return ar.str}});Object.defineProperty(Q,"stringify",{enumerable:!0,get:function(){return ar.stringify}});Object.defineProperty(Q,"nil",{enumerable:!0,get:function(){return ar.nil}});Object.defineProperty(Q,"Name",{enumerable:!0,get:function(){return ar.Name}});Object.defineProperty(Q,"CodeGen",{enumerable:!0,get:function(){return ar.CodeGen}});var dS=wn();Object.defineProperty(Q,"ValidationError",{enumerable:!0,get:function(){return dS.default}});var fS=oo();Object.defineProperty(Q,"MissingRefError",{enumerable:!0,get:function(){return fS.default}})});var Nh=$(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.formatNames=We.fastFormats=We.fullFormats=void 0;function Je(t,e){return{validate:t,compare:e}}We.fullFormats={date:Je(Th,uc),time:Je(ac(!0),lc),"date-time":Je(kh(!0),Ih),"iso-time":Je(ac(),Rh),"iso-date-time":Je(kh(),Oh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:vS,"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:kS,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:$S,int32:{type:"number",validate:xS},int64:{type:"number",validate:SS},float:{type:"number",validate:Eh},double:{type:"number",validate:Eh},password:!0,binary:!0};We.fastFormats={...We.fullFormats,date:Je(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,uc),time:Je(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,lc),"date-time":Je(/^\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,Ih),"iso-time":Je(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Rh),"iso-date-time":Je(/^\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,Oh),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};We.formatNames=Object.keys(We.fullFormats);function mS(t){return t%4===0&&(t%100!==0||t%400===0)}var hS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Th(t){let e=hS.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&mS(r)?29:gS[o])}function uc(t,e){if(t&&e)return t>e?1:t<e?-1:0}var ic=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function ac(t){return function(r){let o=ic.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let p=s-l*c,d=n-u*c-(p<0?1:0);return(d===23||d===-1)&&(p===59||p===-1)&&i<61}}function lc(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function Rh(t,e){if(!(t&&e))return;let r=ic.exec(t),o=ic.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var cc=/t|\s/i;function kh(t){let e=ac(t);return function(o){let n=o.split(cc);return n.length===2&&Th(n[0])&&e(n[1])}}function Ih(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function Oh(t,e){if(!(t&&e))return;let[r,o]=t.split(cc),[n,s]=e.split(cc),i=uc(r,n);if(i!==void 0)return i||lc(o,s)}var _S=/\/|:/,yS=/^(?:[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 vS(t){return _S.test(t)&&yS.test(t)}var Ph=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function $S(t){return Ph.lastIndex=0,Ph.test(t)}var bS=-(2**31),wS=2**31-1;function xS(t){return Number.isInteger(t)&&t<=wS&&t>=bS}function SS(t){return Number.isInteger(t)}function Eh(){return!0}var zS=/[^\\]\\Z/;function kS(t){if(zS.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var jh=$(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.formatLimitDefinition=void 0;var PS=sc(),Fe=O(),yt=Fe.operators,Un={formatMaximum:{okStr:"<=",ok:yt.LTE,fail:yt.GT},formatMinimum:{okStr:">=",ok:yt.GTE,fail:yt.LT},formatExclusiveMaximum:{okStr:"<",ok:yt.LT,fail:yt.GTE},formatExclusiveMinimum:{okStr:">",ok:yt.GT,fail:yt.LTE}},ES={message:({keyword:t,schemaCode:e})=>(0,Fe.str)`should be ${Un[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Fe._)`{comparison: ${Un[t].okStr}, limit: ${e}}`};cr.formatLimitDefinition={keyword:Object.keys(Un),type:"string",schemaType:"string",$data:!0,error:ES,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new PS.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let d=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Fe._)`${d}[${c.schemaCode}]`);t.fail$data((0,Fe.or)((0,Fe._)`typeof ${f} != "object"`,(0,Fe._)`${f} instanceof RegExp`,(0,Fe._)`typeof ${f}.compare != "function"`,p(f)))}function l(){let d=c.schema,f=a.formats[d];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${d}" does not define "compare" function`);let m=e.scopeValue("formats",{key:d,ref:f,code:i.code.formats?(0,Fe._)`${i.code.formats}${(0,Fe.getProperty)(d)}`:void 0});t.fail$data(p(m))}function p(d){return(0,Fe._)`${d}.compare(${r}, ${o}) ${Un[n].fail} 0`}},dependencies:["format"]};var TS=t=>(t.addKeyword(cr.formatLimitDefinition),t);cr.default=TS});var Mh=$((yo,Zh)=>{"use strict";Object.defineProperty(yo,"__esModule",{value:!0});var ur=Nh(),RS=jh(),pc=O(),Ch=new pc.Name("fullFormats"),IS=new pc.Name("fastFormats"),dc=(t,e={keywords:!0})=>{if(Array.isArray(e))return Ah(t,e,ur.fullFormats,Ch),t;let[r,o]=e.mode==="fast"?[ur.fastFormats,IS]:[ur.fullFormats,Ch],n=e.formats||ur.formatNames;return Ah(t,n,r,o),e.keywords&&(0,RS.default)(t),t};dc.get=(t,e="full")=>{let o=(e==="fast"?ur.fastFormats:ur.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function Ah(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,pc._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}Zh.exports=yo=dc;Object.defineProperty(yo,"__esModule",{value:!0});yo.default=dc});var eg=require("node:util");var Nc;function g(t,e,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=i.prototype,l=Object.keys(u);for(let p=0;p<l.length;p++){let d=l[p];d in a||(a[d]=u[d].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var Tz=Symbol("zod_brand"),Ve=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ct=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Nc=globalThis).__zod_globalConfig??(Nc.__zod_globalConfig={});var At=globalThis.__zod_globalConfig;function ke(t){return t&&Object.assign(At,t),At}var M={};Oc(M,{BIGINT_FORMAT_RANGES:()=>Zc,Class:()=>ls,NUMBER_FORMAT_RANGES:()=>gs,aborted:()=>it,allowsEval:()=>fs,assert:()=>fg,assertEqual:()=>ug,assertIs:()=>pg,assertNever:()=>dg,assertNotEqual:()=>lg,assignProp:()=>nt,base64ToUint8Array:()=>Dc,base64urlToUint8Array:()=>Rg,cached:()=>Mt,captureStackTrace:()=>To,cleanEnum:()=>Tg,cleanRegex:()=>vr,clone:()=>Ze,cloneDef:()=>hg,createTransparentProxy:()=>bg,defineLazy:()=>F,esc:()=>Eo,escapeRegex:()=>Qe,explicitlyAborted:()=>_s,extend:()=>Sg,finalizeIssue:()=>Re,floatSafeRemainder:()=>ps,getElementAtPath:()=>gg,getEnumValues:()=>_r,getLengthableOrigin:()=>$r,getParsedType:()=>$g,getSizableOrigin:()=>Mc,hexToUint8Array:()=>Og,isObject:()=>vt,isPlainObject:()=>st,issue:()=>Dt,joinValues:()=>Po,jsonStringifyReplacer:()=>Zt,merge:()=>kg,mergeDefs:()=>Be,normalizeParams:()=>E,nullish:()=>yr,numKeys:()=>vg,objectClone:()=>mg,omit:()=>xg,optionalKeys:()=>hs,parsedType:()=>ys,partial:()=>Pg,pick:()=>wg,prefixIssues:()=>Ye,primitiveTypes:()=>Ac,promiseAllObject:()=>_g,propertyKeyTypes:()=>ms,randomString:()=>yg,required:()=>Eg,safeExtend:()=>zg,shallowClone:()=>Cc,slugify:()=>ds,stringifyPrimitive:()=>Ro,uint8ArrayToBase64:()=>qc,uint8ArrayToBase64url:()=>Ig,uint8ArrayToHex:()=>Ng,unwrapMessage:()=>gr});function ug(t){return t}function lg(t){return t}function pg(t){}function dg(t){throw new Error("Unexpected value in exhaustive check")}function fg(t){}function _r(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function Po(t,e="|"){return t.map(r=>Ro(r)).join(e)}function Zt(t,e){return typeof e=="bigint"?e.toString():e}function Mt(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function yr(t){return t==null}function vr(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function ps(t,e){let r=t/e,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var jc=Symbol("evaluating");function F(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==jc)return o===void 0&&(o=jc,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function mg(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function nt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Be(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function hg(t){return Be(t._zod.def)}function gg(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function _g(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<e.length;s++)n[e[s]]=o[s];return n})}function yg(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function Eo(t){return JSON.stringify(t)}function ds(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var To="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function vt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var fs=Mt(()=>{if(At.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function st(t){if(vt(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(vt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Cc(t){return st(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function vg(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var $g=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},ms=new Set(["string","number","symbol"]),Ac=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Qe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function E(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function bg(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,s){return e??(e=t()),Reflect.set(e,o,n,s)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function Ro(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function hs(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var gs={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]},Zc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function wg(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=Be(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return nt(this,"shape",i),i},checks:[]});return Ze(t,s)}function xg(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=Be(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return nt(this,"shape",i),i},checks:[]});return Ze(t,s)}function Sg(t,e){if(!st(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let i in e)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Be(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return nt(this,"shape",s),s}});return Ze(t,n)}function zg(t,e){if(!st(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Be(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return nt(this,"shape",o),o}});return Ze(t,r)}function kg(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Be(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return nt(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Ze(t,r)}function Pg(t,e,r){let n=e._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=Be(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=t?new t({type:"optional",innerType:a[u]}):a[u];return nt(this,"shape",c),c},checks:[]});return Ze(e,i)}function Eg(t,e,r){let o=Be(e._zod.def,{get shape(){let n=e._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new t({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new t({type:"nonoptional",innerType:n[i]});return nt(this,"shape",s),s}});return Ze(e,o)}function it(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function _s(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function Ye(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function gr(t){return typeof t=="string"?t:t?.message}function Re(t,e,r){let o=t.message?t.message:gr(t.inst?._zod.def?.error?.(t))??gr(e?.error?.(t))??gr(r.customError?.(t))??gr(r.localeError?.(t))??"Invalid input",{inst:n,continue:s,input:i,...a}=t;return a.path??(a.path=[]),a.message=o,e?.reportInput&&(a.input=i),a}function Mc(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function $r(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function ys(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Dt(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Tg(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Dc(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function qc(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Rg(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Dc(e+r)}function Ig(t){return qc(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Og(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)r[o/2]=Number.parseInt(e.slice(o,o+2),16);return r}function Ng(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var ls=class{constructor(...e){}};var Lc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Zt,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Io=g("$ZodError",Lc),vs=g("$ZodError",Lc,{Parent:Error});function Fc(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function Uc(t,e=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(e(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(e(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(t),r}var Oo=t=>(e,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ve;if(i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Re(c,s,ke())));throw To(a,n?.callee),a}return i.value};var No=t=>async(e,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Re(c,s,ke())));throw To(a,n?.callee),a}return i.value};var br=t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Ve;return s.issues.length?{success:!1,error:new(t??Io)(s.issues.map(i=>Re(i,n,ke())))}:{success:!0,data:s.value}},wr=br(vs),xr=t=>async(e,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Re(i,n,ke())))}:{success:!0,data:s.value}},jo=xr(vs),Vc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Oo(t)(e,r,n)};var Hc=t=>(e,r,o)=>Oo(t)(e,r,o);var Gc=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return No(t)(e,r,n)};var Kc=t=>async(e,r,o)=>No(t)(e,r,o);var Jc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return br(t)(e,r,n)};var Wc=t=>(e,r,o)=>br(t)(e,r,o);var Bc=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return xr(t)(e,r,n)};var Qc=t=>async(e,r,o)=>xr(t)(e,r,o);var Yc=/^[cC][0-9a-z]{6,}$/,Xc=/^[0-9a-z]+$/,eu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tu=/^[0-9a-vA-V]{20}$/,ru=/^[A-Za-z0-9]{27}$/,ou=/^[a-zA-Z0-9_-]{21}$/,nu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var su=/^([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})$/,$s=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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 iu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Cg="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function au(){return new RegExp(Cg,"u")}var cu=/^(?:(?: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])$/,uu=/^(([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 lu=/^((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])$/,pu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,du=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bs=/^[A-Za-z0-9_-]*$/;var fu=/^https?$/,mu=/^\+[1-9]\d{6,14}$/,hu="(?:(?:\\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])))",gu=new RegExp(`^${hu}$`);function _u(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yu(t){return new RegExp(`^${_u(t)}$`)}function vu(t){let e=_u({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${e}(?:${r.join("|")})`;return new RegExp(`^${hu}T(?:${o})$`)}var $u=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var bu=/^-?\d+$/,ws=/^-?\d+(?:\.\d+)?$/,wu=/^(?:true|false)$/i,xu=/^null$/i;var Su=/^[^A-Z]*$/,zu=/^[^a-z]*$/;var ie=g("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),ku={number:"number",bigint:"bigint",object:"date"},xs=g("$ZodCheckLessThan",(t,e)=>{ie.init(t,e);let r=ku[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Ss=g("$ZodCheckGreaterThan",(t,e)=>{ie.init(t,e);let r=ku[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Pu=g("$ZodCheckMultipleOf",(t,e)=>{ie.init(t,e),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):ps(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Eu=g("$ZodCheckNumberFormat",(t,e)=>{ie.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,s]=gs[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=n,a.maximum=s,r&&(a.pattern=bu)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});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:t,origin:o,inclusive:!0,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}});var Tu=g("$ZodCheckMaxLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!yr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let n=o.value;if(n.length<=e.maximum)return;let i=$r(n);o.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Ru=g("$ZodCheckMinLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!yr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;if(n.length>=e.minimum)return;let i=$r(n);o.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Iu=g("$ZodCheckLengthEquals",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!yr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=o=>{let n=o.value,s=n.length;if(s===e.length)return;let i=$r(n),a=s>e.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),Sr=g("$ZodCheckStringFormat",(t,e)=>{var r,o;ie.init(t,e),t._zod.onattach.push(n=>{let s=n._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),Ou=g("$ZodCheckRegex",(t,e)=>{Sr.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Nu=g("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Su),Sr.init(t,e)}),ju=g("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=zu),Sr.init(t,e)}),Cu=g("$ZodCheckIncludes",(t,e)=>{ie.init(t,e);let r=Qe(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=o,t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),Au=g("$ZodCheckStartsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`^${Qe(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),Zu=g("$ZodCheckEndsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`.*${Qe(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});var Mu=g("$ZodCheckOverwrite",(t,e)=>{ie.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Ao=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
10
+ `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,n.join(`
11
+ `))}};var qu={major:4,minor:4,patch:3};var K=g("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=qu;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let n of o)for(let s of n._zod.onattach)s(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(i,a,c)=>{let u=it(i),l;for(let p of a){if(p._zod.def.when){if(_s(i)||!p._zod.def.when(i))continue}else if(u)continue;let d=i.issues.length,f=p._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Ve;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==d&&(u||(u=it(i,d)))});else{if(i.issues.length===d)continue;u||(u=it(i,d))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(it(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Ve;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(i,a)=>{if(a.skipChecks)return t._zod.parse(i,a);if(a.direction==="backward"){let u=t._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=t._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Ve;return c.then(u=>n(u,o,a))}return n(c,o,a)}}F(t,"~standard",()=>({validate:n=>{try{let s=wr(t,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return jo(t,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Do=g("$ZodString",(t,e)=>{K.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??$u(t._zod.bag),t._zod.parse=(r,o)=>{if(e.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:t}),r}}),J=g("$ZodStringFormat",(t,e)=>{Sr.init(t,e),Do.init(t,e)}),Wu=g("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=su),J.init(t,e)}),Bu=g("$ZodUUID",(t,e)=>{if(e.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(o===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=$s(o))}else e.pattern??(e.pattern=$s());J.init(t,e)}),Qu=g("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=iu),J.init(t,e)}),Yu=g("$ZodURL",(t,e)=>{J.init(t,e),t._zod.check=r=>{try{let o=r.value.trim();if(!e.normalize&&e.protocol?.source===fu.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}let n=new URL(o);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Xu=g("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=au()),J.init(t,e)}),el=g("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=ou),J.init(t,e)}),tl=g("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Yc),J.init(t,e)}),rl=g("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Xc),J.init(t,e)}),ol=g("$ZodULID",(t,e)=>{e.pattern??(e.pattern=eu),J.init(t,e)}),nl=g("$ZodXID",(t,e)=>{e.pattern??(e.pattern=tu),J.init(t,e)}),sl=g("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=ru),J.init(t,e)}),il=g("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=vu(e)),J.init(t,e)}),al=g("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=gu),J.init(t,e)}),cl=g("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=yu(e)),J.init(t,e)}),ul=g("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=nu),J.init(t,e)}),ll=g("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=cu),J.init(t,e),t._zod.bag.format="ipv4"}),pl=g("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=uu),J.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var dl=g("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=lu),J.init(t,e)}),fl=g("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=pu),J.init(t,e),t._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function ml(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var hl=g("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=du),J.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{ml(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Mg(t){if(!bs.test(t))return!1;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return ml(r)}var gl=g("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=bs),J.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Mg(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),_l=g("$ZodE164",(t,e)=>{e.pattern??(e.pattern=mu),J.init(t,e)});function Dg(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}var yl=g("$ZodJWT",(t,e)=>{J.init(t,e),t._zod.check=r=>{Dg(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var ks=g("$ZodNumber",(t,e)=>{K.init(t,e),t._zod.pattern=t._zod.bag.pattern??ws,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),vl=g("$ZodNumberFormat",(t,e)=>{Eu.init(t,e),ks.init(t,e)}),$l=g("$ZodBoolean",(t,e)=>{K.init(t,e),t._zod.pattern=wu,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}});var bl=g("$ZodNull",(t,e)=>{K.init(t,e),t._zod.pattern=xu,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}});var wl=g("$ZodUnknown",(t,e)=>{K.init(t,e),t._zod.parse=r=>r}),xl=g("$ZodNever",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Lu(t,e,r){t.issues.length&&e.issues.push(...Ye(r,t.issues)),e.value[r]=t.value}var Sl=g("$ZodArray",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=e.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>Lu(u,r,i))):Lu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Mo(t,e,r,o,n,s){let i=r in o;if(t.issues.length){if(n&&s&&!i)return;e.issues.push(...Ye(r,t.issues))}if(!i&&!n){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?i&&(e.value[r]=void 0):e.value[r]=t.value}function zl(t){let e=Object.keys(t.shape);for(let o of e)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=hs(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function kl(t,e,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",p=c.optout==="optional";for(let d in e){if(d==="__proto__"||a.has(d))continue;if(u==="never"){i.push(d);continue}let f=c.run({value:e[d],issues:[]},o);f instanceof Promise?t.push(f.then(m=>Mo(m,r,d,e,l,p))):Mo(f,r,d,e,l,p)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}var qg=g("$ZodObject",(t,e)=>{if(K.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let o=Mt(()=>zl(e));F(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let p of l.values)c[u].add(p)}}return c});let n=vt,s=e.catchall,i;t._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],p=i.shape;for(let d of i.keys){let f=p[d],m=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[d],issues:[]},c);y instanceof Promise?l.push(y.then(v=>Mo(v,a,d,u,m,_))):Mo(y,a,d,u,m,_)}return s?kl(l,u,a,c,o.value,t):l.length?Promise.all(l).then(()=>a):a}}),Pl=g("$ZodObjectJIT",(t,e)=>{qg.init(t,e);let r=t._zod.parse,o=Mt(()=>zl(e)),n=d=>{let f=new Ao(["shape","payload","ctx"]),m=o.value,_=w=>{let S=Eo(w);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let w of m.keys)y[w]=`key_${v++}`;f.write("const newResult = {};");for(let w of m.keys){let S=y[w],x=Eo(w),ze=d[w],Te=ze?._zod?.optin==="optional",fr=ze?._zod?.optout==="optional";f.write(`const ${S} = ${_(w)};`),Te&&fr?f.write(`
12
+ if (${S}.issues.length) {
13
+ if (${x} in input) {
14
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
15
15
  ...iss,
16
- path: iss.path ? [${w}, ...iss.path] : [${w}]
16
+ path: iss.path ? [${x}, ...iss.path] : [${x}]
17
17
  })));
18
18
  }
19
19
  }
20
20
 
21
- if (${k}.value === undefined) {
22
- if (${w} in input) {
23
- newResult[${w}] = undefined;
21
+ if (${S}.value === undefined) {
22
+ if (${x} in input) {
23
+ newResult[${x}] = undefined;
24
24
  }
25
25
  } else {
26
- newResult[${w}] = ${k}.value;
26
+ newResult[${x}] = ${S}.value;
27
27
  }
28
28
 
29
- `):Ee?f.write(`
30
- if (${k}.issues.length) {
31
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
29
+ `):Te?f.write(`
30
+ if (${S}.issues.length) {
31
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
32
32
  ...iss,
33
- path: iss.path ? [${w}, ...iss.path] : [${w}]
33
+ path: iss.path ? [${x}, ...iss.path] : [${x}]
34
34
  })));
35
35
  }
36
36
 
37
- if (${k}.value === undefined) {
38
- if (${w} in input) {
39
- newResult[${w}] = undefined;
37
+ if (${S}.value === undefined) {
38
+ if (${x} in input) {
39
+ newResult[${x}] = undefined;
40
40
  }
41
41
  } else {
42
- newResult[${w}] = ${k}.value;
42
+ newResult[${x}] = ${S}.value;
43
43
  }
44
44
 
45
45
  `):f.write(`
46
- const ${k}_present = ${w} in input;
47
- if (${k}.issues.length) {
48
- payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
46
+ const ${S}_present = ${x} in input;
47
+ if (${S}.issues.length) {
48
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
49
49
  ...iss,
50
- path: iss.path ? [${w}, ...iss.path] : [${w}]
50
+ path: iss.path ? [${x}, ...iss.path] : [${x}]
51
51
  })));
52
52
  }
53
- if (!${k}_present && !${k}.issues.length) {
53
+ if (!${S}_present && !${S}.issues.length) {
54
54
  payload.issues.push({
55
55
  code: "invalid_type",
56
56
  expected: "nonoptional",
57
57
  input: undefined,
58
- path: [${w}]
58
+ path: [${x}]
59
59
  });
60
60
  }
61
61
 
62
- if (${k}_present) {
63
- if (${k}.value === undefined) {
64
- newResult[${w}] = undefined;
62
+ if (${S}_present) {
63
+ if (${S}.value === undefined) {
64
+ newResult[${x}] = undefined;
65
65
  } else {
66
- newResult[${w}] = ${k}.value;
66
+ newResult[${x}] = ${S}.value;
67
67
  }
68
68
  }
69
69
 
70
- `)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(z,k)=>P(d,z,k)},s,i=vt,a=!Nt.jitless,u=a&&cs.value,l=t.catchall,p;e._zod.parse=(d,f)=>{p??(p=o.value);let m=d.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(t.shape)),d=s(d,f),l?gl([],m,d,f,p,e):d):r(d,f):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d)}});function Ou(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!it(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Te(i,o,Se())))}),t)}var ws=g("$ZodUnion",(e,t)=>{K.init(e,t),F(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),F(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),F(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),F(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>gr(n.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Ou(a,o,e,n)):Ou(i,o,e,n)}});var yl=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ws.init(e,t);let r=e._zod.parse;F(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=Ct(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!vt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);return a?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),vl=g("$ZodIntersection",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ju(r,c,u)):ju(r,s,i)}});function $s(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(st(e)&&st(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=$s(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=$s(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ju(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&e.issues.push({...n,keys:s}),it(e))return e;let i=$s(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var $l=g("$ZodRecord",(e,t)=>{K.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!st(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Te(f,o,Se())),input:u,path:[u],inst:e});continue}let p=l.value,d=t.valueType._zod.run({value:n[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&r.issues.push(...Ye(u,f.issues)),r.value[p]=f.value})):(d.issues.length&&r.issues.push(...Ye(u,d.issues)),r.value[p]=d.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&_s.test(a)&&c.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){t.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Te(p,o,Se())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(p=>{p.issues.length&&r.issues.push(...Ye(a,p.issues)),r.value[c.value]=p.value})):(l.issues.length&&r.issues.push(...Ye(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var bl=g("$ZodEnum",(e,t)=>{K.init(e,t);let r=mr(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>us.has(typeof n)).map(n=>typeof n=="string"?Qe(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),wl=g("$ZodLiteral",(e,t)=>{if(K.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?Qe(o):o?Qe(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var zl=g("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new jt(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Ve;return r.value=n,r.fallback=!0,r}});function Nu(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var zs=g("$ZodOptional",(e,t)=>{K.init(e,t),e._zod.optin="optional",e._zod.optout="optional",F(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),F(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${gr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>Nu(i,n)):Nu(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),xl=g("$ZodExactOptional",(e,t)=>{zs.init(e,t),F(e._zod,"values",()=>t.innerType._zod.values),F(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Sl=g("$ZodNullable",(e,t)=>{K.init(e,t),F(e._zod,"optin",()=>t.innerType._zod.optin),F(e._zod,"optout",()=>t.innerType._zod.optout),F(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${gr(r.source)}|null)$`):void 0}),F(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),kl=g("$ZodDefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Au(s,t)):Au(n,t)}});function Au(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Pl=g("$ZodPrefault",(e,t)=>{K.init(e,t),e._zod.optin="optional",F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),El=g("$ZodNonOptional",(e,t)=>{K.init(e,t),F(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Cu(s,e)):Cu(n,e)}});function Cu(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Tl=g("$ZodCatch",(e,t)=>{K.init(e,t),e._zod.optin="optional",F(e._zod,"optout",()=>t.innerType._zod.optout),F(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Te(i,o,Se()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>Te(s,o,Se()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var xs=g("$ZodPipe",(e,t)=>{K.init(e,t),F(e._zod,"values",()=>t.in._zod.values),F(e._zod,"optin",()=>t.in._zod.optin),F(e._zod,"optout",()=>t.out._zod.optout),F(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Io(i,t.in,o)):Io(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Io(s,t.out,o)):Io(n,t.out,o)}});function Io(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Rl=g("$ZodPreprocess",(e,t)=>{xs.init(e,t)}),Il=g("$ZodReadonly",(e,t)=>{K.init(e,t),F(e._zod,"propValues",()=>t.innerType._zod.propValues),F(e._zod,"values",()=>t.innerType._zod.values),F(e._zod,"optin",()=>t.innerType?._zod?.optin),F(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Zu):Zu(n)}});function Zu(e){return e.value=Object.freeze(e.value),e}var Ol=g("$ZodCustom",(e,t)=>{ie.init(e,t),K.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Mu(s,r,o,e));Mu(n,r,o,e)}});function Mu(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Zt(n))}}var Ig=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=fs(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${xo(n.values[0])}`:`Invalid option: expected one of ${bo(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${bo(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function jl(){return{localeError:Ig()}}var Nl,wS=Symbol("ZodOutput"),zS=Symbol("ZodInput"),Ss=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Og(){return new Ss}(Nl=globalThis).__zod_globalRegistry??(Nl.__zod_globalRegistry=Og());var $t=globalThis.__zod_globalRegistry;function Al(e,t){return new e({type:"string",...E(t)})}function Cl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function ks(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function Zl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function Ml(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function ql(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function Dl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function Ll(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function Fl(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function Ul(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function Vl(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function Jl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function Gl(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function Kl(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function Hl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function Wl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function Bl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function Ql(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function Yl(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function Xl(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function ep(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function tp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function rp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}function op(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function np(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function sp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function ip(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function ap(e,t){return new e({type:"number",checks:[],...E(t)})}function cp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}function up(e,t){return new e({type:"boolean",...E(t)})}function lp(e,t){return new e({type:"null",...E(t)})}function pp(e){return new e({type:"unknown"})}function dp(e,t){return new e({type:"never",...E(t)})}function No(e,t){return new ys({check:"less_than",...E(t),value:e,inclusive:!1})}function wr(e,t){return new ys({check:"less_than",...E(t),value:e,inclusive:!0})}function Ao(e,t){return new vs({check:"greater_than",...E(t),value:e,inclusive:!1})}function zr(e,t){return new vs({check:"greater_than",...E(t),value:e,inclusive:!0})}function Co(e,t){return new _u({check:"multiple_of",...E(t),value:e})}function Zo(e,t){return new vu({check:"max_length",...E(t),maximum:e})}function Mt(e,t){return new $u({check:"min_length",...E(t),minimum:e})}function Mo(e,t){return new bu({check:"length_equals",...E(t),length:e})}function Ps(e,t){return new wu({check:"string_format",format:"regex",...E(t),pattern:e})}function Es(e){return new zu({check:"string_format",format:"lowercase",...E(e)})}function Ts(e){return new xu({check:"string_format",format:"uppercase",...E(e)})}function Rs(e,t){return new Su({check:"string_format",format:"includes",...E(t),includes:e})}function Is(e,t){return new ku({check:"string_format",format:"starts_with",...E(t),prefix:e})}function Os(e,t){return new Pu({check:"string_format",format:"ends_with",...E(t),suffix:e})}function at(e){return new Eu({check:"overwrite",tx:e})}function js(e){return at(t=>t.normalize(e))}function Ns(){return at(e=>e.trim())}function As(){return at(e=>e.toLowerCase())}function Cs(){return at(e=>e.toUpperCase())}function Zs(){return at(e=>as(e))}function fp(e,t,r){return new e({type:"array",element:t,...E(r)})}function mp(e,t,r){let o=E(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function hp(e,t,r){return new e({type:"custom",check:"custom",fn:t,...E(r)})}function gp(e,t){let r=jg(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Zt(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Zt(s))}},e(o.value,o)),t);return r}function jg(e,t){let r=new ie({check:"custom",...E(t)});return r._zod.check=e,r}function Ms(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??$t,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function re(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let d=i.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,d,l)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),re(p,t,l),t.seen.get(p).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&he(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function qs(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,d=e.external.uri??(m=>m);if(p)return{ref:d(p)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${d("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];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>
70
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(w,S)=>P(d,w,S)},s,i=vt,a=!At.jitless,u=a&&fs.value,l=e.catchall,p;t._zod.parse=(d,f)=>{p??(p=o.value);let m=d.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(e.shape)),d=s(d,f),l?kl([],m,d,f,p,t):d):r(d,f):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d)}});function Fu(t,e,r,o){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let n=t.filter(s=>!it(s));return n.length===1?(e.value=n[0].value,n[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(i=>Re(i,o,ke())))}),e)}var Ps=g("$ZodUnion",(t,e)=>{K.init(t,e),F(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),F(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),F(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),F(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>vr(n.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of e.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Fu(a,o,t,n)):Fu(i,o,t,n)}});var El=g("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Ps.init(t,e);let r=t._zod.parse;F(t._zod,"propValues",()=>{let n={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=Mt(()=>{let n=e.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(n,s)=>{let i=n.value;if(!vt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),n;let a=o.value.get(i?.[e.discriminator]);return a?a._zod.run(n,s):e.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(o.value.keys()),input:i,path:[e.discriminator],inst:t}),n)}}),Tl=g("$ZodIntersection",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value,s=e.left._zod.run({value:n,issues:[]},o),i=e.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Uu(r,c,u)):Uu(r,s,i)}});function zs(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(st(t)&&st(e)){let r=Object.keys(e),o=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(let s of o){let i=zs(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<t.length;o++){let n=t[o],s=e[o],i=zs(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Uu(t,e,r){let o=new Map,n;for(let a of e.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else t.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&t.issues.push({...n,keys:s}),it(t))return t;let i=zs(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}var Rl=g("$ZodRecord",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!st(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let s=[],i=e.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Re(f,o,ke())),input:u,path:[u],inst:t});continue}let p=l.value,d=e.valueType._zod.run({value:n[u],issues:[]},o);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&r.issues.push(...Ye(u,f.issues)),r.value[p]=f.value})):(d.issues.length&&r.issues.push(...Ye(u,d.issues)),r.value[p]=d.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&ws.test(a)&&c.issues.length){let p=e.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(c=p)}if(c.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(p=>Re(p,o,ke())),input:a,path:[a],inst:t});continue}let l=e.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(p=>{p.issues.length&&r.issues.push(...Ye(a,p.issues)),r.value[c.value]=p.value})):(l.issues.length&&r.issues.push(...Ye(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Il=g("$ZodEnum",(t,e)=>{K.init(t,e);let r=_r(e.entries),o=new Set(r);t._zod.values=o,t._zod.pattern=new RegExp(`^(${r.filter(n=>ms.has(typeof n)).map(n=>typeof n=="string"?Qe(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),Ol=g("$ZodLiteral",(t,e)=>{if(K.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(o=>typeof o=="string"?Qe(o):o?Qe(o.toString()):String(o)).join("|")})$`),t._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),o}});var Nl=g("$ZodTransform",(t,e)=>{K.init(t,e),t._zod.optin="optional",t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ct(t.constructor.name);let n=e.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Ve;return r.value=n,r.fallback=!0,r}});function Vu(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var Es=g("$ZodOptional",(t,e)=>{K.init(t,e),t._zod.optin="optional",t._zod.optout="optional",F(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),F(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${vr(r.source)})?$`):void 0}),t._zod.parse=(r,o)=>{if(e.innerType._zod.optin==="optional"){let n=r.value,s=e.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>Vu(i,n)):Vu(s,n)}return r.value===void 0?r:e.innerType._zod.run(r,o)}}),jl=g("$ZodExactOptional",(t,e)=>{Es.init(t,e),F(t._zod,"values",()=>e.innerType._zod.values),F(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,o)=>e.innerType._zod.run(r,o)}),Cl=g("$ZodNullable",(t,e)=>{K.init(t,e),F(t._zod,"optin",()=>e.innerType._zod.optin),F(t._zod,"optout",()=>e.innerType._zod.optout),F(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${vr(r.source)}|null)$`):void 0}),F(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,o)=>r.value===null?r:e.innerType._zod.run(r,o)}),Al=g("$ZodDefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",F(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Hu(s,e)):Hu(n,e)}});function Hu(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Zl=g("$ZodPrefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",F(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,o))}),Ml=g("$ZodNonOptional",(t,e)=>{K.init(t,e),F(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Gu(s,t)):Gu(n,t)}});function Gu(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var Dl=g("$ZodCatch",(t,e)=>{K.init(t,e),t._zod.optin="optional",F(t._zod,"optout",()=>e.innerType._zod.optout),F(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Re(i,o,ke()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>Re(s,o,ke()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var Ts=g("$ZodPipe",(t,e)=>{K.init(t,e),F(t._zod,"values",()=>e.in._zod.values),F(t._zod,"optin",()=>e.in._zod.optin),F(t._zod,"optout",()=>e.out._zod.optout),F(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=e.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Zo(i,e.in,o)):Zo(s,e.in,o)}let n=e.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Zo(s,e.out,o)):Zo(n,e.out,o)}});function Zo(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}var ql=g("$ZodPreprocess",(t,e)=>{Ts.init(t,e)}),Ll=g("$ZodReadonly",(t,e)=>{K.init(t,e),F(t._zod,"propValues",()=>e.innerType._zod.propValues),F(t._zod,"values",()=>e.innerType._zod.values),F(t._zod,"optin",()=>e.innerType?._zod?.optin),F(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(Ku):Ku(n)}});function Ku(t){return t.value=Object.freeze(t.value),t}var Fl=g("$ZodCustom",(t,e)=>{ie.init(t,e),K.init(t,e),t._zod.parse=(r,o)=>r,t._zod.check=r=>{let o=r.value,n=e.fn(o);if(n instanceof Promise)return n.then(s=>Ju(s,r,o,t));Ju(n,r,o,t)}});function Ju(t,e,r,o){if(!t){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),e.issues.push(Dt(n))}}var Lg=()=>{let t={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 e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=ys(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${Ro(n.values[0])}`:`Invalid option: expected one of ${Po(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Po(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Ul(){return{localeError:Lg()}}var Vl,Hz=Symbol("ZodOutput"),Gz=Symbol("ZodInput"),Rs=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let o=r[0];return this._map.set(e,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Fg(){return new Rs}(Vl=globalThis).__zod_globalRegistry??(Vl.__zod_globalRegistry=Fg());var $t=globalThis.__zod_globalRegistry;function Hl(t,e){return new t({type:"string",...E(e)})}function Gl(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function Is(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function Kl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function Jl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function Wl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function Bl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function Ql(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function Yl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function Xl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function ep(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function tp(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function rp(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function op(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function np(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function sp(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function ip(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function ap(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function cp(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function up(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function lp(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function pp(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function dp(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function fp(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function mp(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function hp(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function gp(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function _p(t,e){return new t({type:"number",checks:[],...E(e)})}function yp(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function vp(t,e){return new t({type:"boolean",...E(e)})}function $p(t,e){return new t({type:"null",...E(e)})}function bp(t){return new t({type:"unknown"})}function wp(t,e){return new t({type:"never",...E(e)})}function qo(t,e){return new xs({check:"less_than",...E(e),value:t,inclusive:!1})}function zr(t,e){return new xs({check:"less_than",...E(e),value:t,inclusive:!0})}function Lo(t,e){return new Ss({check:"greater_than",...E(e),value:t,inclusive:!1})}function kr(t,e){return new Ss({check:"greater_than",...E(e),value:t,inclusive:!0})}function Fo(t,e){return new Pu({check:"multiple_of",...E(e),value:t})}function Uo(t,e){return new Tu({check:"max_length",...E(e),maximum:t})}function qt(t,e){return new Ru({check:"min_length",...E(e),minimum:t})}function Vo(t,e){return new Iu({check:"length_equals",...E(e),length:t})}function Os(t,e){return new Ou({check:"string_format",format:"regex",...E(e),pattern:t})}function Ns(t){return new Nu({check:"string_format",format:"lowercase",...E(t)})}function js(t){return new ju({check:"string_format",format:"uppercase",...E(t)})}function Cs(t,e){return new Cu({check:"string_format",format:"includes",...E(e),includes:t})}function As(t,e){return new Au({check:"string_format",format:"starts_with",...E(e),prefix:t})}function Zs(t,e){return new Zu({check:"string_format",format:"ends_with",...E(e),suffix:t})}function at(t){return new Mu({check:"overwrite",tx:t})}function Ms(t){return at(e=>e.normalize(t))}function Ds(){return at(t=>t.trim())}function qs(){return at(t=>t.toLowerCase())}function Ls(){return at(t=>t.toUpperCase())}function Fs(){return at(t=>ds(t))}function xp(t,e,r){return new t({type:"array",element:e,...E(r)})}function Sp(t,e,r){let o=E(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function zp(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function kp(t,e){let r=Ug(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Dt(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Dt(s))}},t(o.value,o)),e);return r}function Ug(t,e){let r=new ie({check:"custom",...E(e)});return r._zod.check=t,r}function Us(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??$t,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function re(t,e,r={path:[],schemaPath:[]}){var o;let n=t._zod.def,s=e.seen.get(t);if(s)return s.count++,r.schemaPath.includes(t)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,i);let a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,l);else{let d=i.schema,f=e.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(t,e,d,l)}let p=t._zod.parent;p&&(i.ref||(i.ref=p),re(p,e,l),e.seen.get(p).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&ge(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function Vs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of t.seen.entries()){let a=t.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let p=t.external.registry.get(i[0])?.id,d=t.external.uri??(m=>m);if(p)return{ref:d(p)};let f=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=f,{defId:f,ref:`${d("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let p in l)delete l[p];l.$ref=c};if(t.cycles==="throw")for(let i of t.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
71
71
 
72
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Ds(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){o(p);let f=e.seen.get(p),m=f.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$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 d=a._zod.parent;if(d&&d!==p){o(d);let f=e.seen.get(d);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())o(a[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:xr(t,"input",e.processors),output:xr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function he(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return he(o.element,r);if(o.type==="set")return he(o.valueType,r);if(o.type==="lazy")return he(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return he(o.innerType,r);if(o.type==="intersection")return he(o.left,r)||he(o.right,r);if(o.type==="record"||o.type==="map")return he(o.keyType,r)||he(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:he(o.in,r)||he(o.out,r);if(o.type==="object"){for(let n in o.shape)if(he(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(he(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(he(n,r))return!0;return!!(o.rest&&he(o.rest,r))}return!1}var _p=(e,t={})=>r=>{let o=Ms({...r,processors:t});return re(e,o),qs(o,e),Ds(o,e)},xr=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Ms({...n??{},target:s,io:t,processors:r});return re(e,i),qs(i,e),Ds(i,e)};var Ng={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yp=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=Ng[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},vp=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),d=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";p?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),d?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},$p=(e,t,r,o)=>{r.type="boolean"};var bp=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var wp=(e,t,r,o)=>{r.not={}};var zp=(e,t,r,o)=>{};var xp=(e,t,r,o)=>{let n=e._zod.def,s=mr(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Sp=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var kp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Pp=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Ep=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=re(s.element,t,{...o,path:[...o.path,"items"]})},Tp=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=re(i[u],t,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=re(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Rp=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>re(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Ip=(e,t,r,o)=>{let n=e._zod.def,s=re(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=re(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var Op=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)n.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=re(s.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=re(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(n.required=l)}},jp=(e,t,r,o)=>{let n=e._zod.def,s=re(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Np=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Ap=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Cp=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Zp=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Mp=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;re(i,t,o);let a=t.seen.get(e);a.ref=i},qp=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var Ls=(e,t,r,o)=>{let n=e._zod.def;re(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType};function qt(e){return!!e._zod}function ct(e,t){return qt(e)?vr(e,t):e.safeParse(t)}function qo(e){if(!e)return;let t;if(qt(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Dp(e){if(qt(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o}var kr={};wc(kr,{ZodISODate:()=>Fp,ZodISODateTime:()=>Lp,ZodISODuration:()=>Vp,ZodISOTime:()=>Up,date:()=>Us,datetime:()=>Fs,duration:()=>Js,time:()=>Vs});var Lp=g("ZodISODateTime",(e,t)=>{Bu.init(e,t),Y.init(e,t)});function Fs(e){return op(Lp,e)}var Fp=g("ZodISODate",(e,t)=>{Qu.init(e,t),Y.init(e,t)});function Us(e){return np(Fp,e)}var Up=g("ZodISOTime",(e,t)=>{Yu.init(e,t),Y.init(e,t)});function Vs(e){return sp(Up,e)}var Vp=g("ZodISODuration",(e,t)=>{Xu.init(e,t),Y.init(e,t)});function Js(e){return ip(Vp,e)}var Ug=(e,t)=>{So.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>jc(e,r)},flatten:{value:r=>Oc(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,At,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,At,2)}},isEmpty:{get(){return e.issues.length===0}}})};var ke=g("ZodError",Ug,{Parent:Error});var Jp=ko(ke),Gp=Po(ke),Kp=yr(ke),Hp=$r(ke),Wp=Nc(ke),Bp=Ac(ke),Qp=Cc(ke),Yp=Zc(ke),Xp=Mc(ke),ed=qc(ke),td=Dc(ke),rd=Lc(ke);var od=new WeakMap;function Pr(e,t,r){let o=Object.getPrototypeOf(e),n=od.get(o);if(n||(n=new Set,od.set(o,n)),!n.has(t)){n.add(t);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var te=g("ZodType",(e,t)=>(K.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:xr(e,"input"),output:xr(e,"output")}}),e.toJSONSchema=_p(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Jp(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>Kp(e,r,o),e.parseAsync=async(r,o)=>Gp(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Hp(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Wp(e,r,o),e.decode=(r,o)=>Bp(e,r,o),e.encodeAsync=async(r,o)=>Qp(e,r,o),e.decodeAsync=async(r,o)=>Yp(e,r,o),e.safeEncode=(r,o)=>Xp(e,r,o),e.safeDecode=(r,o)=>ed(e,r,o),e.safeEncodeAsync=async(r,o)=>td(e,r,o),e.safeDecodeAsync=async(r,o)=>rd(e,r,o),Pr(e,"ZodType",{check(...r){let o=this.def;return this.clone(M.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ce(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(j_(r,o))},superRefine(r,o){return this.check(N_(r,o))},overwrite(r){return this.check(at(r))},optional(){return ee(this)},exactOptional(){return b_(this)},nullable(){return ad(this)},nullish(){return ee(ad(this))},nonoptional(r){return P_(this,r)},array(){return C(this)},or(r){return W([this,r])},and(r){return Lo(this,r)},transform(r){return cd(this,md(r))},default(r){return x_(this,r)},prefault(r){return k_(this,r)},catch(r){return T_(this,r)},pipe(r){return cd(this,r)},readonly(){return O_(this)},describe(r){let o=this.clone();return $t.add(o,{description:r}),o},meta(...r){if(r.length===0)return $t.get(this);let o=this.clone();return $t.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return $t.get(e)?.description},configurable:!0}),e)),ud=g("_ZodString",(e,t)=>{jo.init(e,t),te.init(e,t),e._zod.processJSONSchema=(o,n,s)=>yp(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Pr(e,"_ZodString",{regex(...o){return this.check(Ps(...o))},includes(...o){return this.check(Rs(...o))},startsWith(...o){return this.check(Is(...o))},endsWith(...o){return this.check(Os(...o))},min(...o){return this.check(Mt(...o))},max(...o){return this.check(Zo(...o))},length(...o){return this.check(Mo(...o))},nonempty(...o){return this.check(Mt(1,...o))},lowercase(o){return this.check(Es(o))},uppercase(o){return this.check(Ts(o))},trim(){return this.check(Ns())},normalize(...o){return this.check(js(...o))},toLowerCase(){return this.check(As())},toUpperCase(){return this.check(Cs())},slugify(){return this.check(Zs())}})}),Jg=g("ZodString",(e,t)=>{jo.init(e,t),ud.init(e,t),e.email=r=>e.check(Cl(Gg,r)),e.url=r=>e.check(Ll(Kg,r)),e.jwt=r=>e.check(rp(c_,r)),e.emoji=r=>e.check(Fl(Hg,r)),e.guid=r=>e.check(ks(nd,r)),e.uuid=r=>e.check(Zl(Do,r)),e.uuidv4=r=>e.check(Ml(Do,r)),e.uuidv6=r=>e.check(ql(Do,r)),e.uuidv7=r=>e.check(Dl(Do,r)),e.nanoid=r=>e.check(Ul(Wg,r)),e.guid=r=>e.check(ks(nd,r)),e.cuid=r=>e.check(Vl(Bg,r)),e.cuid2=r=>e.check(Jl(Qg,r)),e.ulid=r=>e.check(Gl(Yg,r)),e.base64=r=>e.check(Xl(s_,r)),e.base64url=r=>e.check(ep(i_,r)),e.xid=r=>e.check(Kl(Xg,r)),e.ksuid=r=>e.check(Hl(e_,r)),e.ipv4=r=>e.check(Wl(t_,r)),e.ipv6=r=>e.check(Bl(r_,r)),e.cidrv4=r=>e.check(Ql(o_,r)),e.cidrv6=r=>e.check(Yl(n_,r)),e.e164=r=>e.check(tp(a_,r)),e.datetime=r=>e.check(Fs(r)),e.date=r=>e.check(Us(r)),e.time=r=>e.check(Vs(r)),e.duration=r=>e.check(Js(r))});function h(e){return Al(Jg,e)}var Y=g("ZodStringFormat",(e,t)=>{H.init(e,t),ud.init(e,t)}),Gg=g("ZodEmail",(e,t)=>{Lu.init(e,t),Y.init(e,t)});var nd=g("ZodGUID",(e,t)=>{qu.init(e,t),Y.init(e,t)});var Do=g("ZodUUID",(e,t)=>{Du.init(e,t),Y.init(e,t)});var Kg=g("ZodURL",(e,t)=>{Fu.init(e,t),Y.init(e,t)});var Hg=g("ZodEmoji",(e,t)=>{Uu.init(e,t),Y.init(e,t)});var Wg=g("ZodNanoID",(e,t)=>{Vu.init(e,t),Y.init(e,t)});var Bg=g("ZodCUID",(e,t)=>{Ju.init(e,t),Y.init(e,t)});var Qg=g("ZodCUID2",(e,t)=>{Gu.init(e,t),Y.init(e,t)});var Yg=g("ZodULID",(e,t)=>{Ku.init(e,t),Y.init(e,t)});var Xg=g("ZodXID",(e,t)=>{Hu.init(e,t),Y.init(e,t)});var e_=g("ZodKSUID",(e,t)=>{Wu.init(e,t),Y.init(e,t)});var t_=g("ZodIPv4",(e,t)=>{el.init(e,t),Y.init(e,t)});var r_=g("ZodIPv6",(e,t)=>{tl.init(e,t),Y.init(e,t)});var o_=g("ZodCIDRv4",(e,t)=>{rl.init(e,t),Y.init(e,t)});var n_=g("ZodCIDRv6",(e,t)=>{ol.init(e,t),Y.init(e,t)});var s_=g("ZodBase64",(e,t)=>{sl.init(e,t),Y.init(e,t)});var i_=g("ZodBase64URL",(e,t)=>{il.init(e,t),Y.init(e,t)});var a_=g("ZodE164",(e,t)=>{al.init(e,t),Y.init(e,t)});var c_=g("ZodJWT",(e,t)=>{cl.init(e,t),Y.init(e,t)});var ld=g("ZodNumber",(e,t)=>{bs.init(e,t),te.init(e,t),e._zod.processJSONSchema=(o,n,s)=>vp(e,o,n,s),Pr(e,"ZodNumber",{gt(o,n){return this.check(Ao(o,n))},gte(o,n){return this.check(zr(o,n))},min(o,n){return this.check(zr(o,n))},lt(o,n){return this.check(No(o,n))},lte(o,n){return this.check(wr(o,n))},max(o,n){return this.check(wr(o,n))},int(o){return this.check(sd(o))},safe(o){return this.check(sd(o))},positive(o){return this.check(Ao(0,o))},nonnegative(o){return this.check(zr(0,o))},negative(o){return this.check(No(0,o))},nonpositive(o){return this.check(wr(0,o))},multipleOf(o,n){return this.check(Co(o,n))},step(o,n){return this.check(Co(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function U(e){return ap(ld,e)}var u_=g("ZodNumberFormat",(e,t)=>{ul.init(e,t),ld.init(e,t)});function sd(e){return cp(u_,e)}var l_=g("ZodBoolean",(e,t)=>{ll.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$p(e,r,o,n)});function se(e){return up(l_,e)}var p_=g("ZodNull",(e,t)=>{pl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bp(e,r,o,n)});function pd(e){return lp(p_,e)}var d_=g("ZodUnknown",(e,t)=>{dl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zp(e,r,o,n)});function X(){return pp(d_)}var f_=g("ZodNever",(e,t)=>{fl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wp(e,r,o,n)});function m_(e){return dp(f_,e)}var h_=g("ZodArray",(e,t)=>{ml.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ep(e,r,o,n),e.element=t.element,Pr(e,"ZodArray",{min(r,o){return this.check(Mt(r,o))},nonempty(r){return this.check(Mt(1,r))},max(r,o){return this.check(Zo(r,o))},length(r,o){return this.check(Mo(r,o))},unwrap(){return this.element}})});function C(e,t){return fp(h_,e,t)}var dd=g("ZodObject",(e,t)=>{_l.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tp(e,r,o,n),M.defineLazy(e,"shape",()=>t.shape),Pr(e,"ZodObject",{keyof(){return ve(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:m_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return M.extend(this,r)},safeExtend(r){return M.safeExtend(this,r)},merge(r){return M.merge(this,r)},pick(r){return M.pick(this,r)},omit(r){return M.omit(this,r)},partial(...r){return M.partial(hd,this,r[0])},required(...r){return M.required(gd,this,r[0])}})});function b(e,t){let r={type:"object",shape:e??{},...M.normalizeParams(t)};return new dd(r)}function ge(e,t){return new dd({type:"object",shape:e,catchall:X(),...M.normalizeParams(t)})}var fd=g("ZodUnion",(e,t)=>{ws.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rp(e,r,o,n),e.options=t.options});function W(e,t){return new fd({type:"union",options:e,...M.normalizeParams(t)})}var g_=g("ZodDiscriminatedUnion",(e,t)=>{fd.init(e,t),yl.init(e,t)});function Ks(e,t,r){return new g_({type:"union",options:t,discriminator:e,...M.normalizeParams(r)})}var __=g("ZodIntersection",(e,t)=>{vl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ip(e,r,o,n)});function Lo(e,t){return new __({type:"intersection",left:e,right:t})}var id=g("ZodRecord",(e,t)=>{$l.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Op(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function G(e,t,r){return!t||!t._zod?new id({type:"record",keyType:h(),valueType:e,...M.normalizeParams(t)}):new id({type:"record",keyType:e,valueType:t,...M.normalizeParams(r)})}var Gs=g("ZodEnum",(e,t)=>{bl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(o,n,s)=>xp(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Gs({...t,checks:[],...M.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Gs({...t,checks:[],...M.normalizeParams(n),entries:s})}});function ve(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Gs({type:"enum",entries:r,...M.normalizeParams(t)})}var y_=g("ZodLiteral",(e,t)=>{wl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sp(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function x(e,t){return new y_({type:"literal",values:Array.isArray(e)?e:[e],...M.normalizeParams(t)})}var v_=g("ZodTransform",(e,t)=>{zl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pp(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new jt(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(M.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(M.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function md(e){return new v_({type:"transform",transform:e})}var hd=g("ZodOptional",(e,t)=>{zs.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ls(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ee(e){return new hd({type:"optional",innerType:e})}var $_=g("ZodExactOptional",(e,t)=>{xl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ls(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function b_(e){return new $_({type:"optional",innerType:e})}var w_=g("ZodNullable",(e,t)=>{Sl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ad(e){return new w_({type:"nullable",innerType:e})}var z_=g("ZodDefault",(e,t)=>{kl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ap(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function x_(e,t){return new z_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():M.shallowClone(t)}})}var S_=g("ZodPrefault",(e,t)=>{Pl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function k_(e,t){return new S_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():M.shallowClone(t)}})}var gd=g("ZodNonOptional",(e,t)=>{El.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Np(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function P_(e,t){return new gd({type:"nonoptional",innerType:e,...M.normalizeParams(t)})}var E_=g("ZodCatch",(e,t)=>{Tl.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function T_(e,t){return new E_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var _d=g("ZodPipe",(e,t)=>{xs.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mp(e,r,o,n),e.in=t.in,e.out=t.out});function cd(e,t){return new _d({type:"pipe",in:e,out:t})}var R_=g("ZodPreprocess",(e,t)=>{_d.init(e,t),Rl.init(e,t)}),I_=g("ZodReadonly",(e,t)=>{Il.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qp(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function O_(e){return new I_({type:"readonly",innerType:e})}var yd=g("ZodCustom",(e,t)=>{Ol.init(e,t),te.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kp(e,r,o,n)});function vd(e,t){return mp(yd,e??(()=>!0),t)}function j_(e,t={}){return hp(yd,e,t)}function N_(e,t){return gp(e,t)}function Hs(e,t){return new R_({type:"pipe",in:md(e),out:t})}Se(jl());var Bs="2025-11-25";var $d=[Bs,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ut="io.modelcontextprotocol/related-task",Uo="2.0",ne=vd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),bd=W([h(),U().int()]),wd=h(),EP=ge({ttl:U().optional(),pollInterval:U().optional()}),A_=b({ttl:U().optional()}),C_=b({taskId:h()}),Qs=ge({progressToken:bd.optional(),[ut]:C_.optional()}),Pe=b({_meta:Qs.optional()}),Er=Pe.extend({task:A_.optional()}),zd=e=>Er.safeParse(e).success,ae=b({method:h(),params:Pe.loose().optional()}),Re=b({_meta:Qs.optional()}),Ie=b({method:h(),params:Re.loose().optional()}),ce=ge({_meta:Qs.optional()}),Vo=W([h(),U().int()]),xd=b({jsonrpc:x(Uo),id:Vo,...ae.shape}).strict(),Ys=e=>xd.safeParse(e).success,Sd=b({jsonrpc:x(Uo),...Ie.shape}).strict(),kd=e=>Sd.safeParse(e).success,Xs=b({jsonrpc:x(Uo),id:Vo,result:ce}).strict(),Tr=e=>Xs.safeParse(e).success;var A;(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"})(A||(A={}));var ei=b({jsonrpc:x(Uo),id:Vo.optional(),error:b({code:U().int(),message:h(),data:X().optional()})}).strict();var Pd=e=>ei.safeParse(e).success;var Ed=W([xd,Sd,Xs,ei]),TP=W([Xs,ei]),Jo=ce.strict(),Z_=Re.extend({requestId:Vo.optional(),reason:h().optional()}),Go=Ie.extend({method:x("notifications/cancelled"),params:Z_}),M_=b({src:h(),mimeType:h().optional(),sizes:C(h()).optional(),theme:ve(["light","dark"]).optional()}),Rr=b({icons:C(M_).optional()}),Dt=b({name:h(),title:h().optional()}),Td=Dt.extend({...Dt.shape,...Rr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),q_=Lo(b({applyDefaults:se().optional()}),G(h(),X())),D_=Hs(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Lo(b({form:q_.optional(),url:ne.optional()}),G(h(),X()).optional())),L_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({sampling:ge({createMessage:ne.optional()}).optional(),elicitation:ge({create:ne.optional()}).optional()}).optional()}),F_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({tools:ge({call:ne.optional()}).optional()}).optional()}),U_=b({experimental:G(h(),ne).optional(),sampling:b({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:D_.optional(),roots:b({listChanged:se().optional()}).optional(),tasks:L_.optional(),extensions:G(h(),ne).optional()}),V_=Pe.extend({protocolVersion:h(),capabilities:U_,clientInfo:Td}),ti=ae.extend({method:x("initialize"),params:V_});var J_=b({experimental:G(h(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:b({listChanged:se().optional()}).optional(),resources:b({subscribe:se().optional(),listChanged:se().optional()}).optional(),tools:b({listChanged:se().optional()}).optional(),tasks:F_.optional(),extensions:G(h(),ne).optional()}),G_=ce.extend({protocolVersion:h(),capabilities:J_,serverInfo:Td,instructions:h().optional()}),ri=Ie.extend({method:x("notifications/initialized"),params:Re.optional()});var Ko=ae.extend({method:x("ping"),params:Pe.optional()}),K_=b({progress:U(),total:ee(U()),message:ee(h())}),H_=b({...Re.shape,...K_.shape,progressToken:bd}),Ho=Ie.extend({method:x("notifications/progress"),params:H_}),W_=Pe.extend({cursor:wd.optional()}),Ir=ae.extend({params:W_.optional()}),Or=ce.extend({nextCursor:wd.optional()}),B_=ve(["working","input_required","completed","failed","cancelled"]),jr=b({taskId:h(),status:B_,ttl:W([U(),pd()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ee(U()),statusMessage:ee(h())}),Lt=ce.extend({task:jr}),Q_=Re.merge(jr),Nr=Ie.extend({method:x("notifications/tasks/status"),params:Q_}),Wo=ae.extend({method:x("tasks/get"),params:Pe.extend({taskId:h()})}),Bo=ce.merge(jr),Qo=ae.extend({method:x("tasks/result"),params:Pe.extend({taskId:h()})}),RP=ce.loose(),Yo=Ir.extend({method:x("tasks/list")}),Xo=Or.extend({tasks:C(jr)}),en=ae.extend({method:x("tasks/cancel"),params:Pe.extend({taskId:h()})}),Rd=ce.merge(jr),Id=b({uri:h(),mimeType:ee(h()),_meta:G(h(),X()).optional()}),Od=Id.extend({text:h()}),oi=h().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),jd=Id.extend({blob:oi}),Ar=ve(["user","assistant"]),Ft=b({audience:C(Ar).optional(),priority:U().min(0).max(1).optional(),lastModified:kr.datetime({offset:!0}).optional()}),Nd=b({...Dt.shape,...Rr.shape,uri:h(),description:ee(h()),mimeType:ee(h()),size:ee(U()),annotations:Ft.optional(),_meta:ee(ge({}))}),Y_=b({...Dt.shape,...Rr.shape,uriTemplate:h(),description:ee(h()),mimeType:ee(h()),annotations:Ft.optional(),_meta:ee(ge({}))}),X_=Ir.extend({method:x("resources/list")}),ey=Or.extend({resources:C(Nd)}),ty=Ir.extend({method:x("resources/templates/list")}),ry=Or.extend({resourceTemplates:C(Y_)}),ni=Pe.extend({uri:h()}),oy=ni,ny=ae.extend({method:x("resources/read"),params:oy}),sy=ce.extend({contents:C(W([Od,jd]))}),iy=Ie.extend({method:x("notifications/resources/list_changed"),params:Re.optional()}),ay=ni,cy=ae.extend({method:x("resources/subscribe"),params:ay}),uy=ni,ly=ae.extend({method:x("resources/unsubscribe"),params:uy}),py=Re.extend({uri:h()}),dy=Ie.extend({method:x("notifications/resources/updated"),params:py}),fy=b({name:h(),description:ee(h()),required:ee(se())}),my=b({...Dt.shape,...Rr.shape,description:ee(h()),arguments:ee(C(fy)),_meta:ee(ge({}))}),hy=Ir.extend({method:x("prompts/list")}),gy=Or.extend({prompts:C(my)}),_y=Pe.extend({name:h(),arguments:G(h(),h()).optional()}),yy=ae.extend({method:x("prompts/get"),params:_y}),si=b({type:x("text"),text:h(),annotations:Ft.optional(),_meta:G(h(),X()).optional()}),ii=b({type:x("image"),data:oi,mimeType:h(),annotations:Ft.optional(),_meta:G(h(),X()).optional()}),ai=b({type:x("audio"),data:oi,mimeType:h(),annotations:Ft.optional(),_meta:G(h(),X()).optional()}),vy=b({type:x("tool_use"),name:h(),id:h(),input:G(h(),X()),_meta:G(h(),X()).optional()}),$y=b({type:x("resource"),resource:W([Od,jd]),annotations:Ft.optional(),_meta:G(h(),X()).optional()}),by=Nd.extend({type:x("resource_link")}),ci=W([si,ii,ai,by,$y]),wy=b({role:Ar,content:ci}),zy=ce.extend({description:h().optional(),messages:C(wy)}),xy=Ie.extend({method:x("notifications/prompts/list_changed"),params:Re.optional()}),Sy=b({title:h().optional(),readOnlyHint:se().optional(),destructiveHint:se().optional(),idempotentHint:se().optional(),openWorldHint:se().optional()}),ky=b({taskSupport:ve(["required","optional","forbidden"]).optional()}),Ad=b({...Dt.shape,...Rr.shape,description:h().optional(),inputSchema:b({type:x("object"),properties:G(h(),ne).optional(),required:C(h()).optional()}).catchall(X()),outputSchema:b({type:x("object"),properties:G(h(),ne).optional(),required:C(h()).optional()}).catchall(X()).optional(),annotations:Sy.optional(),execution:ky.optional(),_meta:G(h(),X()).optional()}),ui=Ir.extend({method:x("tools/list")}),Py=Or.extend({tools:C(Ad)}),tn=ce.extend({content:C(ci).default([]),structuredContent:G(h(),X()).optional(),isError:se().optional()}),IP=tn.or(ce.extend({toolResult:X()})),Ey=Er.extend({name:h(),arguments:G(h(),X()).optional()}),Cr=ae.extend({method:x("tools/call"),params:Ey}),Ty=Ie.extend({method:x("notifications/tools/list_changed"),params:Re.optional()}),OP=b({autoRefresh:se().default(!0),debounceMs:U().int().nonnegative().default(300)}),Zr=ve(["debug","info","notice","warning","error","critical","alert","emergency"]),Ry=Pe.extend({level:Zr}),li=ae.extend({method:x("logging/setLevel"),params:Ry}),Iy=Re.extend({level:Zr,logger:h().optional(),data:X()}),Oy=Ie.extend({method:x("notifications/message"),params:Iy}),jy=b({name:h().optional()}),Ny=b({hints:C(jy).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),Ay=b({mode:ve(["auto","required","none"]).optional()}),Cy=b({type:x("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:C(ci).default([]),structuredContent:b({}).loose().optional(),isError:se().optional(),_meta:G(h(),X()).optional()}),Zy=Ks("type",[si,ii,ai]),Fo=Ks("type",[si,ii,ai,vy,Cy]),My=b({role:Ar,content:W([Fo,C(Fo)]),_meta:G(h(),X()).optional()}),qy=Er.extend({messages:C(My),modelPreferences:Ny.optional(),systemPrompt:h().optional(),includeContext:ve(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:C(h()).optional(),metadata:ne.optional(),tools:C(Ad).optional(),toolChoice:Ay.optional()}),Dy=ae.extend({method:x("sampling/createMessage"),params:qy}),Mr=ce.extend({model:h(),stopReason:ee(ve(["endTurn","stopSequence","maxTokens"]).or(h())),role:Ar,content:Zy}),pi=ce.extend({model:h(),stopReason:ee(ve(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Ar,content:W([Fo,C(Fo)])}),Ly=b({type:x("boolean"),title:h().optional(),description:h().optional(),default:se().optional()}),Fy=b({type:x("string"),title:h().optional(),description:h().optional(),minLength:U().optional(),maxLength:U().optional(),format:ve(["email","uri","date","date-time"]).optional(),default:h().optional()}),Uy=b({type:ve(["number","integer"]),title:h().optional(),description:h().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),Vy=b({type:x("string"),title:h().optional(),description:h().optional(),enum:C(h()),default:h().optional()}),Jy=b({type:x("string"),title:h().optional(),description:h().optional(),oneOf:C(b({const:h(),title:h()})),default:h().optional()}),Gy=b({type:x("string"),title:h().optional(),description:h().optional(),enum:C(h()),enumNames:C(h()).optional(),default:h().optional()}),Ky=W([Vy,Jy]),Hy=b({type:x("array"),title:h().optional(),description:h().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({type:x("string"),enum:C(h())}),default:C(h()).optional()}),Wy=b({type:x("array"),title:h().optional(),description:h().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({anyOf:C(b({const:h(),title:h()}))}),default:C(h()).optional()}),By=W([Hy,Wy]),Qy=W([Gy,Ky,By]),Yy=W([Qy,Ly,Fy,Uy]),Xy=Er.extend({mode:x("form").optional(),message:h(),requestedSchema:b({type:x("object"),properties:G(h(),Yy),required:C(h()).optional()})}),ev=Er.extend({mode:x("url"),message:h(),elicitationId:h(),url:h().url()}),tv=W([Xy,ev]),rv=ae.extend({method:x("elicitation/create"),params:tv}),ov=Re.extend({elicitationId:h()}),nv=Ie.extend({method:x("notifications/elicitation/complete"),params:ov}),Ut=ce.extend({action:ve(["accept","decline","cancel"]),content:Hs(e=>e===null?void 0:e,G(h(),W([h(),U(),se(),C(h())])).optional())}),sv=b({type:x("ref/resource"),uri:h()});var iv=b({type:x("ref/prompt"),name:h()}),av=Pe.extend({ref:W([iv,sv]),argument:b({name:h(),value:h()}),context:b({arguments:G(h(),h()).optional()}).optional()}),cv=ae.extend({method:x("completion/complete"),params:av});var uv=ce.extend({completion:ge({values:C(h()).max(100),total:ee(U().int()),hasMore:ee(se())})}),lv=b({uri:h().startsWith("file://"),name:h().optional(),_meta:G(h(),X()).optional()}),pv=ae.extend({method:x("roots/list"),params:Pe.optional()}),di=ce.extend({roots:C(lv)}),dv=Ie.extend({method:x("notifications/roots/list_changed"),params:Re.optional()}),jP=W([Ko,ti,cv,li,yy,hy,X_,ty,ny,cy,ly,Cr,ui,Wo,Qo,Yo,en]),NP=W([Go,Ho,ri,dv,Nr]),AP=W([Jo,Mr,pi,Ut,di,Bo,Xo,Lt]),CP=W([Ko,Dy,rv,pv,Wo,Qo,Yo,en]),ZP=W([Go,Ho,Oy,dy,iy,Ty,xy,Nr,nv]),MP=W([Jo,G_,uv,zy,gy,ey,ry,sy,tn,Py,Bo,Xo,Lt]),R=class e extends Error{constructor(t,r,o){super(`MCP error ${t}: ${r}`),this.code=t,this.data=o,this.name="McpError"}static fromError(t,r,o){if(t===A.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Ws(n.elicitations,r)}return new e(t,r,o)}},Ws=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(A.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function lt(e){return e==="completed"||e==="failed"||e==="cancelled"}var fv=Symbol("Let zodToJsonSchema decide on which parser to use");var _E=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fi(e){let r=qo(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=Dp(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function mi(e,t){let r=ct(e,t);if(!r.success)throw r.error;return r.data}var vv=6e4,rn=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(Go,r=>{this._oncancel(r)}),this.setNotificationHandler(Ho,r=>{this._onprogress(r)}),this.setRequestHandler(Ko,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Wo,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(A.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Qo,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let p=c,d=new R(p.error.code,p.error.message,p.error.data);l(d)}else{let p=a.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new R(A.InvalidParams,`Task not found: ${s}`);if(!lt(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(lt(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ut]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Yo,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new R(A.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(en,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(A.InvalidParams,`Task not found: ${r.params.taskId}`);if(lt(n.status))throw new R(A.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new R(A.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof R?n:new R(A.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,o,n,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),R.fromError(A.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),Tr(s)||Pd(s)?this._onresponse(s):Ys(s)?this._onrequest(s,i):kd(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(A.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of t.values())o(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(t,r){let o=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,n=this._transport,s=t.params?._meta?.[ut]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:A.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):n?.send(l).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);let a=zd(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let p={relatedRequestId:t.id};s&&(p.relatedTask={taskId:s}),await this.notification(l,p)},sendRequest:async(l,p,d)=>{if(i.signal.aborted)throw new R(A.ConnectionClosed,"Request was cancelled");let f={...d,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let m=f.relatedTask?.taskId??s;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,p,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(()=>o(t,u)).then(async l=>{if(i.signal.aborted)return;let p={result:l,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)},async l=>{if(i.signal.aborted)return;let p={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:A.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...o}=t.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(t){let r=Number(t.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),Tr(t))o(t);else{let i=new R(t.error.code,t.error.message,t.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(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))n(t);else{let i=R.fromError(t.error.code,t.error.message,t.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(t,r,o)}}catch(i){yield{type:"error",error:i instanceof R?i:new R(A.InternalError,String(i))}}return}let s;try{let i=await this.request(t,Lt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(A.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},lt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new R(A.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(A.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(A.InternalError,String(i))}}}request(t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let p=P=>{l(P)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(P){p(P);return}o?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:d};o?.onprogress&&(this._progressHandlers.set(d,o.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:d}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ut]:c}});let m=P=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(P)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));let z=P instanceof R?P:new R(A.RequestTimeout,String(P));l(z)};this._responseHandlers.set(d,P=>{if(!o?.signal?.aborted){if(P instanceof Error)return l(P);try{let z=ct(r,P.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),o?.signal?.addEventListener("abort",()=>{m(o?.signal?.reason)});let _=o?.timeout??vv,y=()=>m(R.fromError(A.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(d,_,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let P=z=>{let k=this._responseHandlers.get(d);k?k(z):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,P),this._enqueueTaskMessage(v,{type:"request",message:f,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(d),l(z)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(d),l(P)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Bo,r)}async getTaskResult(t,r,o){return this.request({method:"tasks/result",params:t},r,o)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Xo,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Rd,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let o=r?.relatedTask?.taskId;if(o){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[ut]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ut]: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||{},[ut]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let o=fi(t);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=mi(t,n);return Promise.resolve(r(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let o=fi(t);this._notificationHandlers.set(o,n=>{let s=mi(t,n);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,o,n)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(t,r);for(let n of o)if(n.type==="request"&&Ys(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new R(A.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(t);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new R(A.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(A.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!t)throw new Error("No request provided");return await o.createTask(n,t.id,{method:t.method,params:t.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new R(A.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Nr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),lt(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new R(A.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(lt(a.status))throw new R(A.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Nr.parse({method:"notifications/tasks/status",params:c});await this.notification(u),lt(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function Cd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Zd(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];Cd(i)&&Cd(s)?r[n]={...i,...s}:r[n]=s}return r}var Th=dr(ec(),1),Rh=dr(Eh(),1);function wx(){let e=new Th.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Rh.default)(e),e}var Mn=class{constructor(t){this._ajv=t??wx()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var qn=class{constructor(t){this._server=t}requestStream(t,r,o){return this._server.requestStream(t,r,o)}createMessageStream(t,r){let o=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!o?.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],s=Array.isArray(n.content)?n.content:[n.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(d=>d.type==="tool_use").map(d=>d.id)),p=new Set(s.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==p.size||![...l].every(d=>p.has(d)))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},Mr,r)}elicitInputStream(t,r){let o=this._server.getClientCapabilities(),n=t.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Ut,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,o){return this._server.getTaskResult({taskId:t},r,o)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function Ih(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 Oh(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Dn=class extends rn{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Zr.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Mn,this.setRequestHandler(ti,o=>this._oninitialize(o)),this.setNotificationHandler(ri,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(li,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Zr.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new qn(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Zd(this._capabilities,t)}setRequestHandler(t,r){let n=qo(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(qt(n)){let a=n;s=a._zod?.def?.value??a.value}else{let a=n;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=ct(Cr,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(A.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:p}=l.data,d=await Promise.resolve(r(c,u));if(p.task){let m=ct(Lt,d);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new R(A.InvalidParams,`Invalid task creation result: ${_}`)}return m.data}let f=ct(tn,d);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(A.InvalidParams,`Invalid tools/call result: ${m}`)}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){Oh(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Ih(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:$d.includes(r)?r:Bs,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"},Jo)}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 o=t.messages[t.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.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(n.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(p=>p.type==="tool_use").map(p=>p.id)),l=new Set(n.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==l.size||![...u].every(p=>l.has(p)))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},pi,r):this.request({method:"sampling/createMessage",params:t},Mr,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 n=t;return this.request({method:"elicitation/create",params:n},Ut,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:n},Ut,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new R(A.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(A.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},di,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"})}};var cc=dr(require("node:process"),1);var Ln=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
73
- `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),zx(r)}clear(){this._buffer=void 0}};function zx(e){return Ed.parse(JSON.parse(e))}function jh(e){return JSON.stringify(e)+`
74
- `}var Fn=class{constructor(t=cc.default.stdin,r=cc.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Ln,this._started=!1,this._ondata=o=>{this._readBuffer.append(o),this.processReadBuffer()},this._onerror=o=>{this.onerror?.(o)}}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 o=jh(t);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};function go(e){return(e??"").trim().replace(/\\/g,"/").replace(/^(?:\.\.?\/)+/,"")}var xx=/\]\((\.{1,2}\/[^)\s]*)\)/g,Sx=/(?<![\w:.\-/])([0-9]{3})(?![\w-])/g;function kx(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Nh="ts|tsx|js|jsx|mjs|cjs|cs|py|go",Px=new RegExp(`\\]\\(((?:\\.{1,2}/)+[^)\\s]*\\.(?:${Nh}))\\)`,"g"),Ex=/`([^`\r\n]+)`/g,Tx=new RegExp(`^\\.{0,2}/?(?:[^\\s/]+/)+[^\\s/]+\\.(?:${Nh})$`);function Rx(e){return go(e)}var Ix=/^#{2,4}\s+([A-Z][A-Za-z0-9]+)\b[^\n]*\(([^)]*(?:\.[a-z]{2,4}|:\d+|db\.types)[^)]*)\)/gm;function Ox(e){return e.trim().slice(0,100)}function uc(e){let t=new Map;for(let r of e.matchAll(xx)){let o=r[0];for(let n of r[1].split("/")){if(!n||n==="."||n==="..")continue;let s=t.get(n);t.set(n,{kind:"link",targetHint:n,evidence:s?.evidence??o,count:(s?.count??0)+1})}}return[...t.values()]}function lc(e,t,r){let o=[...new Set(t)].filter(a=>a&&a!==r);if(o.length===0||!e)return[];o.sort((a,c)=>c.length-a.length);let n=o.map(kx).join("|"),s=new RegExp(`(?<![A-Za-z0-9-])(?:${n})(?![A-Za-z0-9-])`,"g"),i=new Map;for(let a of e.matchAll(s))i.set(a[0],(i.get(a[0])??0)+1);return[...i.entries()].map(([a,c])=>({id:a,count:c}))}function pc(e){let t=new Map,r=new Map;for(let o of e.split(/\r?\n/))if(!/\bT\d{3}\b/.test(o))for(let n of o.matchAll(Sx)){let s=n[1];r.set(s,(r.get(s)??0)+1),t.has(s)||t.set(s,Ox(o))}return[...r.entries()].map(([o,n])=>({kind:"number",targetHint:o,evidence:t.get(o)??o,count:n}))}function dc(e){let t=new Map;for(let r of e.matchAll(Ix)){let o=r[1];t.has(o)||t.set(o,{kind:"entity",targetHint:o,evidence:r[0].trim().slice(0,100),count:1})}return[...t.values()]}function fc(e){let t=new Map,r=o=>{let n=Rx(o);if(!n)return;let s=t.get(n);t.set(n,{kind:"code",targetHint:n,evidence:n,count:(s?.count??0)+1})};for(let o of e.matchAll(Px))r(o[1]);for(let o of e.matchAll(Ex)){let n=o[1].trim();Tx.test(n)&&r(n)}return[...t.values()]}function Un(e){let t=typeof e?.id=="string"?e.id:"",r=typeof e?.number=="string"?e.number:null,o=[],n=e&&typeof e.files=="object"&&e.files?e.files:{},s=Array.isArray(e?.artifacts)?e.artifacts.filter(d=>typeof d=="string"):[],i=Nx(s),a=t,c=null,u=null,l=[],p="";try{let d=mc(n,"spec.md"),f=mc(n,"tasks.md"),m=mc(n,"data-model.md"),_=Object.values(n).join(`
75
- `);p=_,a=Ax(d)??t,c=Cx(d),u=Zx(f),l=[...uc(_),...pc(_),...fc(_),...m?dc(m):[]]}catch{o.push({code:"parse-error",message:`Could not fully parse feature "${t}"; using partial data.`,featureId:t})}return{id:t,number:r,title:a,status:c,taskCompletion:u,completeness:i,references:l,warnings:o,mentionText:p}}var jx={spec:["spec"],plan:["plan"],tasks:["tasks"],research:["research"],dataModel:["data-model","datamodel","dataModel"],quickstart:["quickstart"],contracts:["contracts"],checklists:["checklists"]};function Nx(e){let t=new Set(e.map(o=>o.toLowerCase().replace(/\.md$/,""))),r=o=>jx[o].some(n=>t.has(n.toLowerCase()));return{spec:r("spec"),plan:r("plan"),tasks:r("tasks"),research:r("research"),dataModel:r("dataModel"),quickstart:r("quickstart"),contracts:r("contracts"),checklists:r("checklists")}}function mc(e,t){if(typeof e[t]=="string")return e[t];for(let[r,o]of Object.entries(e))if(r.replace(/\\/g,"/").split("/").pop()===t&&typeof o=="string")return o;return""}function Ax(e){let t=e.match(/^#\s+(?:Feature Specification:\s*)?(.+?)\s*$/m);return t?t[1].trim():null}function Cx(e){let t=e.match(/^\s*\*\*Status\*\*:\s*(.+?)\s*$/m);return t?t[1].trim():null}function Zx(e){if(!e)return null;let t=(e.match(/^\s*-\s*\[[xX]\]/gm)??[]).length,r=(e.match(/^\s*-\s*\[ \]/gm)??[]).length,o=t+r;return o===0?null:{done:t,total:o}}var hc={links:!0,slugMentions:!0,sharedEntities:!0,bareNumbers:!0,specToCode:!0};function gc(e){return{...hc,...e??{},links:!0}}var Ah={definitive:4,strong:3,medium:2,risky:1};function Jn(e,t,r,o){let n=gc(o),s=Array.isArray(r)?r.filter(d=>!!d):[],i=[],a=s.map(d=>Lx(e,d,n)),c=new Set(s.map(d=>d.id)),u=qx(s,i),l=new Map,p=new Map;for(let d of s)try{for(let f of d.references??[])switch(f.kind){case"link":Mx(f.targetHint,c,d.id)&&Vn(l,d.id,f.targetHint,"link","definitive",1,f.evidence);break;case"slug":break;case"number":if(n.bareNumbers){let m=u.get(f.targetHint);m&&m!==d.id&&Vn(l,d.id,m,"bare-number","risky",f.count,f.evidence)}break;case"entity":if(n.sharedEntities){let m=p.get(f.targetHint)??new Set;m.add(d.id),p.set(f.targetHint,m)}break;case"code":break}}catch{i.push({code:"assemble-error",message:`Skipped some edges for "${d.id}".`,featureId:d.id})}if(n.slugMentions)for(let d of s)try{for(let{id:f,count:m}of lc(d.mentionText,c,d.id))Vn(l,d.id,f,"slug-mention","strong",m,f)}catch{i.push({code:"assemble-error",message:`Skipped some mention edges for "${d.id}".`,featureId:d.id})}if(n.sharedEntities)for(let[d,f]of p){if(f.size<2)continue;let m=[...f].sort();for(let _=0;_<m.length;_++)for(let y=_+1;y<m.length;y++)Vn(l,m[_],m[y],"shared-entity","medium",1,d,!0)}for(let d of s)for(let f of d.warnings??[])i.push(f);return{projectId:e,name:t,nodes:a,edges:[...l.values()].map(Dx),warnings:i}}function Mx(e,t,r){return t.has(e)&&e!==r}function qx(e,t){let r=new Map;for(let n of e)if(n.number){let s=r.get(n.number)??[];s.push(n.id),r.set(n.number,s)}let o=new Map;for(let[n,s]of r)s.length===1?o.set(n,s[0]):t.push({code:"ambiguous-number",message:`Feature number ${n} maps to multiple features (${s.join(", ")}); no edge inferred.`,featureIds:[...s].sort((i,a)=>i.localeCompare(a))});return o}function Vn(e,t,r,o,n,s,i,a=!1){if(t===r)return;let c=`${t}\0${r}`,u=e.get(c);if(!u){e.set(c,{source:t,target:r,heuristic:o,tier:n,weight:s,evidence:[i],symmetric:a});return}u.evidence.includes(i)||u.evidence.push(i),Ah[n]>Ah[u.tier]?(u.tier=n,u.heuristic=o,u.weight=s,u.symmetric=a):n===u.tier&&(u.weight=Math.max(u.weight,s),u.symmetric=u.symmetric&&a)}function Dx(e){let t={source:e.source,target:e.target,heuristic:e.heuristic,tier:e.tier,weight:e.weight,evidence:e.evidence};return e.symmetric?{...t,symmetric:!0}:t}function Lx(e,t,r){let o={id:t.id,projectId:e,title:t.title,status:t.status,taskCompletion:t.taskCompletion,completeness:t.completeness,warnings:t.warnings??[]};if(!r.specToCode)return o;let n=[...new Set((t.references??[]).filter(s=>s.kind==="code").map(s=>s.targetHint))];return{...o,codeReferences:n}}function Gn(e,t){return{projects:(Array.isArray(e)?e:[]).filter(n=>!!n).map(n=>{let s=(n.features??[]).map(i=>Un(i));return Jn(n.projectId,n.name,s,t)})}}function _c(e){return[...e].sort((t,r)=>t.id.localeCompare(r.id))}function Kn(e){return[...e].sort((t,r)=>t.source.localeCompare(r.source)||t.target.localeCompare(r.target)||t.heuristic.localeCompare(r.heuristic))}function Hn(e){return{...e,nodes:_c(e.nodes),edges:Kn(e.edges)}}function yc(e){return{projects:[...e.projects].map(Hn).sort((r,o)=>r.projectId.localeCompare(o.projectId))}}function Fe(e,t,r){return{schemaVersion:1,kind:e,data:t,warnings:[...r]}}function _o(e,t){let r=new Set(t);return e.filter(o=>{let n=o.featureId!==void 0,s=o.featureIds!==void 0;return!n&&!s?!0:n&&r.has(o.featureId)||(o.featureIds??[]).some(i=>r.has(i))})}var Fx=/^(in)[\s-]+(progress|review)\b|^(on)[\s-]+(hold)\b|^(not)[\s-]+(started)\b/i;function Ch(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function Wn(e){if(e===null)return"(none)";let t=e.trim().replace(/^[*_`\s]+/,"");if(t==="")return"(none)";let r=Fx.exec(t);if(r)return r.slice(1).filter(s=>s!==void 0).map(Ch).join(" ");let o=/^[^\s(—–\-,;:.*_`]+/.exec(t);return o?Ch(o[0]):"(none)"}function Bn(e,t){let r=e?.projects??[],o=t?.projectId??null;return o?r.filter(n=>n.projectId===o):[...r]}function yo(e,t){let r=t?.projectId??null;if(r){let o=(e?.projects??[]).find(n=>n.projectId===r);return o?Hn(o):{projectId:r,name:r,nodes:[],edges:[],warnings:[]}}return yc(e??{projects:[]})}function Qn(e,t,r){let o=Bn(e,r),n=null,s=[],i=[];for(let a of o){let c=a.nodes.find(u=>u.id===t);if(c){n=c;for(let u of a.edges)u.source===t&&s.push(u),u.target===t&&i.push(u)}}return{spec:n,found:n!==null,dependsOn:Kn(s),dependedOnBy:Kn(i)}}function Yn(e,t,r){let o=go(t);if(o==="")return{path:"",matches:[]};let n=o.includes("/")?o.slice(0,o.lastIndexOf("/")):"",s=n===""?null:n+"/",i=[],a=[];for(let u of Bn(e,r))for(let l of u.nodes){let p=l.codeReferences??[];p.includes(o)?i.push(Zh(l,"exact")):s&&p.some(d=>d.startsWith(s))&&a.push(Zh(l,"folder"))}let c=(i.length>0?i:a).sort(Ux);return{path:o,matches:c}}function Zh(e,t){return{specId:e.id,projectId:e.projectId,title:e.title,status:e.status,matchKind:t}}var Mh={exact:0,folder:1};function Ux(e,t){return Mh[e.matchKind]-Mh[t.matchKind]||e.projectId.localeCompare(t.projectId)||e.specId.localeCompare(t.specId)}function Xn(e,t){let r=_c(Bn(e,t).flatMap(c=>c.nodes)),o=new Map,n=0,s=0,i=r.map(c=>{let u=Wn(c.status);return o.set(u,(o.get(u)??0)+1),c.taskCompletion&&(n+=c.taskCompletion.done,s+=c.taskCompletion.total),{id:c.id,projectId:c.projectId,status:c.status,done:c.taskCompletion?.done??null,total:c.taskCompletion?.total??null}}),a={};for(let c of[...o.keys()].sort((u,l)=>u.localeCompare(l)))a[c]=o.get(c)??0;return{perSpec:i,aggregate:{specs:r.length,byStatus:a,tasksDone:n,tasksTotal:s}}}function vo(e,t){let r=[];for(let o of Bn(e,t)){let n=new Set;for(let s of o.edges)n.add(s.source),n.add(s.target);for(let s of o.nodes)n.has(s.id)||r.push(s.id)}return{orphans:[...r].sort((o,n)=>o.localeCompare(n))}}var cr=["no-orphans"];function es(e,t,r){if(t==="no-orphans"){let o=vo(e,r).orphans;return{rule:t,ok:o.length===0,violations:o}}return{rule:t,ok:!1,violations:[],error:$o(t)}}function $o(e){return`Unknown rule "${e}". Known rules: ${cr.join(", ")}`}var Ot=dr(require("node:fs")),Ue=dr(require("node:path")),qh=require("node:url"),Gx=["spec.md","plan.md","tasks.md","data-model.md","research.md","quickstart.md"],Kx=["spec","plan","tasks","research","data-model","quickstart"],Hx=["contracts","checklists"];function Dh(e){let t=[],r=Ue.resolve(e),o=s=>{let i=Wx(Ue.join(s,"specs"));i.length>0&&t.push({projectId:(0,qh.pathToFileURL)(s).toString(),name:Ue.basename(s),features:i})};o(r);for(let s of Lh(r))s.isDirectory()&&!s.name.startsWith(".")&&s.name!=="node_modules"&&o(Ue.join(r,s.name));let n=new Set;return t.filter(s=>n.has(s.projectId)?!1:(n.add(s.projectId),!0))}function Wx(e){let t=[];for(let r of Lh(e))r.isDirectory()&&t.push(Bx(Ue.join(e,r.name),r.name));return t}function Bx(e,t){let r=t.match(/^(\d{3})-/),o=r?r[1]:null,n=[];for(let i of Kx)Qx(Ue.join(e,`${i}.md`))&&n.push(i);for(let i of Hx)Yx(Ue.join(e,i))&&n.push(i);let s={};for(let i of Gx){let a=Xx(Ue.join(e,i));a!==null&&(s[i]=a)}return{id:t,number:o,artifacts:n,files:s}}function Lh(e){try{return Ot.readdirSync(e,{withFileTypes:!0})}catch{return[]}}function Qx(e){try{return Ot.statSync(e).isFile()}catch{return!1}}function Yx(e){try{return Ot.statSync(e).isDirectory()}catch{return!1}}function Xx(e){try{return Ot.readFileSync(e,"utf8")}catch{return null}}function Fh(e){let t=Dh(e.root),r=Gn(t,{bareNumbers:!1,...e.options}),o={projectId:e.projectId??null},n=r.projects.flatMap(s=>[...s.warnings]);switch(e.kind){case"graph":return Fe("graph",yo(r,o),n);case"spec":{let s=e.specId??"";return Fe("spec",Qn(r,s,o),_o(n,[s]))}case"file":{let s=Yn(r,e.path??"",o);return Fe("file",s,_o(n,s.matches.map(i=>i.specId)))}case"status":return Fe("status",Xn(r,o),n);case"orphans":return Fe("orphans",vo(r,o),n);case"check":return Fe("check",es(r,e.rule??"no-orphans",o),n);default:return Fe("graph",yo(r,o),n)}}var{values:eS}=(0,Vh.parseArgs)({args:process.argv.slice(2),options:{root:{type:"string"}},allowPositionals:!0}),tS=eS.root??process.cwd(),Uh=cr.join(", "),rS={type:"object",description:"Heuristic toggles (defaults per the model).",properties:{slugMentions:{type:"boolean",description:"Slug-mention edges. Default true."},sharedEntities:{type:"boolean",description:"Shared-entity edges. Default true."},bareNumbers:{type:"boolean",description:"Opt-in risky tier (bare feature numbers); default false."},specToCode:{type:"boolean",description:"Spec->code layer (source-file references; feeds atlas_specs_for_file). Default true."}}},ur={root:{type:"string",description:"Workspace root (default: server root)."},projectId:{type:"string",description:"Scope to one project."},options:rS},Jh=[{name:"atlas_graph",kind:"graph",description:"The spec-relationship graph for a project (or all).",inputSchema:{type:"object",properties:{...ur}}},{name:"atlas_spec_relationships",kind:"spec",description:"A spec's dependsOn / dependedOnBy with tier/weight/evidence.",inputSchema:{type:"object",required:["specId"],properties:{specId:{type:"string"},...ur}}},{name:"atlas_specs_for_file",kind:"file",description:"Which spec(s) reference/relate to a source file (reverse traceability). Derived from spec artifacts (feature 011), no git.",inputSchema:{type:"object",required:["path"],properties:{path:{type:"string",description:"File path relative to the workspace root."},...ur}}},{name:"atlas_status_summary",kind:"status",description:"Implementation-status / completeness summary.",inputSchema:{type:"object",properties:{...ur}}},{name:"atlas_orphans",kind:"orphans",description:"Specs with no relationships.",inputSchema:{type:"object",properties:{...ur}}},{name:"atlas_check",kind:"check",description:`Evaluate a rule (default no-orphans); returns { ok, violations }. An unknown rule is an error (known rules: ${Uh}).`,inputSchema:{type:"object",properties:{rule:{type:"string",description:`Rule to check. Known rules: ${Uh}. Default no-orphans.`},...ur}}}],oS="0.1.2",vc=new Dn({name:"speckit-atlas",version:oS},{capabilities:{tools:{}}});vc.setRequestHandler(ui,async()=>({tools:Jh.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))}));vc.setRequestHandler(Cr,async e=>{let t=Jh.find(n=>n.name===e.params.name);if(!t)return{isError:!0,content:[{type:"text",text:`Unknown tool: ${e.params.name}`}]};let r=e.params.arguments??{};if(t.kind==="check"&&r.rule!==void 0&&!cr.includes(r.rule))return{isError:!0,content:[{type:"text",text:$o(String(r.rule))}]};let o=Fh({root:r.root??tS,kind:t.kind,specId:r.specId,path:r.path,rule:r.rule,projectId:r.projectId??null,options:r.options});return{content:[{type:"text",text:JSON.stringify(o)}]}});async function nS(){await vc.connect(new Fn)}nS();
72
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of t.seen.entries()){let a=i[1];if(e===i[0]){s(i);continue}if(t.external){let u=t.external.registry.get(i[0])?.id;if(e!==i[0]&&u){s(i);continue}}if(t.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&t.reused==="ref"){s(i);continue}}}function Hs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},p=c.ref;if(c.ref=null,p){o(p);let f=t.seen.get(p),m=f.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===p)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$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 d=a._zod.parent;if(d&&d!==p){o(d);let f=t.seen.get(d);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())o(a[0]);let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Object.assign(n,r.def??r.schema);let s=t.metadataRegistry.get(e)?.id;s!==void 0&&n.id===s&&delete n.id;let i=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Pr(e,"input",t.processors),output:Pr(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ge(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ge(o.element,r);if(o.type==="set")return ge(o.valueType,r);if(o.type==="lazy")return ge(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return ge(o.innerType,r);if(o.type==="intersection")return ge(o.left,r)||ge(o.right,r);if(o.type==="record"||o.type==="map")return ge(o.keyType,r)||ge(o.valueType,r);if(o.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:ge(o.in,r)||ge(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ge(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ge(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ge(n,r))return!0;return!!(o.rest&&ge(o.rest,r))}return!1}var Pp=(t,e={})=>r=>{let o=Us({...r,processors:e});return re(t,o),Vs(o,t),Hs(o,t)},Pr=(t,e,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=Us({...n??{},target:s,io:e,processors:r});return re(t,i),Vs(i,t),Hs(i,t)};var Vg={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ep=(t,e,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=Vg[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(p=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},Tp=(t,e,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let p=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),d=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";p?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),d?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},Rp=(t,e,r,o)=>{r.type="boolean"};var Ip=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Op=(t,e,r,o)=>{r.not={}};var Np=(t,e,r,o)=>{};var jp=(t,e,r,o)=>{let n=t._zod.def,s=_r(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Cp=(t,e,r,o)=>{let n=t._zod.def,s=[];for(let i of n.values)if(i===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,e.target==="draft-04"||e.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 Ap=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Zp=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Mp=(t,e,r,o)=>{let n=r,s=t._zod.def,{minimum:i,maximum:a}=t._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=re(s.element,e,{...o,path:[...o.path,"items"]})},Dp=(t,e,r,o)=>{let n=r,s=t._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=re(i[u],e,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=re(s.catchall,e,{...o,path:[...o.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},qp=(t,e,r,o)=>{let n=t._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>re(a,e,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Lp=(t,e,r,o)=>{let n=t._zod.def,s=re(n.left,e,{...o,path:[...o.path,"allOf",0]}),i=re(n.right,e,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var Fp=(t,e,r,o)=>{let n=r,s=t._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,e,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)n.patternProperties[p.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(n.propertyNames=re(s.keyType,e,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=re(s.valueType,e,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(n.required=l)}},Up=(t,e,r,o)=>{let n=t._zod.def,s=re(n.innerType,e,o),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Vp=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType},Hp=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Gp=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Kp=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Jp=(t,e,r,o)=>{let n=t._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=e.io==="input"?s?n.out:n.in:n.out;re(i,e,o);let a=e.seen.get(t);a.ref=i},Wp=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,r.readOnly=!0};var Gs=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType};function Lt(t){return!!t._zod}function ct(t,e){return Lt(t)?wr(t,e):t.safeParse(e)}function Ho(t){if(!t)return;let e;if(Lt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Bp(t){if(Lt(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var Tr={};Oc(Tr,{ZodISODate:()=>Yp,ZodISODateTime:()=>Qp,ZodISODuration:()=>ed,ZodISOTime:()=>Xp,date:()=>Js,datetime:()=>Ks,duration:()=>Bs,time:()=>Ws});var Qp=g("ZodISODateTime",(t,e)=>{il.init(t,e),Y.init(t,e)});function Ks(t){return fp(Qp,t)}var Yp=g("ZodISODate",(t,e)=>{al.init(t,e),Y.init(t,e)});function Js(t){return mp(Yp,t)}var Xp=g("ZodISOTime",(t,e)=>{cl.init(t,e),Y.init(t,e)});function Ws(t){return hp(Xp,t)}var ed=g("ZodISODuration",(t,e)=>{ul.init(t,e),Y.init(t,e)});function Bs(t){return gp(ed,t)}var Xg=(t,e)=>{Io.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Uc(t,r)},flatten:{value:r=>Fc(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Zt,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Zt,2)}},isEmpty:{get(){return t.issues.length===0}}})};var Pe=g("ZodError",Xg,{Parent:Error});var td=Oo(Pe),rd=No(Pe),od=br(Pe),nd=xr(Pe),sd=Vc(Pe),id=Hc(Pe),ad=Gc(Pe),cd=Kc(Pe),ud=Jc(Pe),ld=Wc(Pe),pd=Bc(Pe),dd=Qc(Pe);var fd=new WeakMap;function Rr(t,e,r){let o=Object.getPrototypeOf(t),n=fd.get(o);if(n||(n=new Set,fd.set(o,n)),!n.has(e)){n.add(e);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var te=g("ZodType",(t,e)=>(K.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Pr(t,"input"),output:Pr(t,"output")}}),t.toJSONSchema=Pp(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,o)=>td(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>od(t,r,o),t.parseAsync=async(r,o)=>rd(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>nd(t,r,o),t.spa=t.safeParseAsync,t.encode=(r,o)=>sd(t,r,o),t.decode=(r,o)=>id(t,r,o),t.encodeAsync=async(r,o)=>ad(t,r,o),t.decodeAsync=async(r,o)=>cd(t,r,o),t.safeEncode=(r,o)=>ud(t,r,o),t.safeDecode=(r,o)=>ld(t,r,o),t.safeEncodeAsync=async(r,o)=>pd(t,r,o),t.safeDecodeAsync=async(r,o)=>dd(t,r,o),Rr(t,"ZodType",{check(...r){let o=this.def;return this.clone(M.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ze(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(U_(r,o))},superRefine(r,o){return this.check(V_(r,o))},overwrite(r){return this.check(at(r))},optional(){return ee(this)},exactOptional(){return I_(this)},nullable(){return _d(this)},nullish(){return ee(_d(this))},nonoptional(r){return Z_(this,r)},array(){return A(this)},or(r){return W([this,r])},and(r){return Ko(this,r)},transform(r){return yd(this,Sd(r))},default(r){return j_(this,r)},prefault(r){return A_(this,r)},catch(r){return D_(this,r)},pipe(r){return yd(this,r)},readonly(){return F_(this)},describe(r){let o=this.clone();return $t.add(o,{description:r}),o},meta(...r){if(r.length===0)return $t.get(this);let o=this.clone();return $t.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return $t.get(t)?.description},configurable:!0}),t)),vd=g("_ZodString",(t,e)=>{Do.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Ep(t,o,n,s);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,Rr(t,"_ZodString",{regex(...o){return this.check(Os(...o))},includes(...o){return this.check(Cs(...o))},startsWith(...o){return this.check(As(...o))},endsWith(...o){return this.check(Zs(...o))},min(...o){return this.check(qt(...o))},max(...o){return this.check(Uo(...o))},length(...o){return this.check(Vo(...o))},nonempty(...o){return this.check(qt(1,...o))},lowercase(o){return this.check(Ns(o))},uppercase(o){return this.check(js(o))},trim(){return this.check(Ds())},normalize(...o){return this.check(Ms(...o))},toLowerCase(){return this.check(qs())},toUpperCase(){return this.check(Ls())},slugify(){return this.check(Fs())}})}),t_=g("ZodString",(t,e)=>{Do.init(t,e),vd.init(t,e),t.email=r=>t.check(Gl(r_,r)),t.url=r=>t.check(Ql(o_,r)),t.jwt=r=>t.check(dp(y_,r)),t.emoji=r=>t.check(Yl(n_,r)),t.guid=r=>t.check(Is(md,r)),t.uuid=r=>t.check(Kl(Go,r)),t.uuidv4=r=>t.check(Jl(Go,r)),t.uuidv6=r=>t.check(Wl(Go,r)),t.uuidv7=r=>t.check(Bl(Go,r)),t.nanoid=r=>t.check(Xl(s_,r)),t.guid=r=>t.check(Is(md,r)),t.cuid=r=>t.check(ep(i_,r)),t.cuid2=r=>t.check(tp(a_,r)),t.ulid=r=>t.check(rp(c_,r)),t.base64=r=>t.check(up(h_,r)),t.base64url=r=>t.check(lp(g_,r)),t.xid=r=>t.check(op(u_,r)),t.ksuid=r=>t.check(np(l_,r)),t.ipv4=r=>t.check(sp(p_,r)),t.ipv6=r=>t.check(ip(d_,r)),t.cidrv4=r=>t.check(ap(f_,r)),t.cidrv6=r=>t.check(cp(m_,r)),t.e164=r=>t.check(pp(__,r)),t.datetime=r=>t.check(Ks(r)),t.date=r=>t.check(Js(r)),t.time=r=>t.check(Ws(r)),t.duration=r=>t.check(Bs(r))});function h(t){return Hl(t_,t)}var Y=g("ZodStringFormat",(t,e)=>{J.init(t,e),vd.init(t,e)}),r_=g("ZodEmail",(t,e)=>{Qu.init(t,e),Y.init(t,e)});var md=g("ZodGUID",(t,e)=>{Wu.init(t,e),Y.init(t,e)});var Go=g("ZodUUID",(t,e)=>{Bu.init(t,e),Y.init(t,e)});var o_=g("ZodURL",(t,e)=>{Yu.init(t,e),Y.init(t,e)});var n_=g("ZodEmoji",(t,e)=>{Xu.init(t,e),Y.init(t,e)});var s_=g("ZodNanoID",(t,e)=>{el.init(t,e),Y.init(t,e)});var i_=g("ZodCUID",(t,e)=>{tl.init(t,e),Y.init(t,e)});var a_=g("ZodCUID2",(t,e)=>{rl.init(t,e),Y.init(t,e)});var c_=g("ZodULID",(t,e)=>{ol.init(t,e),Y.init(t,e)});var u_=g("ZodXID",(t,e)=>{nl.init(t,e),Y.init(t,e)});var l_=g("ZodKSUID",(t,e)=>{sl.init(t,e),Y.init(t,e)});var p_=g("ZodIPv4",(t,e)=>{ll.init(t,e),Y.init(t,e)});var d_=g("ZodIPv6",(t,e)=>{pl.init(t,e),Y.init(t,e)});var f_=g("ZodCIDRv4",(t,e)=>{dl.init(t,e),Y.init(t,e)});var m_=g("ZodCIDRv6",(t,e)=>{fl.init(t,e),Y.init(t,e)});var h_=g("ZodBase64",(t,e)=>{hl.init(t,e),Y.init(t,e)});var g_=g("ZodBase64URL",(t,e)=>{gl.init(t,e),Y.init(t,e)});var __=g("ZodE164",(t,e)=>{_l.init(t,e),Y.init(t,e)});var y_=g("ZodJWT",(t,e)=>{yl.init(t,e),Y.init(t,e)});var $d=g("ZodNumber",(t,e)=>{ks.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Tp(t,o,n,s),Rr(t,"ZodNumber",{gt(o,n){return this.check(Lo(o,n))},gte(o,n){return this.check(kr(o,n))},min(o,n){return this.check(kr(o,n))},lt(o,n){return this.check(qo(o,n))},lte(o,n){return this.check(zr(o,n))},max(o,n){return this.check(zr(o,n))},int(o){return this.check(hd(o))},safe(o){return this.check(hd(o))},positive(o){return this.check(Lo(0,o))},nonnegative(o){return this.check(kr(0,o))},negative(o){return this.check(qo(0,o))},nonpositive(o){return this.check(zr(0,o))},multipleOf(o,n){return this.check(Fo(o,n))},step(o,n){return this.check(Fo(o,n))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function U(t){return _p($d,t)}var v_=g("ZodNumberFormat",(t,e)=>{vl.init(t,e),$d.init(t,e)});function hd(t){return yp(v_,t)}var $_=g("ZodBoolean",(t,e)=>{$l.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Rp(t,r,o,n)});function se(t){return vp($_,t)}var b_=g("ZodNull",(t,e)=>{bl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Ip(t,r,o,n)});function bd(t){return $p(b_,t)}var w_=g("ZodUnknown",(t,e)=>{wl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Np(t,r,o,n)});function X(){return bp(w_)}var x_=g("ZodNever",(t,e)=>{xl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Op(t,r,o,n)});function S_(t){return wp(x_,t)}var z_=g("ZodArray",(t,e)=>{Sl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Mp(t,r,o,n),t.element=e.element,Rr(t,"ZodArray",{min(r,o){return this.check(qt(r,o))},nonempty(r){return this.check(qt(1,r))},max(r,o){return this.check(Uo(r,o))},length(r,o){return this.check(Vo(r,o))},unwrap(){return this.element}})});function A(t,e){return xp(z_,t,e)}var wd=g("ZodObject",(t,e)=>{Pl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Dp(t,r,o,n),M.defineLazy(t,"shape",()=>e.shape),Rr(t,"ZodObject",{keyof(){return $e(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:S_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return M.extend(this,r)},safeExtend(r){return M.safeExtend(this,r)},merge(r){return M.merge(this,r)},pick(r){return M.pick(this,r)},omit(r){return M.omit(this,r)},partial(...r){return M.partial(zd,this,r[0])},required(...r){return M.required(kd,this,r[0])}})});function b(t,e){let r={type:"object",shape:t??{},...M.normalizeParams(e)};return new wd(r)}function _e(t,e){return new wd({type:"object",shape:t,catchall:X(),...M.normalizeParams(e)})}var xd=g("ZodUnion",(t,e)=>{Ps.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>qp(t,r,o,n),t.options=e.options});function W(t,e){return new xd({type:"union",options:t,...M.normalizeParams(e)})}var k_=g("ZodDiscriminatedUnion",(t,e)=>{xd.init(t,e),El.init(t,e)});function Ys(t,e,r){return new k_({type:"union",options:e,discriminator:t,...M.normalizeParams(r)})}var P_=g("ZodIntersection",(t,e)=>{Tl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Lp(t,r,o,n)});function Ko(t,e){return new P_({type:"intersection",left:t,right:e})}var gd=g("ZodRecord",(t,e)=>{Rl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Fp(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function G(t,e,r){return!e||!e._zod?new gd({type:"record",keyType:h(),valueType:t,...M.normalizeParams(e)}):new gd({type:"record",keyType:t,valueType:e,...M.normalizeParams(r)})}var Qs=g("ZodEnum",(t,e)=>{Il.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>jp(t,o,n,s),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Qs({...e,checks:[],...M.normalizeParams(n),entries:s})},t.exclude=(o,n)=>{let s={...e.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Qs({...e,checks:[],...M.normalizeParams(n),entries:s})}});function $e(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new Qs({type:"enum",entries:r,...M.normalizeParams(e)})}var E_=g("ZodLiteral",(t,e)=>{Ol.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Cp(t,r,o,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function z(t,e){return new E_({type:"literal",values:Array.isArray(t)?t:[t],...M.normalizeParams(e)})}var T_=g("ZodTransform",(t,e)=>{Nl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Zp(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ct(t.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(M.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),r.issues.push(M.issue(i))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function Sd(t){return new T_({type:"transform",transform:t})}var zd=g("ZodOptional",(t,e)=>{Es.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Gs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new zd({type:"optional",innerType:t})}var R_=g("ZodExactOptional",(t,e)=>{jl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Gs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function I_(t){return new R_({type:"optional",innerType:t})}var O_=g("ZodNullable",(t,e)=>{Cl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Up(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function _d(t){return new O_({type:"nullable",innerType:t})}var N_=g("ZodDefault",(t,e)=>{Al.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Hp(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function j_(t,e){return new N_({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var C_=g("ZodPrefault",(t,e)=>{Zl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Gp(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function A_(t,e){return new C_({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():M.shallowClone(e)}})}var kd=g("ZodNonOptional",(t,e)=>{Ml.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Vp(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Z_(t,e){return new kd({type:"nonoptional",innerType:t,...M.normalizeParams(e)})}var M_=g("ZodCatch",(t,e)=>{Dl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Kp(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function D_(t,e){return new M_({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Pd=g("ZodPipe",(t,e)=>{Ts.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Jp(t,r,o,n),t.in=e.in,t.out=e.out});function yd(t,e){return new Pd({type:"pipe",in:t,out:e})}var q_=g("ZodPreprocess",(t,e)=>{Pd.init(t,e),ql.init(t,e)}),L_=g("ZodReadonly",(t,e)=>{Ll.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Wp(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function F_(t){return new L_({type:"readonly",innerType:t})}var Ed=g("ZodCustom",(t,e)=>{Fl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Ap(t,r,o,n)});function Td(t,e){return Sp(Ed,t??(()=>!0),e)}function U_(t,e={}){return zp(Ed,t,e)}function V_(t,e){return kp(t,e)}function Xs(t,e){return new q_({type:"pipe",in:Sd(t),out:e})}ke(Ul());var ti="2025-11-25";var Rd=[ti,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ut="io.modelcontextprotocol/related-task",Wo="2.0",ne=Td(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Id=W([h(),U().int()]),Od=h(),QP=_e({ttl:U().optional(),pollInterval:U().optional()}),H_=b({ttl:U().optional()}),G_=b({taskId:h()}),ri=_e({progressToken:Id.optional(),[ut]:G_.optional()}),Ee=b({_meta:ri.optional()}),Ir=Ee.extend({task:H_.optional()}),Nd=t=>Ir.safeParse(t).success,ae=b({method:h(),params:Ee.loose().optional()}),Ie=b({_meta:ri.optional()}),Oe=b({method:h(),params:Ie.loose().optional()}),ce=_e({_meta:ri.optional()}),Bo=W([h(),U().int()]),jd=b({jsonrpc:z(Wo),id:Bo,...ae.shape}).strict(),oi=t=>jd.safeParse(t).success,Cd=b({jsonrpc:z(Wo),...Oe.shape}).strict(),Ad=t=>Cd.safeParse(t).success,ni=b({jsonrpc:z(Wo),id:Bo,result:ce}).strict(),Or=t=>ni.safeParse(t).success;var C;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(C||(C={}));var si=b({jsonrpc:z(Wo),id:Bo.optional(),error:b({code:U().int(),message:h(),data:X().optional()})}).strict();var Zd=t=>si.safeParse(t).success;var Md=W([jd,Cd,ni,si]),YP=W([ni,si]),Qo=ce.strict(),K_=Ie.extend({requestId:Bo.optional(),reason:h().optional()}),Yo=Oe.extend({method:z("notifications/cancelled"),params:K_}),J_=b({src:h(),mimeType:h().optional(),sizes:A(h()).optional(),theme:$e(["light","dark"]).optional()}),Nr=b({icons:A(J_).optional()}),Ft=b({name:h(),title:h().optional()}),Dd=Ft.extend({...Ft.shape,...Nr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),W_=Ko(b({applyDefaults:se().optional()}),G(h(),X())),B_=Xs(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Ko(b({form:W_.optional(),url:ne.optional()}),G(h(),X()).optional())),Q_=_e({list:ne.optional(),cancel:ne.optional(),requests:_e({sampling:_e({createMessage:ne.optional()}).optional(),elicitation:_e({create:ne.optional()}).optional()}).optional()}),Y_=_e({list:ne.optional(),cancel:ne.optional(),requests:_e({tools:_e({call:ne.optional()}).optional()}).optional()}),X_=b({experimental:G(h(),ne).optional(),sampling:b({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:B_.optional(),roots:b({listChanged:se().optional()}).optional(),tasks:Q_.optional(),extensions:G(h(),ne).optional()}),ey=Ee.extend({protocolVersion:h(),capabilities:X_,clientInfo:Dd}),ii=ae.extend({method:z("initialize"),params:ey});var ty=b({experimental:G(h(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:b({listChanged:se().optional()}).optional(),resources:b({subscribe:se().optional(),listChanged:se().optional()}).optional(),tools:b({listChanged:se().optional()}).optional(),tasks:Y_.optional(),extensions:G(h(),ne).optional()}),ry=ce.extend({protocolVersion:h(),capabilities:ty,serverInfo:Dd,instructions:h().optional()}),ai=Oe.extend({method:z("notifications/initialized"),params:Ie.optional()});var Xo=ae.extend({method:z("ping"),params:Ee.optional()}),oy=b({progress:U(),total:ee(U()),message:ee(h())}),ny=b({...Ie.shape,...oy.shape,progressToken:Id}),en=Oe.extend({method:z("notifications/progress"),params:ny}),sy=Ee.extend({cursor:Od.optional()}),jr=ae.extend({params:sy.optional()}),Cr=ce.extend({nextCursor:Od.optional()}),iy=$e(["working","input_required","completed","failed","cancelled"]),Ar=b({taskId:h(),status:iy,ttl:W([U(),bd()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ee(U()),statusMessage:ee(h())}),Ut=ce.extend({task:Ar}),ay=Ie.merge(Ar),Zr=Oe.extend({method:z("notifications/tasks/status"),params:ay}),tn=ae.extend({method:z("tasks/get"),params:Ee.extend({taskId:h()})}),rn=ce.merge(Ar),on=ae.extend({method:z("tasks/result"),params:Ee.extend({taskId:h()})}),XP=ce.loose(),nn=jr.extend({method:z("tasks/list")}),sn=Cr.extend({tasks:A(Ar)}),an=ae.extend({method:z("tasks/cancel"),params:Ee.extend({taskId:h()})}),qd=ce.merge(Ar),Ld=b({uri:h(),mimeType:ee(h()),_meta:G(h(),X()).optional()}),Fd=Ld.extend({text:h()}),ci=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ud=Ld.extend({blob:ci}),Mr=$e(["user","assistant"]),Vt=b({audience:A(Mr).optional(),priority:U().min(0).max(1).optional(),lastModified:Tr.datetime({offset:!0}).optional()}),Vd=b({...Ft.shape,...Nr.shape,uri:h(),description:ee(h()),mimeType:ee(h()),size:ee(U()),annotations:Vt.optional(),_meta:ee(_e({}))}),cy=b({...Ft.shape,...Nr.shape,uriTemplate:h(),description:ee(h()),mimeType:ee(h()),annotations:Vt.optional(),_meta:ee(_e({}))}),uy=jr.extend({method:z("resources/list")}),ly=Cr.extend({resources:A(Vd)}),py=jr.extend({method:z("resources/templates/list")}),dy=Cr.extend({resourceTemplates:A(cy)}),ui=Ee.extend({uri:h()}),fy=ui,my=ae.extend({method:z("resources/read"),params:fy}),hy=ce.extend({contents:A(W([Fd,Ud]))}),gy=Oe.extend({method:z("notifications/resources/list_changed"),params:Ie.optional()}),_y=ui,yy=ae.extend({method:z("resources/subscribe"),params:_y}),vy=ui,$y=ae.extend({method:z("resources/unsubscribe"),params:vy}),by=Ie.extend({uri:h()}),wy=Oe.extend({method:z("notifications/resources/updated"),params:by}),xy=b({name:h(),description:ee(h()),required:ee(se())}),Sy=b({...Ft.shape,...Nr.shape,description:ee(h()),arguments:ee(A(xy)),_meta:ee(_e({}))}),zy=jr.extend({method:z("prompts/list")}),ky=Cr.extend({prompts:A(Sy)}),Py=Ee.extend({name:h(),arguments:G(h(),h()).optional()}),Ey=ae.extend({method:z("prompts/get"),params:Py}),li=b({type:z("text"),text:h(),annotations:Vt.optional(),_meta:G(h(),X()).optional()}),pi=b({type:z("image"),data:ci,mimeType:h(),annotations:Vt.optional(),_meta:G(h(),X()).optional()}),di=b({type:z("audio"),data:ci,mimeType:h(),annotations:Vt.optional(),_meta:G(h(),X()).optional()}),Ty=b({type:z("tool_use"),name:h(),id:h(),input:G(h(),X()),_meta:G(h(),X()).optional()}),Ry=b({type:z("resource"),resource:W([Fd,Ud]),annotations:Vt.optional(),_meta:G(h(),X()).optional()}),Iy=Vd.extend({type:z("resource_link")}),fi=W([li,pi,di,Iy,Ry]),Oy=b({role:Mr,content:fi}),Ny=ce.extend({description:h().optional(),messages:A(Oy)}),jy=Oe.extend({method:z("notifications/prompts/list_changed"),params:Ie.optional()}),Cy=b({title:h().optional(),readOnlyHint:se().optional(),destructiveHint:se().optional(),idempotentHint:se().optional(),openWorldHint:se().optional()}),Ay=b({taskSupport:$e(["required","optional","forbidden"]).optional()}),Hd=b({...Ft.shape,...Nr.shape,description:h().optional(),inputSchema:b({type:z("object"),properties:G(h(),ne).optional(),required:A(h()).optional()}).catchall(X()),outputSchema:b({type:z("object"),properties:G(h(),ne).optional(),required:A(h()).optional()}).catchall(X()).optional(),annotations:Cy.optional(),execution:Ay.optional(),_meta:G(h(),X()).optional()}),mi=jr.extend({method:z("tools/list")}),Zy=Cr.extend({tools:A(Hd)}),cn=ce.extend({content:A(fi).default([]),structuredContent:G(h(),X()).optional(),isError:se().optional()}),eE=cn.or(ce.extend({toolResult:X()})),My=Ir.extend({name:h(),arguments:G(h(),X()).optional()}),Dr=ae.extend({method:z("tools/call"),params:My}),Dy=Oe.extend({method:z("notifications/tools/list_changed"),params:Ie.optional()}),tE=b({autoRefresh:se().default(!0),debounceMs:U().int().nonnegative().default(300)}),qr=$e(["debug","info","notice","warning","error","critical","alert","emergency"]),qy=Ee.extend({level:qr}),hi=ae.extend({method:z("logging/setLevel"),params:qy}),Ly=Ie.extend({level:qr,logger:h().optional(),data:X()}),Fy=Oe.extend({method:z("notifications/message"),params:Ly}),Uy=b({name:h().optional()}),Vy=b({hints:A(Uy).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),Hy=b({mode:$e(["auto","required","none"]).optional()}),Gy=b({type:z("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:A(fi).default([]),structuredContent:b({}).loose().optional(),isError:se().optional(),_meta:G(h(),X()).optional()}),Ky=Ys("type",[li,pi,di]),Jo=Ys("type",[li,pi,di,Ty,Gy]),Jy=b({role:Mr,content:W([Jo,A(Jo)]),_meta:G(h(),X()).optional()}),Wy=Ir.extend({messages:A(Jy),modelPreferences:Vy.optional(),systemPrompt:h().optional(),includeContext:$e(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:A(h()).optional(),metadata:ne.optional(),tools:A(Hd).optional(),toolChoice:Hy.optional()}),By=ae.extend({method:z("sampling/createMessage"),params:Wy}),Lr=ce.extend({model:h(),stopReason:ee($e(["endTurn","stopSequence","maxTokens"]).or(h())),role:Mr,content:Ky}),gi=ce.extend({model:h(),stopReason:ee($e(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Mr,content:W([Jo,A(Jo)])}),Qy=b({type:z("boolean"),title:h().optional(),description:h().optional(),default:se().optional()}),Yy=b({type:z("string"),title:h().optional(),description:h().optional(),minLength:U().optional(),maxLength:U().optional(),format:$e(["email","uri","date","date-time"]).optional(),default:h().optional()}),Xy=b({type:$e(["number","integer"]),title:h().optional(),description:h().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),ev=b({type:z("string"),title:h().optional(),description:h().optional(),enum:A(h()),default:h().optional()}),tv=b({type:z("string"),title:h().optional(),description:h().optional(),oneOf:A(b({const:h(),title:h()})),default:h().optional()}),rv=b({type:z("string"),title:h().optional(),description:h().optional(),enum:A(h()),enumNames:A(h()).optional(),default:h().optional()}),ov=W([ev,tv]),nv=b({type:z("array"),title:h().optional(),description:h().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({type:z("string"),enum:A(h())}),default:A(h()).optional()}),sv=b({type:z("array"),title:h().optional(),description:h().optional(),minItems:U().optional(),maxItems:U().optional(),items:b({anyOf:A(b({const:h(),title:h()}))}),default:A(h()).optional()}),iv=W([nv,sv]),av=W([rv,ov,iv]),cv=W([av,Qy,Yy,Xy]),uv=Ir.extend({mode:z("form").optional(),message:h(),requestedSchema:b({type:z("object"),properties:G(h(),cv),required:A(h()).optional()})}),lv=Ir.extend({mode:z("url"),message:h(),elicitationId:h(),url:h().url()}),pv=W([uv,lv]),dv=ae.extend({method:z("elicitation/create"),params:pv}),fv=Ie.extend({elicitationId:h()}),mv=Oe.extend({method:z("notifications/elicitation/complete"),params:fv}),Ht=ce.extend({action:$e(["accept","decline","cancel"]),content:Xs(t=>t===null?void 0:t,G(h(),W([h(),U(),se(),A(h())])).optional())}),hv=b({type:z("ref/resource"),uri:h()});var gv=b({type:z("ref/prompt"),name:h()}),_v=Ee.extend({ref:W([gv,hv]),argument:b({name:h(),value:h()}),context:b({arguments:G(h(),h()).optional()}).optional()}),yv=ae.extend({method:z("completion/complete"),params:_v});var vv=ce.extend({completion:_e({values:A(h()).max(100),total:ee(U().int()),hasMore:ee(se())})}),$v=b({uri:h().startsWith("file://"),name:h().optional(),_meta:G(h(),X()).optional()}),bv=ae.extend({method:z("roots/list"),params:Ee.optional()}),_i=ce.extend({roots:A($v)}),wv=Oe.extend({method:z("notifications/roots/list_changed"),params:Ie.optional()}),rE=W([Xo,ii,yv,hi,Ey,zy,uy,py,my,yy,$y,Dr,mi,tn,on,nn,an]),oE=W([Yo,en,ai,wv,Zr]),nE=W([Qo,Lr,gi,Ht,_i,rn,sn,Ut]),sE=W([Xo,By,dv,bv,tn,on,nn,an]),iE=W([Yo,en,Fy,wy,gy,Dy,jy,Zr,mv]),aE=W([Qo,ry,vv,Ny,ky,ly,dy,hy,cn,Zy,rn,sn,Ut]),R=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===C.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new ei(n.elicitations,r)}return new t(e,r,o)}},ei=class extends R{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(C.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function lt(t){return t==="completed"||t==="failed"||t==="cancelled"}var xv=Symbol("Let zodToJsonSchema decide on which parser to use");var qE=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function yi(t){let r=Ho(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=Bp(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function vi(t,e){let r=ct(t,e);if(!r.success)throw r.error;return r.data}var Tv=6e4,un=class{constructor(e){this._options=e,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(Yo,r=>{this._oncancel(r)}),this.setNotificationHandler(en,r=>{this._onprogress(r)}),this.setRequestHandler(Xo,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(tn,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(on,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let p=c,d=new R(p.error.code,p.error.message,p.error.data);l(d)}else{let p=a.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new R(C.InvalidParams,`Task not found: ${s}`);if(!lt(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(lt(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ut]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(nn,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new R(C.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(an,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(C.InvalidParams,`Task not found: ${r.params.taskId}`);if(lt(n.status))throw new R(C.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new R(C.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof R?n:new R(C.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),R.fromError(C.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){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=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),Or(s)||Zd(s)?this._onresponse(s):oi(s)?this._onrequest(s,i):Ad(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(C.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[ut]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:C.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):n?.send(l).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Nd(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let p={relatedRequestId:e.id};s&&(p.relatedTask={taskId:s}),await this.notification(l,p)},sendRequest:async(l,p,d)=>{if(i.signal.aborted)throw new R(C.ConnectionClosed,"Request was cancelled");let f={...d,relatedRequestId:e.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let m=f.relatedTask?.taskId??s;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,p,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let p={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)},async l=>{if(i.signal.aborted)return;let p={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:C.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),Or(e))o(e);else{let i=new R(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Or(e)&&e.result&&typeof e.result=="object"){let i=e.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),Or(e))n(e);else{let i=R.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}return}let s;try{let i=await this.request(e,Ut,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(C.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},lt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new R(C.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(C.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let p=P=>{l(P)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(P){p(P);return}o?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:d};o?.onprogress&&(this._progressHandlers.set(d,o.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ut]:c}});let m=P=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(P)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let w=P instanceof R?P:new R(C.RequestTimeout,String(P));l(w)};this._responseHandlers.set(d,P=>{if(!o?.signal?.aborted){if(P instanceof Error)return l(P);try{let w=ct(r,P.result);w.success?u(w.data):l(w.error)}catch(w){l(w)}}}),o?.signal?.addEventListener("abort",()=>{m(o?.signal?.reason)});let _=o?.timeout??Tv,y=()=>m(R.fromError(C.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(d,_,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let P=w=>{let S=this._responseHandlers.get(d);S?S(w):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,P),this._enqueueTaskMessage(v,{type:"request",message:f,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(d),l(w)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(d),l(P)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},rn,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},sn,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},qd,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ut]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ut]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ut]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=yi(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=vi(e,n);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let o=yi(e);this._notificationHandlers.set(o,n=>{let s=vi(e,n);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&oi(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new R(C.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new R(C.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(C.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Zr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),lt(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new R(C.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(lt(a.status))throw new R(C.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Zr.parse({method:"notifications/tasks/status",params:c});await this.notification(u),lt(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function Gd(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Kd(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];Gd(i)&&Gd(s)?r[n]={...i,...s}:r[n]=s}return r}var Dh=hr(sc(),1),qh=hr(Mh(),1);function OS(){let t=new Dh.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,qh.default)(t),t}var Vn=class{constructor(e){this._ajv=e??OS()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Hn=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.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(d=>d.type==="tool_use").map(d=>d.id)),p=new Set(s.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==p.size||![...l].every(d=>p.has(d)))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:e},Lr,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},Ht,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function Lh(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Fh(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Gn=class extends un{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(qr.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Vn,this.setRequestHandler(ii,o=>this._oninitialize(o)),this.setNotificationHandler(ai,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(hi,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=qr.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Hn(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Kd(this._capabilities,e)}setRequestHandler(e,r){let n=Ho(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(Lt(n)){let a=n;s=a._zod?.def?.value??a.value}else{let a=n;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=ct(Dr,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(C.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:p}=l.data,d=await Promise.resolve(r(c,u));if(p.task){let m=ct(Ut,d);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new R(C.InvalidParams,`Invalid task creation result: ${_}`)}return m.data}let f=ct(cn,d);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(C.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);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 ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);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 ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);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 ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Fh(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Lh(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Rd.includes(r)?r:ti,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"},Qo)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.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(n.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(p=>p.type==="tool_use").map(p=>p.id)),l=new Set(n.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==l.size||![...u].every(p=>l.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},gi,r):this.request({method:"sampling/createMessage",params:e},Lr,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},Ht,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},Ht,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new R(C.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(C.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,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:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},_i,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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"})}};var fc=hr(require("node:process"),1);var Kn=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
73
+ `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),NS(r)}clear(){this._buffer=void 0}};function NS(t){return Md.parse(JSON.parse(t))}function Uh(t){return JSON.stringify(t)+`
74
+ `}var Jn=class{constructor(e=fc.default.stdin,r=fc.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Kn,this._started=!1,this._ondata=o=>{this._readBuffer.append(o),this.processReadBuffer()},this._onerror=o=>{this.onerror?.(o)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let o=Uh(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};function vo(t){return(t??"").trim().replace(/\\/g,"/").replace(/^(?:\.\.?\/)+/,"")}var jS=/\]\((\.{1,2}\/[^)\s]*)\)/g,CS=/(?<![\w:.\-/])([0-9]{3})(?![\w-])/g;function AS(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Vh="ts|tsx|js|jsx|mjs|cjs|cs|py|go",ZS=new RegExp(`\\]\\(((?:\\.{1,2}/)+[^)\\s]*\\.(?:${Vh}))\\)`,"g"),MS=/`([^`\r\n]+)`/g,DS=new RegExp(`^\\.{0,2}/?(?:[^\\s/]+/)+[^\\s/]+\\.(?:${Vh})$`);function qS(t){return vo(t)}var LS=/^#{2,4}\s+([A-Z][A-Za-z0-9]+)\b[^\n]*\(([^)]*(?:\.[a-z]{2,4}|:\d+|db\.types)[^)]*)\)/gm;function FS(t){return t.trim().slice(0,100)}function mc(t){let e=new Map;for(let r of t.matchAll(jS)){let o=r[0];for(let n of r[1].split("/")){if(!n||n==="."||n==="..")continue;let s=e.get(n);e.set(n,{kind:"link",targetHint:n,evidence:s?.evidence??o,count:(s?.count??0)+1})}}return[...e.values()]}function hc(t,e,r){let o=[...new Set(e)].filter(a=>a&&a!==r);if(o.length===0||!t)return[];o.sort((a,c)=>c.length-a.length);let n=o.map(AS).join("|"),s=new RegExp(`(?<![A-Za-z0-9-])(?:${n})(?![A-Za-z0-9-])`,"g"),i=new Map;for(let a of t.matchAll(s))i.set(a[0],(i.get(a[0])??0)+1);return[...i.entries()].map(([a,c])=>({id:a,count:c}))}function gc(t){let e=new Map,r=new Map;for(let o of t.split(/\r?\n/))if(!/\bT\d{3}\b/.test(o))for(let n of o.matchAll(CS)){let s=n[1];r.set(s,(r.get(s)??0)+1),e.has(s)||e.set(s,FS(o))}return[...r.entries()].map(([o,n])=>({kind:"number",targetHint:o,evidence:e.get(o)??o,count:n}))}function _c(t){let e=new Map;for(let r of t.matchAll(LS)){let o=r[1];e.has(o)||e.set(o,{kind:"entity",targetHint:o,evidence:r[0].trim().slice(0,100),count:1})}return[...e.values()]}function yc(t){let e=new Map,r=o=>{let n=qS(o);if(!n)return;let s=e.get(n);e.set(n,{kind:"code",targetHint:n,evidence:n,count:(s?.count??0)+1})};for(let o of t.matchAll(ZS))r(o[1]);for(let o of t.matchAll(MS)){let n=o[1].trim();DS.test(n)&&r(n)}return[...e.values()]}var US=/^\s*\*\*Status\*\*:\s*(.+?)\s*$/m,VS=/^(?!\s*\*\*Status\*\*)\s*\S[^\n]*?\*\*Status\*\*:\s*(.+?)(?=\s+[·|]\s+\*\*|\s*$)/;function $o(t){if(typeof t!="string"||t==="")return null;let e=US.exec(t);if(e){let n=e.index+e[0].indexOf("**Status**");return{value:e[1].trim(),inline:!1,line:t.slice(0,n).split(/\r\n|\n|\r/).length-1}}let r=t.split(/\r\n|\n|\r/),o=r.findIndex(n=>/^#\s/.test(n));for(let n=o+1;n<r.length&&!/^##\s/.test(r[n]);n++){let s=VS.exec(r[n]);if(s&&s[1].trim()!=="")return{value:s[1].trim(),inline:!0,line:n}}return null}function Wn(t){let e=typeof t?.id=="string"?t.id:"",r=typeof t?.number=="string"?t.number:null,o=[],n=t&&typeof t.files=="object"&&t.files?t.files:{},s=Array.isArray(t?.artifacts)?t.artifacts.filter(y=>typeof y=="string"):[],i=HS(n,s);i.ambiguous.length>1&&o.push({code:"ambiguous-spec-file",message:`Feature "${e}" has no spec.md and several *.spec.md files (${i.ambiguous.join(", ")}); none was used.`,featureId:e});let a=KS(s),c={...a,spec:i.name==="spec.md"?a.spec:i.name!==null},u;i.name!==null&&typeof t?.dir=="string"&&t.dir!==""&&(u=`${t.dir.replace(/\\/g,"/").replace(/\/+$/,"")}/${i.name}`);let l=e,p=null,d=!1,f=null,m=[],_="";try{let y=i.name!==null?vc(n,i.name):"",v=vc(n,"tasks.md"),P=vc(n,"data-model.md"),w=Object.values(n).join(`
75
+ `);_=w,l=JS(y)??e;let S=$o(y);p=S?S.value:null,d=S?.inline===!0,f=WS(v),m=[...mc(w),...gc(w),...yc(w),...P?_c(P):[]]}catch{o.push({code:"parse-error",message:`Could not fully parse feature "${e}"; using partial data.`,featureId:e})}return{id:e,number:r,title:l,status:p,taskCompletion:f,completeness:c,...u!==void 0?{specFile:u}:{},...d?{statusInline:!0}:{},references:m,warnings:o,mentionText:_}}function Hh(t){return t.replace(/\\/g,"/").split("/").pop()??t}function HS(t,e){if(Object.keys(t).some(i=>Hh(i)==="spec.md")||e.some(i=>i.toLowerCase().replace(/\.md$/,"")==="spec"))return{name:"spec.md",ambiguous:[]};let o=new Set,n=i=>{let a=Hh(i),c=/\.spec$/.test(a)?`${a}.md`:a;/^.+\.spec\.md$/.test(c)&&o.add(c)};Object.keys(t).forEach(n),e.forEach(n);let s=[...o].sort();return s.length===1?{name:s[0],ambiguous:[]}:{name:null,ambiguous:s}}var GS={spec:["spec"],plan:["plan"],tasks:["tasks"],research:["research"],dataModel:["data-model","datamodel","dataModel"],quickstart:["quickstart"],contracts:["contracts"],checklists:["checklists"]};function KS(t){let e=new Set(t.map(o=>o.toLowerCase().replace(/\.md$/,""))),r=o=>GS[o].some(n=>e.has(n.toLowerCase()));return{spec:r("spec"),plan:r("plan"),tasks:r("tasks"),research:r("research"),dataModel:r("dataModel"),quickstart:r("quickstart"),contracts:r("contracts"),checklists:r("checklists")}}function vc(t,e){if(typeof t[e]=="string")return t[e];for(let[r,o]of Object.entries(t))if(r.replace(/\\/g,"/").split("/").pop()===e&&typeof o=="string")return o;return""}function JS(t){let e=t.match(/^#\s+(?:Feature Specification:\s*)?(.+?)\s*$/m);return e?e[1].trim():null}function WS(t){if(!t)return null;let e=0,r=0,o=0;for(let s of t.split(/\r\n|\n|\r/))/^\s*-\s*\[[xX]\]/.test(s)?e++:/^\s*-\s*\[ \]/.test(s)&&(r++,s.includes("[HELD]")&&o++);let n=e+r;return n===0?null:o>0?{done:e,total:n,held:o}:{done:e,total:n}}var $c={links:!0,slugMentions:!0,sharedEntities:!0,bareNumbers:!0,specToCode:!0};function bc(t){return{...$c,...t??{},links:!0}}var Gh={definitive:4,strong:3,medium:2,risky:1};function Qn(t,e,r,o){let n=bc(o),s=Array.isArray(r)?r.filter(d=>!!d):[],i=[],a=s.map(d=>XS(t,d,n)),c=new Set(s.map(d=>d.id)),u=QS(s,i),l=new Map,p=new Map;for(let d of s)try{for(let f of d.references??[])switch(f.kind){case"link":BS(f.targetHint,c,d.id)&&Bn(l,d.id,f.targetHint,"link","definitive",1,f.evidence);break;case"slug":break;case"number":if(n.bareNumbers){let m=u.get(f.targetHint);m&&m!==d.id&&Bn(l,d.id,m,"bare-number","risky",f.count,f.evidence)}break;case"entity":if(n.sharedEntities){let m=p.get(f.targetHint)??new Set;m.add(d.id),p.set(f.targetHint,m)}break;case"code":break}}catch{i.push({code:"assemble-error",message:`Skipped some edges for "${d.id}".`,featureId:d.id})}if(n.slugMentions)for(let d of s)try{for(let{id:f,count:m}of hc(d.mentionText,c,d.id))Bn(l,d.id,f,"slug-mention","strong",m,f)}catch{i.push({code:"assemble-error",message:`Skipped some mention edges for "${d.id}".`,featureId:d.id})}if(n.sharedEntities)for(let[d,f]of p){if(f.size<2)continue;let m=[...f].sort();for(let _=0;_<m.length;_++)for(let y=_+1;y<m.length;y++)Bn(l,m[_],m[y],"shared-entity","medium",1,d,!0)}for(let d of s)for(let f of d.warnings??[])i.push(f);return{projectId:t,name:e,nodes:a,edges:[...l.values()].map(YS),warnings:i}}function BS(t,e,r){return e.has(t)&&t!==r}function QS(t,e){let r=new Map;for(let n of t)if(n.number){let s=r.get(n.number)??[];s.push(n.id),r.set(n.number,s)}let o=new Map;for(let[n,s]of r)s.length===1?o.set(n,s[0]):e.push({code:"ambiguous-number",message:`Feature number ${n} maps to multiple features (${s.join(", ")}); no edge inferred.`,featureIds:[...s].sort((i,a)=>i.localeCompare(a))});return o}function Bn(t,e,r,o,n,s,i,a=!1){if(e===r)return;let c=`${e}\0${r}`,u=t.get(c);if(!u){t.set(c,{source:e,target:r,heuristic:o,tier:n,weight:s,evidence:[i],symmetric:a});return}u.evidence.includes(i)||u.evidence.push(i),Gh[n]>Gh[u.tier]?(u.tier=n,u.heuristic=o,u.weight=s,u.symmetric=a):n===u.tier&&(u.weight=Math.max(u.weight,s),u.symmetric=u.symmetric&&a)}function YS(t){let e={source:t.source,target:t.target,heuristic:t.heuristic,tier:t.tier,weight:t.weight,evidence:t.evidence};return t.symmetric?{...e,symmetric:!0}:e}function XS(t,e,r){let o={id:e.id,projectId:t,title:e.title,status:e.status,taskCompletion:e.taskCompletion,completeness:e.completeness,...e.specFile!==void 0?{specFile:e.specFile}:{},...e.statusInline?{statusInline:!0}:{},warnings:e.warnings??[]};if(!r.specToCode)return o;let n=[...new Set((e.references??[]).filter(s=>s.kind==="code").map(s=>s.targetHint))];return{...o,codeReferences:n}}function Yn(t,e){return{projects:(Array.isArray(t)?t:[]).filter(n=>!!n).map(n=>{let s=(n.features??[]).map(i=>Wn(i));return Qn(n.projectId,n.name,s,e)})}}function wc(t){return[...t].sort((e,r)=>e.id.localeCompare(r.id))}function Xn(t){return[...t].sort((e,r)=>e.source.localeCompare(r.source)||e.target.localeCompare(r.target)||e.heuristic.localeCompare(r.heuristic))}function es(t){return{...t,nodes:wc(t.nodes),edges:Xn(t.edges)}}function xc(t){return{projects:[...t.projects].map(es).sort((r,o)=>r.projectId.localeCompare(o.projectId))}}function Ue(t,e,r){return{schemaVersion:1,kind:t,data:e,warnings:[...r]}}var tz=new Set(["complete","done","shipped"]),Sc={word:null,legacy:null,unknown:null,note:null,suffix:"",raw:null};function Ot(t){if(typeof t!="string")return Sc;let e=t.trim(),r=/^[*_`\s]+/.exec(e),o=e.slice(r?r[0].length:0);if(o==="")return{...Sc,raw:e};let n=/^in[\s-]+progress\b/i.exec(o),s=n??/^[^\s(—–\-,;:.*_`]+/.exec(o);if(!s)return{...Sc,raw:e,unknown:e};let i=s[0],a=o.slice(i.length).replace(/^[*_`]+/,""),c=rz(a),u=i.toLowerCase(),l=null,p=null;return n?l="In progress":u==="draft"?l="Draft":u==="held"?l="Held":u==="implemented"?l="Implemented":u==="completed"?l="Completed":tz.has(u)&&(l="Completed",p=i),{word:l,legacy:p,unknown:l===null?i:null,note:c,suffix:a,raw:e}}function rz(t){let e=t.trim();if(e==="")return null;let r=/^[—–\-,;:.]\s*([\s\S]*)$/.exec(e),o=(r?r[1]:e).trim();return o===""?null:o}function bo(t){return t==="In progress"||t==="Held"||t==="Implemented"||t==="Completed"}function wo(t){if(!t||!(t.total>0))return null;let e=t.total-t.done;return e<=0?"Implemented":(t.held??0)>=e?"Held":t.done>0?"In progress":"Draft"}function xo(t,e){let r=new Set(e);return t.filter(o=>{let n=o.featureId!==void 0,s=o.featureIds!==void 0;return!n&&!s?!0:n&&r.has(o.featureId)||(o.featureIds??[]).some(i=>r.has(i))})}var oz=/^(in)[\s-]+(progress|review)\b|^(on)[\s-]+(hold)\b|^(not)[\s-]+(started)\b/i;function Kh(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function ts(t){if(t===null)return"(none)";let e=t.trim().replace(/^[*_`\s]+/,"");if(e==="")return"(none)";let r=Ot(e);if(r.word)return r.word;let o=oz.exec(e);if(o)return o.slice(1).filter(i=>i!==void 0).map(Kh).join(" ");let n=/^[^\s(—–\-,;:.*_`]+/.exec(e);return n?Kh(n[0]):"(none)"}function Nt(t,e){let r=t?.projects??[],o=e?.projectId??null;return o?r.filter(n=>n.projectId===o):[...r]}function So(t,e){let r=e?.projectId??null;if(r){let o=(t?.projects??[]).find(n=>n.projectId===r);return o?es(o):{projectId:r,name:r,nodes:[],edges:[],warnings:[]}}return xc(t??{projects:[]})}function rs(t,e,r){let o=Nt(t,r),n=null,s=[],i=[];for(let a of o){let c=a.nodes.find(u=>u.id===e);if(c){n=c;for(let u of a.edges)u.source===e&&s.push(u),u.target===e&&i.push(u)}}return{spec:n,found:n!==null,dependsOn:Xn(s),dependedOnBy:Xn(i)}}function os(t,e,r){let o=vo(e);if(o==="")return{path:"",matches:[]};let n=o.includes("/")?o.slice(0,o.lastIndexOf("/")):"",s=n===""?null:n+"/",i=[],a=[];for(let u of Nt(t,r))for(let l of u.nodes){let p=l.codeReferences??[];p.includes(o)?i.push(Jh(l,"exact")):s&&p.some(d=>d.startsWith(s))&&a.push(Jh(l,"folder"))}let c=(i.length>0?i:a).sort(nz);return{path:o,matches:c}}function Jh(t,e){return{specId:t.id,projectId:t.projectId,title:t.title,status:t.status,matchKind:e}}var Wh={exact:0,folder:1};function nz(t,e){return Wh[t.matchKind]-Wh[e.matchKind]||t.projectId.localeCompare(e.projectId)||t.specId.localeCompare(e.specId)}function ns(t,e){let r=wc(Nt(t,e).flatMap(c=>c.nodes)),o=new Map,n=0,s=0,i=r.map(c=>{let u=ts(c.status);return o.set(u,(o.get(u)??0)+1),c.taskCompletion&&(n+=c.taskCompletion.done,s+=c.taskCompletion.total),{id:c.id,projectId:c.projectId,status:c.status,done:c.taskCompletion?.done??null,total:c.taskCompletion?.total??null}}),a={};for(let c of[...o.keys()].sort((u,l)=>u.localeCompare(l)))a[c]=o.get(c)??0;return{perSpec:i,aggregate:{specs:r.length,byStatus:a,tasksDone:n,tasksTotal:s}}}function lr(t,e){let r=[];for(let o of Nt(t,e)){let n=new Set;for(let s of o.edges)n.add(s.source),n.add(s.target);for(let s of o.nodes)n.has(s.id)||r.push(s.id)}return{orphans:[...r].sort((o,n)=>o.localeCompare(n))}}var pr=["no-orphans","status-present","status-matches-tasks","unique-numbers","has-tasks"],kc=["status-present","status-matches-tasks","unique-numbers","has-tasks"];function zo(t){return`Unknown rule "${t}". Known rules: ${pr.join(", ")}, all`}function ko(t){let e=[],r=[],o=pr,n=s=>{e.includes(s)||e.push(s)};for(let s of String(t??"").split(",")){let i=s.trim();i==="all"?kc.forEach(n):o.includes(i)?n(i):r.push(i)}return{rules:e,unknown:r}}function ss(t,e,r){let{rules:o,unknown:n}=ko(e);if(n.length>0||o.length===0)return{rule:e,ok:!1,violations:[],error:zo(n[0]??e)};let s;try{s=o.map(i=>sz(t,i,r))}catch{return{rule:e,ok:!1,violations:[],error:`Check "${e}" could not be evaluated.`}}return s.length===1?s[0]:{rule:e,ok:s.every(i=>i.ok),violations:s.flatMap(i=>i.violations.map(a=>`[${i.rule}] ${a}`)),details:s.flatMap(i=>i.details??[]),results:s}}function sz(t,e,r){if(e==="no-orphans"){let a=lr(t,r).orphans;return{rule:e,ok:a.length===0,violations:a,details:a.map(c=>({rule:e,specId:c,message:"no relationships"}))}}let o=iz(t,r),n;switch(e){case"status-present":n=o.flatMap(az);break;case"status-matches-tasks":n=o.flatMap(cz);break;case"has-tasks":n=o.flatMap(uz);break;default:n=lz(t,r)}let s=n.map(a=>({rule:e,specId:a.specId,message:a.message,expected:a.expected??null,current:a.current??null})),i=n.map(a=>{let c=a.tail!==void 0?a.tail:!a.inline&&a.expected?`; expected ${a.expected}${a.hint?` ${a.hint}`:""}`:"";return`${a.specId}: ${a.message}${c}`});return{rule:e,ok:n.length===0,violations:i,details:s}}function iz(t,e){return Nt(t,e).flatMap(r=>[...r.nodes].sort((o,n)=>o.id.localeCompare(n.id)))}var zc="(or Completed once the lead accepts it)";function az(t){let e=wo(t.taskCompletion),r=e??void 0,o=e==="Implemented"?zc:void 0;if(!t.completeness.spec){let n=t.warnings.some(s=>s.code==="ambiguous-spec-file");return[{specId:t.id,message:n?"no spec file used (several *.spec.md and no spec.md)":"no spec file",expected:r,hint:o,current:null}]}return t.status===null?[{specId:t.id,message:"no **Status**: line",expected:r,hint:o,current:null}]:[]}function cz(t){let e=wo(t.taskCompletion),r=t.taskCompletion;if(e===null||!r)return[];let o=Ot(t.status),n=r.total-r.done,s=t.status,i=o.legacy??o.word??"",a=o.legacy?` (legacy word '${o.legacy}' read as Completed)`:"",c=t.statusInline?" (inline status)":"",u=(l,p,d)=>[{specId:t.id,message:l+c,expected:p,current:s,hint:d}];if(o.raw===null)return u(`no Status line, but tasks say ${e} (${r.done}/${r.total} ticked)`,e,e==="Implemented"?zc:void 0);if(o.word===null)return u(`unrecognised status word '${o.unknown??o.raw}'`,e);if(e==="Implemented")return o.word==="Implemented"?[]:o.word==="Completed"?o.legacy?[{specId:t.id,message:`legacy word '${o.legacy}' read as Completed; the lead should write Completed${c}`,expected:"Completed",current:s,inline:!0}]:[]:u(`status is ${i} but all ${r.total} tasks are ticked`,"Implemented",zc);if(o.word===e)return[];if(o.word==="Implemented"||o.word==="Completed")return u(`status is ${i} but ${n} of ${r.total} tasks ${n===1?"is":"are"} open${a}`,e);if(o.word==="Held"){let l=n-(r.held??0);return u(`status is Held but ${l} open task(s) are not marked [HELD]`,e)}return o.word==="Draft"?u(`status is Draft but ${r.done} of ${r.total} tasks are ticked`,e):r.done===0?u("status is In progress but no tasks are ticked",e):u(`status is ${i} but tasks say ${e}`,e)}function uz(t){let e=Ot(t.status);if(!bo(e.word)||t.taskCompletion!==null)return[];let r=e.legacy??e.word??"",o=t.completeness.tasks?"tasks.md has no tasks":"there is no tasks.md",n=e.legacy?` (legacy word '${e.legacy}' read as Completed)`:"";return[{specId:t.id,message:`status is ${r} but ${o}${n}`,current:t.status,tail:"; expected tasks.md with at least one task"}]}function lz(t,e){let r=[];for(let o of Nt(t,e)){let n=new Map(o.nodes.map(s=>[s.id,s]));for(let s of o.warnings){if(s.code!=="ambiguous-number")continue;let i=[...s.featureIds??[]].sort((a,c)=>a.localeCompare(c));for(let a of i){let c=/^(\d{3})-/.exec(a)?.[1]??"?",u=i.filter(l=>l!==a);r.push({specId:a,message:`feature number ${c} is also used by ${u.join(", ")}`,current:n.get(a)?.status??null})}}}return r.sort((o,n)=>o.specId.localeCompare(n.specId))}var jt=hr(require("node:fs")),de=hr(require("node:path")),Bh=require("node:url"),gz=["spec.md","plan.md","tasks.md","data-model.md","research.md","quickstart.md"],_z=["spec","plan","tasks","research","data-model","quickstart"],yz=["contracts","checklists"];function Qh(t){let e=[],r=de.resolve(t),o=s=>{let i=vz(de.join(s,"specs"),r);i.length>0&&e.push({projectId:(0,Bh.pathToFileURL)(s).toString(),name:de.basename(s),features:i})};o(r);for(let s of Ec(r))s.isDirectory()&&!s.name.startsWith(".")&&s.name!=="node_modules"&&o(de.join(r,s.name));let n=new Set;return e.filter(s=>n.has(s.projectId)?!1:(n.add(s.projectId),!0))}function vz(t,e){let r=[];for(let o of Ec(t))o.isDirectory()&&r.push($z(de.join(t,o.name),o.name,e));return r}function $z(t,e,r){let o=e.match(/^(\d{3})-/),n=o?o[1]:null,s=[];for(let l of _z)Pc(de.join(t,`${l}.md`))&&s.push(l);for(let l of yz)bz(de.join(t,l))&&s.push(l);let i=Pc(de.join(t,"spec.md"))?[]:Ec(t).filter(l=>/^.+\.spec\.md$/.test(l.name)&&Pc(de.join(t,l.name))).map(l=>l.name).sort();s.push(...i);let a={},c=[...gz,...i.length===1?i:[]];for(let l of c){let p=wz(de.join(t,l));p!==null&&(a[l]=p)}let u=de.relative(r,t).split(de.sep).join("/");return{id:e,number:n,artifacts:s,files:a,dir:u}}function Ec(t){try{return jt.readdirSync(t,{withFileTypes:!0})}catch{return[]}}function Pc(t){try{return jt.statSync(t).isFile()}catch{return!1}}function bz(t){try{return jt.statSync(t).isDirectory()}catch{return!1}}function wz(t){try{return jt.readFileSync(t,"utf8")}catch{return null}}function Yh(t){let e=Qh(t.root),r=Yn(e,{bareNumbers:!1,...t.options}),o={projectId:t.projectId??null},n=r.projects.flatMap(s=>[...s.warnings]);switch(t.kind){case"graph":return Ue("graph",So(r,o),n);case"spec":{let s=t.specId??"";return Ue("spec",rs(r,s,o),xo(n,[s]))}case"file":{let s=os(r,t.path??"",o);return Ue("file",s,xo(n,s.matches.map(i=>i.specId)))}case"status":return Ue("status",ns(r,o),n);case"orphans":return Ue("orphans",lr(r,o),n);case"check":return Ue("check",ss(r,t.rule??"no-orphans",o),n);default:return Ue("graph",So(r,o),n)}}var{values:xz}=(0,eg.parseArgs)({args:process.argv.slice(2),options:{root:{type:"string"}},allowPositionals:!0}),Sz=xz.root??process.cwd(),Xh=pr.join(", "),zz={type:"object",description:"Heuristic toggles (defaults per the model).",properties:{slugMentions:{type:"boolean",description:"Slug-mention edges. Default true."},sharedEntities:{type:"boolean",description:"Shared-entity edges. Default true."},bareNumbers:{type:"boolean",description:"Opt-in risky tier (bare feature numbers); default false."},specToCode:{type:"boolean",description:"Spec->code layer (source-file references; feeds atlas_specs_for_file). Default true."}}},dr={root:{type:"string",description:"Workspace root (default: server root)."},projectId:{type:"string",description:"Scope to one project."},options:zz},tg=[{name:"atlas_graph",kind:"graph",description:"The spec-relationship graph for a project (or all).",inputSchema:{type:"object",properties:{...dr}}},{name:"atlas_spec_relationships",kind:"spec",description:"A spec's dependsOn / dependedOnBy with tier/weight/evidence.",inputSchema:{type:"object",required:["specId"],properties:{specId:{type:"string"},...dr}}},{name:"atlas_specs_for_file",kind:"file",description:"Which spec(s) reference/relate to a source file (reverse traceability). Derived from spec artifacts (feature 011), no git.",inputSchema:{type:"object",required:["path"],properties:{path:{type:"string",description:"File path relative to the workspace root."},...dr}}},{name:"atlas_status_summary",kind:"status",description:"Implementation-status / completeness summary.",inputSchema:{type:"object",properties:{...dr}}},{name:"atlas_orphans",kind:"orphans",description:"Specs with no relationships.",inputSchema:{type:"object",properties:{...dr}}},{name:"atlas_check",kind:"check",description:`Evaluate one rule, a comma-separated list, or "all" (every rule except no-orphans); default no-orphans. Returns { ok, violations, details } (plus per-rule results for several rules). Status rules compare each spec's **Status** with what its tasks.md implies; violations read "<spec-id>: <what is wrong>; expected <Status>". An unknown rule is an error (known rules: ${Xh}, all). Read-only: there is no fix tool; the CLI's fix-status prints a diff.`,inputSchema:{type:"object",properties:{rule:{type:"string",description:`Rule(s) to check: one, a comma-separated list, or "all" (every rule except no-orphans). Known rules: ${Xh}, all. Default no-orphans.`},...dr}}}],kz="0.1.3",Tc=new Gn({name:"speckit-atlas",version:kz},{capabilities:{tools:{}}});Tc.setRequestHandler(mi,async()=>({tools:tg.map(t=>({name:t.name,description:t.description,inputSchema:t.inputSchema}))}));Tc.setRequestHandler(Dr,async t=>{let e=tg.find(n=>n.name===t.params.name);if(!e)return{isError:!0,content:[{type:"text",text:`Unknown tool: ${t.params.name}`}]};let r=t.params.arguments??{};if(e.kind==="check"&&r.rule!==void 0){let{unknown:n}=ko(String(r.rule));if(n.length>0)return{isError:!0,content:[{type:"text",text:zo(n[0])}]}}let o=Yh({root:r.root??Sz,kind:e.kind,specId:r.specId,path:r.path,rule:r.rule,projectId:r.projectId??null,options:r.options});return{content:[{type:"text",text:JSON.stringify(o)}]}});async function Pz(){await Tc.connect(new Jn)}Pz();