nagoc-zerowork 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +307 -81
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var ih=Object.create;var An=Object.defineProperty;var ah=Object.getOwnPropertyDescriptor;var ch=Object.getOwnPropertyNames;var uh=Object.getPrototypeOf,lh=Object.prototype.hasOwnProperty;var b=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ja=(t,e)=>{for(var r in e)An(t,r,{get:e[r],enumerable:!0})},dh=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ch(e))!lh.call(t,n)&&n!==r&&An(t,n,{get:()=>e[n],enumerable:!(o=ah(e,n))||o.enumerable});return t};var Ha=(t,e,r)=>(r=t!=null?ih(uh(t)):{},dh(e||!t||!t.__esModule?An(r,"default",{value:t,enumerable:!0}):r,t));var Cr=b(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 Zr=class{};L._CodeOrName=Zr;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var bt=class extends Zr{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 Ie=class extends Zr{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=Ie;L.nil=new Ie("");function cp(t,...e){let r=[t[0]],o=0;for(;o<e.length;)Ys(r,e[o]),r.push(t[++o]);return new Ie(r)}L._=cp;var Ws=new Ie("+");function up(t,...e){let r=[Ar(t[0])],o=0;for(;o<e.length;)r.push(Ws),Ys(r,e[o]),r.push(Ws,Ar(t[++o]));return Oy(r),new Ie(r)}L.str=up;function Ys(t,e){e instanceof Ie?t.push(...e._items):e instanceof bt?t.push(e):t.push(Ny(e))}L.addCodeArg=Ys;function Oy(t){let e=1;for(;e<t.length-1;){if(t[e]===Ws){let r=Ry(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Ry(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 Iy(t,e){return e.emptyStr()?t:t.emptyStr()?e:up`${t}${e}`}L.strConcat=Iy;function Ny(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ar(Array.isArray(t)?t.join(","):t)}function jy(t){return new Ie(Ar(t))}L.stringify=jy;function Ar(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Ar;function Zy(t){return typeof t=="string"&&L.IDENTIFIER.test(t)?new Ie(`.${t}`):cp`[${t}]`}L.getProperty=Zy;function Ay(t){if(typeof t=="string"&&L.IDENTIFIER.test(t))return new Ie(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}L.getEsmExportName=Ay;function Cy(t){return new Ie(t.toString())}L.regexpCode=Cy});var ei=b($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.ValueScope=$e.ValueScopeName=$e.Scope=$e.varKinds=$e.UsedValueState=void 0;var be=Cr(),Qs=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Bo;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Bo||($e.UsedValueState=Bo={}));$e.varKinds={const:new be.Name("const"),let:new be.Name("let"),var:new be.Name("var")};var Go=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}}};$e.Scope=Go;var Wo=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}]`}};$e.ValueScopeName=Wo;var qy=(0,be._)`\n`,Xs=class extends Go{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?qy:be.nil}}get(){return this._scope}name(e){return new Wo(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,Bo.Started);let l=r(u);if(l){let d=this.opts.es5?$e.varKinds.var:$e.varKinds.const;s=(0,be._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,be._)`${s}${l}${this.opts._n}`;else throw new Qs(u);c.set(u,Bo.Completed)})}return s}};$e.ValueScope=Xs});var I=b(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 C=Cr(),Ce=ei(),lt=Cr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return lt._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return lt.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return lt.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return lt.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return lt.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return lt.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return lt.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return lt.Name}});var en=ei();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return en.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return en.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return en.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return en.varKinds}});N.operators={GT:new C._Code(">"),GTE:new C._Code(">="),LT:new C._Code("<"),LTE:new C._Code("<="),EQ:new C._Code("==="),NEQ:new C._Code("!=="),NOT:new C._Code("!"),OR:new C._Code("||"),AND:new C._Code("&&"),ADD:new C._Code("+")};var Xe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ti=class extends Xe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?Ce.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=Ft(this.rhs,e,r)),this}get names(){return this.rhs instanceof C._CodeOrName?this.rhs.names:{}}},Yo=class extends Xe{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 C.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Ft(this.rhs,e,r),this}get names(){let e=this.lhs instanceof C.Name?{}:{...this.lhs.names};return Xo(e,this.rhs)}},ri=class extends Yo{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},oi=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ni=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},si=class extends Xe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ii=class extends Xe{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=Ft(this.code,e,r),this}get names(){return this.code instanceof C._CodeOrName?this.code.names:{}}},qr=class extends Xe{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)||(Dy(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>wt(e,r.names),{})}},et=class extends qr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ai=class extends qr{},Ut=class extends et{};Ut.kind="else";var $t=class t extends et{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 Ut(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(lp(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=Ft(this.condition,e,r),this}get names(){let e=super.names;return Xo(e,this.condition),this.else&&wt(e,this.else.names),e}};$t.kind="if";var zt=class extends et{};zt.kind="for";var ci=class extends zt{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=Ft(this.iteration,e,r),this}get names(){return wt(super.names,this.iteration.names)}},ui=class extends zt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?Ce.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=Xo(super.names,this.from);return Xo(e,this.to)}},Qo=class extends zt{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=Ft(this.iterable,e,r),this}get names(){return wt(super.names,this.iterable.names)}},Dr=class extends et{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)}};Dr.kind="func";var Mr=class extends qr{render(e){return"return "+super.render(e)}};Mr.kind="return";var li=class extends et{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&&wt(e,this.catch.names),this.finally&&wt(e,this.finally.names),e}},Lr=class extends et{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Lr.kind="catch";var Ur=class extends et{render(e){return"finally"+super.render(e)}};Ur.kind="finally";var di=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
-
`:""},this._extScope=e,this._scope=new Ce.Scope({parent:e}),this._nodes=[new ai]}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 ti(e,s,o)),s}const(e,r,o){return this._def(Ce.varKinds.const,e,r,o)}let(e,r,o){return this._def(Ce.varKinds.let,e,r,o)}var(e,r,o){return this._def(Ce.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new Yo(e,r,o))}add(e,r){return this._leafNode(new ri(e,N.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==C.nil&&this._leafNode(new ii(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,C.addCodeArg)(r,n));return r.push("}"),new C._Code(r)}if(e,r,o){if(this._blockNode(new $t(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 $t(e))}else(){return this._elseNode(new Ut)}endIf(){return this._endBlockNode($t,Ut)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new ci(e),r)}forRange(e,r,o,n,s=this.opts.es5?Ce.varKinds.var:Ce.varKinds.let){let i=this._scope.toName(e);return this._for(new ui(s,i,r,o),()=>n(i))}forOf(e,r,o,n=Ce.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof C.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,C._)`${i}.length`,a=>{this.var(s,(0,C._)`${i}[${a}]`),o(s)})}return this._for(new Qo("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?Ce.varKinds.var:Ce.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,C._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new Qo("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(zt)}label(e){return this._leafNode(new oi(e))}break(e){return this._leafNode(new ni(e))}return(e){let r=new Mr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Mr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new li;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Lr(s),r(s)}return o&&(this._currNode=n.finally=new Ur,this.code(o)),this._endBlockNode(Lr,Ur)}throw(e){return this._leafNode(new si(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=C.nil,o,n){return this._blockNode(new Dr(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Dr)}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 $t))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=di;function wt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Xo(t,e){return e instanceof C._CodeOrName?wt(t,e.names):t}function Ft(t,e,r){if(t instanceof C.Name)return o(t);if(!n(t))return t;return new C._Code(t._items.reduce((s,i)=>(i instanceof C.Name&&(i=o(i)),i instanceof C._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 C._Code&&s._items.some(i=>i instanceof C.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Dy(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function lp(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,C._)`!${pi(t)}`}N.not=lp;var My=dp(N.operators.AND);function Ly(...t){return t.reduce(My)}N.and=Ly;var Uy=dp(N.operators.OR);function Fy(...t){return t.reduce(Uy)}N.or=Fy;function dp(t){return(e,r)=>e===C.nil?r:r===C.nil?e:(0,C._)`${pi(e)} ${t} ${pi(r)}`}function pi(t){return t instanceof C.Name?t:(0,C._)`(${t})`}});var D=b(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 J=I(),Vy=Cr();function Jy(t){let e={};for(let r of t)e[r]=!0;return e}j.toHash=Jy;function Hy(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(mp(t,e),!hp(e,t.self.RULES.all))}j.alwaysValidSchema=Hy;function mp(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]||yp(t,`unknown keyword: "${s}"`)}j.checkUnknownRules=mp;function hp(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}j.schemaHasRules=hp;function Ky(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=Ky;function By({topSchemaRef:t,schemaPath:e},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._)`${t}${e}${(0,J.getProperty)(o)}`}j.schemaRefOrVal=By;function Gy(t){return gp(decodeURIComponent(t))}j.unescapeFragment=Gy;function Wy(t){return encodeURIComponent(mi(t))}j.escapeFragment=Wy;function mi(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}j.escapeJsonPointer=mi;function gp(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}j.unescapeJsonPointer=gp;function Yy(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}j.eachItem=Yy;function pp({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof J.Name?(s instanceof J.Name?t(n,s,i):e(n,s,i),i):s instanceof J.Name?(e(n,i,s),s):r(s,i);return a===J.Name&&!(c instanceof J.Name)?o(n,c):c}}j.mergeEvaluated={props:pp({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,J._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,J._)`${r} || {}`).code((0,J._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,J._)`${r} || {}`),hi(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:_p}),items:pp({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,J._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,J._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function _p(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,J._)`{}`);return e!==void 0&&hi(t,r,e),r}j.evaluatedPropsToName=_p;function hi(t,e,r){Object.keys(r).forEach(o=>t.assign((0,J._)`${e}${(0,J.getProperty)(o)}`,!0))}j.setEvaluated=hi;var fp={};function Qy(t,e){return t.scopeValue("func",{ref:e,code:fp[e.code]||(fp[e.code]=new Vy._Code(e.code))})}j.useFunc=Qy;var fi;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(fi||(j.Type=fi={}));function Xy(t,e,r){if(t instanceof J.Name){let o=e===fi.Num;return r?o?(0,J._)`"[" + ${t} + "]"`:(0,J._)`"['" + ${t} + "']"`:o?(0,J._)`"/" + ${t}`:(0,J._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,J.getProperty)(t).toString():"/"+mi(t)}j.getErrorPath=Xy;function yp(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=yp});var tt=b(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});var pe=I(),ev={data:new pe.Name("data"),valCxt:new pe.Name("valCxt"),instancePath:new pe.Name("instancePath"),parentData:new pe.Name("parentData"),parentDataProperty:new pe.Name("parentDataProperty"),rootData:new pe.Name("rootData"),dynamicAnchors:new pe.Name("dynamicAnchors"),vErrors:new pe.Name("vErrors"),errors:new pe.Name("errors"),this:new pe.Name("this"),self:new pe.Name("self"),scope:new pe.Name("scope"),json:new pe.Name("json"),jsonPos:new pe.Name("jsonPos"),jsonLen:new pe.Name("jsonLen"),jsonPart:new pe.Name("jsonPart")};gi.default=ev});var Fr=b(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 M=I(),tn=D(),_e=tt();fe.keywordError={message:({keyword:t})=>(0,M.str)`must pass "${t}" keyword validation`};fe.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,M.str)`"${t}" keyword must be ${e} ($data)`:(0,M.str)`"${t}" keyword is invalid ($data)`};function tv(t,e=fe.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=$p(t,e,r);o??(i||a)?vp(s,c):bp(n,(0,M._)`[${c}]`)}fe.reportError=tv;function rv(t,e=fe.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=$p(t,e,r);vp(n,a),s||i||bp(o,_e.default.vErrors)}fe.reportExtraError=rv;function ov(t,e){t.assign(_e.default.errors,e),t.if((0,M._)`${_e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,M._)`${_e.default.vErrors}.length`,e),()=>t.assign(_e.default.vErrors,null)))}fe.resetErrorsCount=ov;function nv({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,_e.default.errors,a=>{t.const(i,(0,M._)`${_e.default.vErrors}[${a}]`),t.if((0,M._)`${i}.instancePath === undefined`,()=>t.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)(_e.default.instancePath,s.errorPath))),t.assign((0,M._)`${i}.schemaPath`,(0,M.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,M._)`${i}.schema`,r),t.assign((0,M._)`${i}.data`,o))})}fe.extendErrors=nv;function vp(t,e){let r=t.const("err",e);t.if((0,M._)`${_e.default.vErrors} === null`,()=>t.assign(_e.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${_e.default.vErrors}.push(${r})`),t.code((0,M._)`${_e.default.errors}++`)}function bp(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,M._)`new ${t.ValidationError}(${e})`):(r.assign((0,M._)`${o}.errors`,e),r.return(!1))}var xt={keyword:new M.Name("keyword"),schemaPath:new M.Name("schemaPath"),params:new M.Name("params"),propertyName:new M.Name("propertyName"),message:new M.Name("message"),schema:new M.Name("schema"),parentSchema:new M.Name("parentSchema")};function $p(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,M._)`{}`:sv(t,e,r)}function sv(t,e,r={}){let{gen:o,it:n}=t,s=[iv(n,r),av(t,r)];return cv(t,e,s),o.object(...s)}function iv({errorPath:t},{instancePath:e}){let r=e?(0,M.str)`${t}${(0,tn.getErrorPath)(e,tn.Type.Str)}`:t;return[_e.default.instancePath,(0,M.strConcat)(_e.default.instancePath,r)]}function av({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,M.str)`${e}/${t}`;return r&&(n=(0,M.str)`${n}${(0,tn.getErrorPath)(r,tn.Type.Str)}`),[xt.schemaPath,n]}function cv(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([xt.keyword,n],[xt.params,typeof e=="function"?e(t):e||(0,M._)`{}`]),c.messages&&o.push([xt.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([xt.schema,i],[xt.parentSchema,(0,M._)`${l}${d}`],[_e.default.data,s]),u&&o.push([xt.propertyName,u])}});var wp=b(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.boolOrEmptySchema=Vt.topBoolOrEmptySchema=void 0;var uv=Fr(),lv=I(),dv=tt(),pv={message:"boolean schema is false"};function fv(t){let{gen:e,schema:r,validateName:o}=t;r===!1?zp(t,!1):typeof r=="object"&&r.$async===!0?e.return(dv.default.data):(e.assign((0,lv._)`${o}.errors`,null),e.return(!0))}Vt.topBoolOrEmptySchema=fv;function mv(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),zp(t)):r.var(e,!0)}Vt.boolOrEmptySchema=mv;function zp(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,uv.reportError)(n,pv,void 0,e)}});var _i=b(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.getRules=Jt.isJSONType=void 0;var hv=["string","number","integer","boolean","null","object","array"],gv=new Set(hv);function _v(t){return typeof t=="string"&&gv.has(t)}Jt.isJSONType=_v;function yv(){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:{}}}Jt.getRules=yv});var yi=b(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.shouldUseRule=dt.shouldUseGroup=dt.schemaHasRulesForType=void 0;function vv({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&xp(t,o)}dt.schemaHasRulesForType=vv;function xp(t,e){return e.rules.some(r=>kp(t,r))}dt.shouldUseGroup=xp;function kp(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=kp});var Vr=b(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 bv=_i(),$v=yi(),zv=Fr(),R=I(),Sp=D(),Ht;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Ht||(me.DataType=Ht={}));function wv(t){let e=Pp(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}me.getSchemaTypes=wv;function Pp(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(bv.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}me.getJSONTypes=Pp;function xv(t,e){let{gen:r,data:o,opts:n}=t,s=kv(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,$v.schemaHasRulesForType)(t,e[0]));if(i){let a=bi(e,o,n.strictNumbers,Ht.Wrong);r.if(a,()=>{s.length?Sv(t,e,s):$i(t)})}return i}me.coerceAndCheckDataType=xv;var Ep=new Set(["string","number","integer","boolean","null"]);function kv(t,e){return e?t.filter(r=>Ep.has(r)||e==="array"&&r==="array"):[]}function Sv(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,R._)`typeof ${n}`),a=o.let("coerced",(0,R._)`undefined`);s.coerceTypes==="array"&&o.if((0,R._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,R._)`${n}[0]`).assign(i,(0,R._)`typeof ${n}`).if(bi(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,R._)`${a} !== undefined`);for(let u of r)(Ep.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),$i(t),o.endIf(),o.if((0,R._)`${a} !== undefined`,()=>{o.assign(n,a),Pv(t,a)});function c(u){switch(u){case"string":o.elseIf((0,R._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,R._)`"" + ${n}`).elseIf((0,R._)`${n} === null`).assign(a,(0,R._)`""`);return;case"number":o.elseIf((0,R._)`${i} == "boolean" || ${n} === null
|
|
4
|
-
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,
|
|
5
|
-
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,
|
|
6
|
-
|| ${i} === "boolean" || ${n} === null`).assign(a,(0,R._)`[${n}]`)}}}function Pv({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,R._)`${e} !== undefined`,()=>t.assign((0,R._)`${e}[${r}]`,o))}function vi(t,e,r,o=Ht.Correct){let n=o===Ht.Correct?R.operators.EQ:R.operators.NEQ,s;switch(t){case"null":return(0,R._)`${e} ${n} null`;case"array":s=(0,R._)`Array.isArray(${e})`;break;case"object":s=(0,R._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,R._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,R._)`typeof ${e} ${n} ${t}`}return o===Ht.Correct?s:(0,R.not)(s);function i(a=R.nil){return(0,R.and)((0,R._)`typeof ${e} == "number"`,a,r?(0,R._)`isFinite(${e})`:R.nil)}}me.checkDataType=vi;function bi(t,e,r,o){if(t.length===1)return vi(t[0],e,r,o);let n,s=(0,Sp.toHash)(t);if(s.array&&s.object){let i=(0,R._)`typeof ${e} != "object"`;n=s.null?i:(0,R._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=R.nil;s.number&&delete s.integer;for(let i in s)n=(0,R.and)(n,vi(i,e,r,o));return n}me.checkDataTypes=bi;var Ev={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,R._)`{type: ${t}}`:(0,R._)`{type: ${e}}`};function $i(t){let e=Tv(t);(0,zv.reportError)(e,Ev)}me.reportTypeError=$i;function Tv(t){let{gen:e,data:r,schema:o}=t,n=(0,Sp.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Op=b(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.assignDefaults=void 0;var Kt=I(),Ov=D();function Rv(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Tp(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Tp(t,s,n.default))}rn.assignDefaults=Rv;function Tp(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Kt._)`${s}${(0,Kt.getProperty)(e)}`;if(n){(0,Ov.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Kt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Kt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Kt._)`${a} = ${(0,Kt.stringify)(r)}`)}});var Ne=b(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 W=I(),zi=D(),pt=tt(),Iv=D();function Nv(t,e){let{gen:r,data:o,it:n}=t;r.if(xi(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,W._)`${e}`},!0),t.error()})}V.checkReportMissingProp=Nv;function jv({gen:t,data:e,it:{opts:r}},o,n){return(0,W.or)(...o.map(s=>(0,W.and)(xi(t,e,s,r.ownProperties),(0,W._)`${n} = ${s}`)))}V.checkMissingProp=jv;function Zv(t,e){t.setParams({missingProperty:e},!0),t.error()}V.reportMissingProp=Zv;function Rp(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=Rp;function wi(t,e,r){return(0,W._)`${Rp(t)}.call(${e}, ${r})`}V.isOwnProperty=wi;function Av(t,e,r,o){let n=(0,W._)`${e}${(0,W.getProperty)(r)} !== undefined`;return o?(0,W._)`${n} && ${wi(t,e,r)}`:n}V.propertyInData=Av;function xi(t,e,r,o){let n=(0,W._)`${e}${(0,W.getProperty)(r)} === undefined`;return o?(0,W.or)(n,(0,W.not)(wi(t,e,r))):n}V.noPropertyInData=xi;function Ip(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}V.allSchemaProperties=Ip;function Cv(t,e){return Ip(e).filter(r=>!(0,zi.alwaysValidSchema)(t,e[r]))}V.schemaProperties=Cv;function qv({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,W._)`${t}, ${e}, ${o}${n}`:e,d=[[pt.default.instancePath,(0,W.strConcat)(pt.default.instancePath,s)],[pt.default.parentData,i.parentData],[pt.default.parentDataProperty,i.parentDataProperty],[pt.default.rootData,pt.default.rootData]];i.opts.dynamicRef&&d.push([pt.default.dynamicAnchors,pt.default.dynamicAnchors]);let p=(0,W._)`${l}, ${r.object(...d)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${p})`:(0,W._)`${a}(${p})`}V.callValidateCode=qv;var Dv=(0,W._)`new RegExp`;function Mv({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,W._)`${n.code==="new RegExp"?Dv:(0,Iv.useFunc)(t,n)}(${r}, ${o})`})}V.usePattern=Mv;function Lv(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,W._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:zi.Type.Num},s),e.if((0,W.not)(s),a)})}}V.validateArray=Lv;function Uv(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,zi.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,W._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,W.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}V.validateUnion=Uv});var Zp=b(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.validateKeywordUsage=Fe.validSchemaType=Fe.funcKeywordCode=Fe.macroKeywordCode=void 0;var ye=I(),kt=tt(),Fv=Ne(),Vv=Fr();function Jv(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=jp(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ye.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Fe.macroKeywordCode=Jv;function Hv(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;Bv(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=jp(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)_(),e.modifying&&Np(t),y(()=>t.error());else{let v=e.async?f():m();e.modifying&&Np(t),y(()=>Kv(t,v))}}function f(){let v=o.let("ruleErrs",null);return o.try(()=>_((0,ye._)`await `),P=>o.assign(d,!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=e.async?(0,ye._)`await `:ye.nil){let P=c.opts.passContext?kt.default.this:kt.default.self,w=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,ye._)`${v}${(0,Fv.callValidateCode)(t,l,P,w)}`,e.modifying)}function y(v){var P;o.if((0,ye.not)((P=e.valid)!==null&&P!==void 0?P:d),v)}}Fe.funcKeywordCode=Hv;function Np(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ye._)`${o.parentData}[${o.parentDataProperty}]`))}function Kv(t,e){let{gen:r}=t;r.if((0,ye._)`Array.isArray(${e})`,()=>{r.assign(kt.default.vErrors,(0,ye._)`${kt.default.vErrors} === null ? ${e} : ${kt.default.vErrors}.concat(${e})`).assign(kt.default.errors,(0,ye._)`${kt.default.vErrors}.length`),(0,Vv.extendErrors)(t)},()=>t.error())}function Bv({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function jp(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,ye.stringify)(r)})}function Gv(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")}Fe.validSchemaType=Gv;function Wv({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)}}Fe.validateKeywordUsage=Wv});var Cp=b(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.extendSubschemaMode=ft.extendSubschemaData=ft.getSubschema=void 0;var Ve=I(),Ap=D();function Yv(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,Ve._)`${t.schemaPath}${(0,Ve.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ve._)`${t.schemaPath}${(0,Ve.getProperty)(e)}${(0,Ve.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Ap.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')}ft.getSubschema=Yv;function Qv(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:d}=e,p=a.let("data",(0,Ve._)`${e.data}${(0,Ve.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Ve.str)`${u}${(0,Ap.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ve._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Ve.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]}}ft.extendSubschemaData=Qv;function Xv(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}ft.extendSubschemaMode=Xv});var ki=b((nO,qp)=>{"use strict";qp.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 Mp=b((sO,Dp)=>{"use strict";var mt=Dp.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(){};on(e,o,n,t,"",t)};mt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};mt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};mt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};mt.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 on(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 d=o[l];if(Array.isArray(d)){if(l in mt.arrayKeywords)for(var p=0;p<d.length;p++)on(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in mt.propsKeywords){if(d&&typeof d=="object")for(var f in d)on(t,e,r,d[f],n+"/"+l+"/"+eb(f),s,n,l,o,f)}else(l in mt.keywords||t.allKeys&&!(l in mt.skipKeywords))&&on(t,e,r,d,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 Jr=b(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.getSchemaRefs=ze.resolveUrl=ze.normalizeId=ze._getFullPath=ze.getFullPath=ze.inlineRef=void 0;var tb=D(),rb=ki(),ob=Mp(),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?!Si(t):e?Lp(t)<=e:!1}ze.inlineRef=sb;var ib=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Si(t){for(let e in t){if(ib.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Si)||typeof r=="object"&&Si(r))return!0}return!1}function Lp(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+=Lp(o)),e===1/0))return 1/0}return e}function Up(t,e="",r){r!==!1&&(e=Bt(e));let o=t.parse(e);return Fp(t,o)}ze.getFullPath=Up;function Fp(t,e){return t.serialize(e).split("#")[0]+"#"}ze._getFullPath=Fp;var ab=/#\/?$/;function Bt(t){return t?t.replace(ab,""):""}ze.normalizeId=Bt;function cb(t,e,r){return r=Bt(r),t.resolve(e,r)}ze.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=Bt(t[r]||e),s={"":n},i=Up(o,n,!1),a={},c=new Set;return ob(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let _=i+p,y=s[m];typeof d[r]=="string"&&(y=v.call(this,d[r])),P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),s[p]=y;function v(w){let S=this.opts.uriResolver.resolve;if(w=Bt(y?S(y,w):w),c.has(w))throw l(w);c.add(w);let z=this.refs[w];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?u(d,z.schema,w):w!==Bt(_)&&(w[0]==="#"?(u(d,a[w],w),a[w]=d):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(d,p,f){if(p!==void 0&&!rb(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ze.getSchemaRefs=lb});var Br=b(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.getData=ht.KeywordCxt=ht.validateFunctionCode=void 0;var Bp=wp(),Vp=Vr(),Ei=yi(),nn=Vr(),db=Op(),Kr=Zp(),Pi=Cp(),k=I(),T=tt(),pb=Jr(),rt=D(),Hr=Fr();function fb(t){if(Yp(t)&&(Qp(t),Wp(t))){gb(t);return}Gp(t,()=>(0,Bp.topBoolOrEmptySchema)(t))}ht.validateFunctionCode=fb;function Gp({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"; ${Jp(r,n)}`),hb(t,n),t.code(s)}):t.func(e,(0,k._)`${T.default.data}, ${mb(n)}`,o.$async,()=>t.code(Jp(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;Gp(t,()=>{r.$comment&&e.$comment&&ef(t),$b(t),o.let(T.default.vErrors,null),o.let(T.default.errors,0),r.unevaluated&&_b(t),Xp(t),xb(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 Jp(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(Yp(t)&&(Qp(t),Wp(t))){vb(t,e);return}(0,Bp.boolOrEmptySchema)(t,e)}function Wp({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 Yp(t){return typeof t.schema!="boolean"}function vb(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&ef(t),zb(t),wb(t);let s=o.const("_errs",T.default.errors);Xp(t,s),o.var(e,(0,k._)`${s} === ${T.default.errors}`)}function Qp(t){(0,rt.checkUnknownRules)(t),bb(t)}function Xp(t,e){if(t.opts.jtd)return Hp(t,[],!1,e);let r=(0,Vp.getSchemaTypes)(t.schema),o=(0,Vp.coerceAndCheckDataType)(t,r);Hp(t,r,!o,e)}function bb(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,rt.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function $b(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,rt.checkStrictMode)(t,"default is ignored in the schema root")}function zb(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,pb.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function wb(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ef({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 xb(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&&kb(t),e.return((0,k._)`${T.default.errors} === 0`))}function kb({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 Hp(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,rt.schemaHasRulesButRef)(s,l))){n.block(()=>rf(t,"$ref",l.all.$ref.definition));return}c.jtd||Sb(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Ei.shouldUseGroup)(s,p)&&(p.type?(n.if((0,nn.checkDataType)(p.type,i,c.strictNumbers)),Kp(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,nn.reportTypeError)(t)),n.endIf()):Kp(t,p),a||n.if((0,k._)`${T.default.errors} === ${o||0}`))}}function Kp(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,db.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ei.shouldUseRule)(o,s)&&rf(t,s.keyword,s.definition,e.type)})}function Sb(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=>{tf(t.dataTypes,r)||Ti(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Rb(t,e)}}function Eb(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ti(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,Ei.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Ob(e,i))&&Ti(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Ob(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function tf(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Rb(t,e){let r=[];for(let o of t.dataTypes)tf(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Ti(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,rt.checkStrictMode)(t,e,t.opts.strictTypes)}var sn=class{constructor(e,r,o){if((0,Kr.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,rt.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",of(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Kr.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?Hr.reportExtraError:Hr.reportError)(this,this.def.error,r)}$dataError(){(0,Hr.reportError)(this,this.def.$dataError||Hr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Hr.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,nn.checkDataTypes)(c,r,s.opts.strictNumbers,nn.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,Pi.getSubschema)(this.it,e);(0,Pi.extendSubschemaData)(o,this.it,e),(0,Pi.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=rt.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=rt.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}};ht.KeywordCxt=sn;function rf(t,e,r,o){let n=new sn(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Kr.funcKeywordCode)(n,r):"macro"in r?(0,Kr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Kr.funcKeywordCode)(n,r)}var Ib=/^\/(?:[^~]|~0|~1)*$/,Nb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function of(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return T.default.rootData;if(t[0]==="/"){if(!Ib.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,rt.unescapeJsonPointer)(u))}`,i=(0,k._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}ht.getData=of});var an=b(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var Oi=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Ri.default=Oi});var Gr=b(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});var Ii=Jr(),Ni=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Ii.resolveUrl)(e,r,o),this.missingSchema=(0,Ii.normalizeId)((0,Ii.getFullPath)(e,this.missingRef))}};ji.default=Ni});var un=b(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.resolveSchema=je.getCompilingSchema=je.resolveRef=je.compileSchema=je.SchemaEnv=void 0;var qe=I(),jb=an(),St=tt(),De=Jr(),nf=D(),Zb=Br(),Gt=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,De.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};je.SchemaEnv=Gt;function Ai(t){let e=sf.call(this,t);if(e)return e;let r=(0,De.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new qe.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:jb.default,code:(0,qe._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:St.default.data,parentData:St.default.parentData,parentDataProperty:St.default.parentDataProperty,dataNames:[St.default.data],dataPathArr:[qe.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,qe.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:qe.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,qe._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Zb.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(St.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${St.default.self}`,`${St.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:d,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:_}=u;f.evaluated={props:m instanceof qe.Name?void 0:m,items:_ instanceof qe.Name?void 0:_,dynamicProps:m instanceof qe.Name,dynamicItems:_ instanceof qe.Name},f.source&&(f.source.evaluated=(0,qe.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}je.compileSchema=Ai;function Ab(t,e,r){var o;r=(0,De.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 Gt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=Cb.call(this,s)}je.resolveRef=Ab;function Cb(t){return(0,De.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Ai.call(this,t)}function sf(t){for(let e of this._compilations)if(qb(e,t))return e}je.getCompilingSchema=sf;function qb(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]||cn.call(this,t,e)}function cn(t,e){let r=this.opts.uriResolver.parse(e),o=(0,De._getFullPath)(this.opts.uriResolver,r),n=(0,De.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return Zi.call(this,r,t);let s=(0,De.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=cn.call(this,t,i);return typeof a?.schema!="object"?void 0:Zi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Ai.call(this,i),s===(0,De.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,De.resolveUrl)(this.opts.uriResolver,n,u)),new Gt({schema:a,schemaId:c,root:t,baseId:n})}return Zi.call(this,r,i)}}je.resolveSchema=cn;var Mb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zi(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,nf.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Mb.has(a)&&u&&(e=(0,De.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,nf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,De.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=cn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Gt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var af=b((dO,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 Di=b((pO,ff)=>{"use strict";var Ub=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),uf=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),Ci=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),lf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Fb=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function qi(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 cf(t){return t.length=0,!0}function Jb(t,e,r){if(t.length){let o=qi(t);if(o!=="")e.push(o);else return r.error=!0,!1;t.length=0}return!0}function Hb(t){let e=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Jb;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=cf}else{n.push(u);continue}}return n.length&&(a===cf?r.zone=n.join(""):i?o.push(n.join("")):o.push(qi(n))),r.address=o.join(""),r}function df(t){if(Kb(t,":")<2)return{host:t,isIPV6:!1};let e=Hb(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 Bb(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 Gb={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Wb=/[@/?#:]/g,Yb=/[@/?#]/g;function pf(t,e){let r=e?Yb:Wb;return r.lastIndex=0,t.replace(r,o=>Gb[o])}function Qb(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(Ci(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&lf(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(Ci(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&lf(s)?e+=s:e+="%"+n,r+=2;continue}}Fb(t[r])?e+=t[r]:e+=escape(t[r])}return e}function e$(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(Ci(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function t$(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!uf(r)){let o=df(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=pf(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}ff.exports={nonSimpleDomain:Vb,recomposeAuthority:t$,reescapeHostDelimiters:pf,normalizePercentEncoding:Qb,normalizePathEncoding:Xb,escapePreservingEscapes:e$,removeDotSegments:Bb,isIPv4:uf,isUUID:Ub,normalizeIPv6:df,stringArrayToHexStripped:qi}});var yf=b((fO,_f)=>{"use strict";var{isUUID:r$}=Di(),o$=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n$=["http","https","ws","wss","urn","urn:uuid"];function s$(t){return n$.indexOf(t)!==-1}function Mi(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 mf(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function hf(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 i$(t){return t.secure=Mi(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function a$(t){if((t.port===(Mi(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 c$(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(o$);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=Li(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function u$(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=Li(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 l$(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!r$(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function d$(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var gf={scheme:"http",domainHost:!0,parse:mf,serialize:hf},p$={scheme:"https",domainHost:gf.domainHost,parse:mf,serialize:hf},ln={scheme:"ws",domainHost:!0,parse:i$,serialize:a$},f$={scheme:"wss",domainHost:ln.domainHost,parse:ln.parse,serialize:ln.serialize},m$={scheme:"urn",parse:c$,serialize:u$,skipNormalize:!0},h$={scheme:"urn:uuid",parse:l$,serialize:d$,skipNormalize:!0},dn={http:gf,https:p$,ws:ln,wss:f$,urn:m$,"urn:uuid":h$};Object.setPrototypeOf(dn,null);function Li(t){return t&&(dn[t]||dn[t.toLowerCase()])||void 0}_f.exports={wsIsSecure:Mi,SCHEMES:dn,isValidSchemeName:s$,getSchemeHandler:Li}});var xf=b((mO,pn)=>{"use strict";var{normalizeIPv6:g$,removeDotSegments:Wr,recomposeAuthority:_$,normalizePercentEncoding:y$,normalizePathEncoding:v$,escapePreservingEscapes:b$,reescapeHostDelimiters:$$,isIPv4:z$,nonSimpleDomain:w$}=Di(),{SCHEMES:x$,getSchemeHandler:bf}=yf();function k$(t,e){return typeof t=="string"?t=O$(t,e):typeof t=="object"&&(t=Wt(Pt(t,e),e)),t}function S$(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=$f(Wt(t,o),Wt(e,o),o,!0);return o.skipEscape=!0,Pt(n,o)}function $f(t,e,r,o){let n={};return o||(t=Wt(Pt(t,r),r),e=Wt(Pt(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=Wr(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=Wr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Wr(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=Wr(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 P$(t,e,r){let o=vf(t,r),n=vf(e,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Pt(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=bf(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=y$(r.path):(r.path=b$(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=_$(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=Wr(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 E$=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function T$(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 zf(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(E$);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=T$(o,i);if(a!==void 0&&(o.error=o.error||a,n=!0),o.host)if(z$(o.host)===!1){let l=g$(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&&w$(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}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=$$(unescape(o.host),s))),o.path&&(o.path=v$(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 Wt(t,e){return zf(t,e).parsed}function O$(t,e){return wf(t,e).normalized}function wf(t,e){let{parsed:r,malformedAuthorityOrPort:o}=zf(t,e);return{normalized:o?t:Pt(r,e),malformedAuthorityOrPort:o}}function vf(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:o}=wf(t,e);return o?void 0:r}if(typeof t=="object")return Pt(t,e)}var Ui={SCHEMES:x$,normalize:k$,resolve:S$,resolveComponent:$f,equal:P$,serialize:Pt,parse:Wt};pn.exports=Ui;pn.exports.default=Ui;pn.exports.fastUri=Ui});var Sf=b(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});var kf=xf();kf.code='require("ajv/dist/runtime/uri").default';Fi.default=kf});var jf=b(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 R$=Br();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return R$.KeywordCxt}});var Yt=I();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Yt._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Yt.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Yt.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Yt.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Yt.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return Yt.CodeGen}});var I$=an(),Rf=Gr(),N$=_i(),Yr=un(),j$=I(),Qr=Jr(),fn=Vr(),Ji=D(),Pf=af(),Z$=Sf(),If=(t,e)=>new RegExp(t,e);If.code="new RegExp";var A$=["removeAdditional","useDefaults","coerceTypes"],C$=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),q$={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."},D$={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Ef=200;function M$(t){var e,r,o,n,s,i,a,c,u,l,d,p,f,m,_,y,v,P,w,S,z,xe,Ee,ir,jn;let ar=t.strict,Zn=(e=t.code)===null||e===void 0?void 0:e.optimize,Fa=Zn===!0||Zn===void 0?1:Zn||0,Va=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:If,sh=(n=t.uriResolver)!==null&&n!==void 0?n:Z$.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:ar)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:ar)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:ar)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:ar)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:ar)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Fa,regExp:Va}:{optimize:Fa,regExp:Va},loopRequired:(_=t.loopRequired)!==null&&_!==void 0?_:Ef,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Ef,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:(z=t.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(xe=t.validateSchema)!==null&&xe!==void 0?xe:!0,validateFormats:(Ee=t.validateFormats)!==null&&Ee!==void 0?Ee:!0,unicodeRegExp:(ir=t.unicodeRegExp)!==null&&ir!==void 0?ir:!0,int32range:(jn=t.int32range)!==null&&jn!==void 0?jn:!0,uriResolver:sh}}var Xr=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,...M$(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new j$.ValueScope({scope:{},prefixes:C$,es5:r,lines:o}),this.logger=H$(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,N$.getRules)(),Tf.call(this,q$,e,"NOT SUPPORTED"),Tf.call(this,D$,e,"DEPRECATED","warn"),this._metaOpts=V$.call(this),e.formats&&U$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&F$.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),L$.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=Pf;o==="id"&&(n={...Pf},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,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Rf.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(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,Qr.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=Of.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new Yr.SchemaEnv({schema:{},schemaId:o});if(r=Yr.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=Of.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,Qr.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(B$.call(this,o,r),!r)return(0,Ji.eachItem)(o,s=>Vi.call(this,s)),this;W$.call(this,r);let n={...r,type:(0,fn.getJSONTypes)(r.type),schemaType:(0,fn.getJSONTypes)(r.schemaType)};return(0,Ji.eachItem)(o,n.type.length===0?s=>Vi.call(this,s,n):s=>n.type.forEach(i=>Vi.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]=Nf(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,Qr.normalizeId)(i||o);let u=Qr.getSchemaRefs.call(this,e,o);return c=new Yr.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):Yr.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{Yr.compileSchema.call(this,e)}finally{this.opts=r}}};Xr.ValidationError=I$.default;Xr.MissingRefError=Rf.default;le.default=Xr;function Tf(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 Of(t){return t=(0,Qr.normalizeId)(t),this.schemas[t]||this.refs[t]}function L$(){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 U$(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function F$(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 V$(){let t={...this.opts};for(let e of A$)delete t[e];return t}var J$={log(){},warn(){},error(){}};function H$(t){if(t===!1)return J$;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 K$=/^[a-z_$][a-z0-9_$:-]*$/i;function B$(t,e){let{RULES:r}=this;if((0,Ji.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!K$.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 Vi(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,fn.getJSONTypes)(e.type),schemaType:(0,fn.getJSONTypes)(e.schemaType)}};e.before?G$.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 G$(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 W$(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Nf(e)),t.validateSchema=this.compile(e,!0))}var Y$={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Nf(t){return{anyOf:[t,Y$]}}});var Zf=b(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Q$={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Hi.default=Q$});var Df=b(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.callRef=Et.getValidate=void 0;var X$=Gr(),Af=Ne(),we=I(),Qt=tt(),Cf=un(),mn=D(),e0={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 d();let l=Cf.resolveRef.call(c,u,n,r);if(l===void 0)throw new X$.default(o.opts.uriResolver,n,r);if(l instanceof Cf.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return hn(t,i,s,s.$async);let m=e.scopeValue("root",{ref:u});return hn(t,(0,we._)`${m}.validate`,u,u.$async)}function p(m){let _=qf(t,m);hn(t,_,m,m.$async)}function f(m){let _=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,we.stringify)(m)}:{ref:m}),y=e.name("valid"),v=t.subschema({schema:m,dataTypes:[],schemaPath:we.nil,topSchemaRef:_,errSchemaPath:r},y);t.mergeEvaluated(v),t.ok(y)}}};function qf(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,we._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Et.getValidate=qf;function hn(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Qt.default.this:we.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,we._)`await ${(0,Af.callValidateCode)(t,e,u)}`),f(e),i||n.assign(m,!0)},_=>{n.if((0,we._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),p(_),i||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,Af.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(m){let _=(0,we._)`${m}.errors`;n.assign(Qt.default.vErrors,(0,we._)`${Qt.default.vErrors} === null ? ${_} : ${Qt.default.vErrors}.concat(${_})`),n.assign(Qt.default.errors,(0,we._)`${Qt.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=mn.mergeEvaluated.props(n,y.props,s.props));else{let v=n.var("props",(0,we._)`${m}.evaluated.props`);s.props=mn.mergeEvaluated.props(n,v,s.props,we.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=mn.mergeEvaluated.items(n,y.items,s.items));else{let v=n.var("items",(0,we._)`${m}.evaluated.items`);s.items=mn.mergeEvaluated.items(n,v,s.items,we.Name)}}}Et.callRef=hn;Et.default=e0});var Mf=b(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});var t0=Zf(),r0=Df(),o0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t0.default,r0.default];Ki.default=o0});var Lf=b(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var gn=I(),gt=gn.operators,_n={maximum:{okStr:"<=",ok:gt.LTE,fail:gt.GT},minimum:{okStr:">=",ok:gt.GTE,fail:gt.LT},exclusiveMaximum:{okStr:"<",ok:gt.LT,fail:gt.GTE},exclusiveMinimum:{okStr:">",ok:gt.GT,fail:gt.LTE}},n0={message:({keyword:t,schemaCode:e})=>(0,gn.str)`must be ${_n[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gn._)`{comparison: ${_n[t].okStr}, limit: ${e}}`},s0={keyword:Object.keys(_n),type:"number",schemaType:"number",$data:!0,error:n0,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,gn._)`${r} ${_n[e].fail} ${o} || isNaN(${r})`)}};Bi.default=s0});var Uf=b(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});var eo=I(),i0={message:({schemaCode:t})=>(0,eo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,eo._)`{multipleOf: ${t}}`},a0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:i0,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,eo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,eo._)`${i} !== parseInt(${i})`;t.fail$data((0,eo._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Gi.default=a0});var Vf=b(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});function Ff(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}Wi.default=Ff;Ff.code='require("ajv/dist/runtime/ucs2length").default'});var Jf=b(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Tt=I(),c0=D(),u0=Vf(),l0={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Tt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Tt._)`{limit: ${t}}`},d0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:l0,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?Tt.operators.GT:Tt.operators.LT,i=n.opts.unicode===!1?(0,Tt._)`${r}.length`:(0,Tt._)`${(0,c0.useFunc)(t.gen,u0.default)}(${r})`;t.fail$data((0,Tt._)`${i} ${s} ${o}`)}};Yi.default=d0});var Hf=b(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var p0=Ne(),f0=D(),Xt=I(),m0={message:({schemaCode:t})=>(0,Xt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Xt._)`{pattern: ${t}}`},h0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:m0,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,Xt._)`new RegExp`:(0,f0.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Xt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Xt._)`!${l}`)}else{let c=(0,p0.usePattern)(t,n);t.fail$data((0,Xt._)`!${c}.test(${r})`)}}};Qi.default=h0});var Kf=b(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var to=I(),g0={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,to.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,to._)`{limit: ${t}}`},_0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:g0,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?to.operators.GT:to.operators.LT;t.fail$data((0,to._)`Object.keys(${r}).length ${n} ${o}`)}};Xi.default=_0});var Bf=b(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var ro=Ne(),oo=I(),y0=D(),v0={message:({params:{missingProperty:t}})=>(0,oo.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,oo._)`{missingProperty: ${t}}`},b0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:v0,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,y0.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(oo.nil,d);else for(let f of r)(0,ro.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,ro.checkMissingProp)(t,r,f)),(0,ro.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",o,f=>{t.setParams({missingProperty:f}),e.if((0,ro.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,o,()=>{e.assign(m,(0,ro.propertyInData)(e,n,f,a.ownProperties)),e.if((0,oo.not)(m),()=>{t.error(),e.break()})},oo.nil)}}};ea.default=b0});var Gf=b(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});var no=I(),$0={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,no.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,no._)`{limit: ${t}}`},z0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:$0,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?no.operators.GT:no.operators.LT;t.fail$data((0,no._)`${r}.length ${n} ${o}`)}};ta.default=z0});var yn=b(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var Wf=ki();Wf.code='require("ajv/dist/runtime/equal").default';ra.default=Wf});var Yf=b(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var oa=Vr(),de=I(),w0=D(),x0=yn(),k0={message:({params:{i:t,j:e}})=>(0,de.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,de._)`{i: ${t}, j: ${e}}`},S0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:k0,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,oa.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,de._)`${i} === false`),t.ok(c);function l(){let m=e.let("i",(0,de._)`${r}.length`),_=e.let("j");t.setParams({i:m,j:_}),e.assign(c,!0),e.if((0,de._)`${m} > 1`,()=>(d()?p:f)(m,_))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,_){let y=e.name("item"),v=(0,oa.checkDataTypes)(u,y,a.opts.strictNumbers,oa.DataType.Wrong),P=e.const("indices",(0,de._)`{}`);e.for((0,de._)`;${m}--;`,()=>{e.let(y,(0,de._)`${r}[${m}]`),e.if(v,(0,de._)`continue`),u.length>1&&e.if((0,de._)`typeof ${y} == "string"`,(0,de._)`${y} += "_"`),e.if((0,de._)`typeof ${P}[${y}] == "number"`,()=>{e.assign(_,(0,de._)`${P}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,de._)`${P}[${y}] = ${m}`)})}function f(m,_){let y=(0,w0.useFunc)(e,x0.default),v=e.name("outer");e.label(v).for((0,de._)`;${m}--;`,()=>e.for((0,de._)`${_} = ${m}; ${_}--;`,()=>e.if((0,de._)`${y}(${r}[${m}], ${r}[${_}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};na.default=S0});var Qf=b(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var sa=I(),P0=D(),E0=yn(),T0={message:"must be equal to constant",params:({schemaCode:t})=>(0,sa._)`{allowedValue: ${t}}`},O0={keyword:"const",$data:!0,error:T0,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,sa._)`!${(0,P0.useFunc)(e,E0.default)}(${r}, ${n})`):t.fail((0,sa._)`${s} !== ${r}`)}};ia.default=O0});var Xf=b(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var so=I(),R0=D(),I0=yn(),N0={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,so._)`{allowedValues: ${t}}`},j0={keyword:"enum",schemaType:"array",$data:!0,error:N0,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,R0.useFunc)(e,I0.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,so.or)(...n.map((m,_)=>p(f,_)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,so._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,m){let _=n[m];return typeof _=="object"&&_!==null?(0,so._)`${u()}(${r}, ${f}[${m}])`:(0,so._)`${r} === ${_}`}}};aa.default=j0});var em=b(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var Z0=Lf(),A0=Uf(),C0=Jf(),q0=Hf(),D0=Kf(),M0=Bf(),L0=Gf(),U0=Yf(),F0=Qf(),V0=Xf(),J0=[Z0.default,A0.default,C0.default,q0.default,D0.default,M0.default,L0.default,U0.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},F0.default,V0.default];ca.default=J0});var la=b(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.validateAdditionalItems=void 0;var Ot=I(),ua=D(),H0={message:({params:{len:t}})=>(0,Ot.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Ot._)`{limit: ${t}}`},K0={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:H0,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,ua.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}tm(t,o)}};function tm(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Ot._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,Ot._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,ua.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,Ot._)`${a} <= ${e.length}`);r.if((0,Ot.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:ua.Type.Num},u),i.allErrors||r.if((0,Ot.not)(u),()=>r.break())})}}io.validateAdditionalItems=tm;io.default=K0});var da=b(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.validateTuple=void 0;var rm=I(),vn=D(),B0=Ne(),G0={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return om(t,"additionalItems",e);r.items=!0,!(0,vn.alwaysValidSchema)(r,e)&&t.ok((0,B0.validateArray)(t))}};function om(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=vn.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,rm._)`${s}.length`);r.forEach((d,p)=>{(0,vn.alwaysValidSchema)(a,d)||(o.if((0,rm._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,m=r.length,_=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!_){let y=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,vn.checkStrictMode)(a,y,p.strictTuples)}}}ao.validateTuple=om;ao.default=G0});var nm=b(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var W0=da(),Y0={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,W0.validateTuple)(t,"items")};pa.default=Y0});var im=b(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var sm=I(),Q0=D(),X0=Ne(),ez=la(),tz={message:({params:{len:t}})=>(0,sm.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sm._)`{limit: ${t}}`},rz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:tz,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,Q0.alwaysValidSchema)(o,e)&&(n?(0,ez.validateAdditionalItems)(t,n):t.ok((0,X0.validateArray)(t)))}};fa.default=rz});var am=b(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var Ze=I(),bn=D(),oz={message:({params:{min:t,max:e}})=>e===void 0?(0,Ze.str)`must contain at least ${t} valid item(s)`:(0,Ze.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Ze._)`{minContains: ${t}}`:(0,Ze._)`{minContains: ${t}, maxContains: ${e}}`},nz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:oz,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,Ze._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,bn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,bn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,bn.alwaysValidSchema)(s,r)){let _=(0,Ze._)`${l} >= ${i}`;a!==void 0&&(_=(0,Ze._)`${_} && ${l} <= ${a}`),t.pass(_);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,Ze._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){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:bn.Type.Num,compositeRule:!0},_),y()})}function m(_){e.code((0,Ze._)`${_}++`),a===void 0?e.if((0,Ze._)`${_} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,Ze._)`${_} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,Ze._)`${_} >= ${i}`,()=>e.assign(d,!0)))}}};ma.default=nz});var lm=b(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.validateSchemaDeps=Je.validatePropertyDeps=Je.error=void 0;var ha=I(),sz=D(),co=Ne();Je.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,ha.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,ha._)`{property: ${t},
|
|
2
|
+
var ih=Object.create;var Cn=Object.defineProperty;var ah=Object.getOwnPropertyDescriptor;var ch=Object.getOwnPropertyNames;var uh=Object.getPrototypeOf,lh=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ba=(t,e)=>{for(var r in e)Cn(t,r,{get:e[r],enumerable:!0})},dh=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ch(e))!lh.call(t,n)&&n!==r&&Cn(t,n,{get:()=>e[n],enumerable:!(o=ah(e,n))||o.enumerable});return t};var Ja=(t,e,r)=>(r=t!=null?ih(uh(t)):{},dh(e||!t||!t.__esModule?Cn(r,"default",{value:t,enumerable:!0}):r,t));var jr=v(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 Zr=class{};L._CodeOrName=Zr;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var vt=class extends Zr{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=vt;var Ie=class extends Zr{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 vt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};L._Code=Ie;L.nil=new Ie("");function cp(t,...e){let r=[t[0]],o=0;for(;o<e.length;)Qs(r,e[o]),r.push(t[++o]);return new Ie(r)}L._=cp;var Ks=new Ie("+");function up(t,...e){let r=[Cr(t[0])],o=0;for(;o<e.length;)r.push(Ks),Qs(r,e[o]),r.push(Ks,Cr(t[++o]));return Ry(r),new Ie(r)}L.str=up;function Qs(t,e){e instanceof Ie?t.push(...e._items):e instanceof vt?t.push(e):t.push(Ny(e))}L.addCodeArg=Qs;function Ry(t){let e=1;for(;e<t.length-1;){if(t[e]===Ks){let r=Oy(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Oy(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof vt||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 vt))return`"${t}${e.slice(1)}`}function Iy(t,e){return e.emptyStr()?t:t.emptyStr()?e:up`${t}${e}`}L.strConcat=Iy;function Ny(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Cr(Array.isArray(t)?t.join(","):t)}function Ay(t){return new Ie(Cr(t))}L.stringify=Ay;function Cr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Cr;function Zy(t){return typeof t=="string"&&L.IDENTIFIER.test(t)?new Ie(`.${t}`):cp`[${t}]`}L.getProperty=Zy;function Cy(t){if(typeof t=="string"&&L.IDENTIFIER.test(t))return new Ie(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}L.getEsmExportName=Cy;function jy(t){return new Ie(t.toString())}L.regexpCode=jy});var ei=v($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.ValueScope=$e.ValueScopeName=$e.Scope=$e.varKinds=$e.UsedValueState=void 0;var ve=jr(),Ys=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Wo;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Wo||($e.UsedValueState=Wo={}));$e.varKinds={const:new ve.Name("const"),let:new ve.Name("let"),var:new ve.Name("var")};var Go=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ve.Name?e:this.name(e)}name(e){return new ve.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}}};$e.Scope=Go;var Ko=class extends ve.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ve._)`.${new ve.Name(r)}[${o}]`}};$e.ValueScopeName=Ko;var Dy=(0,ve._)`\n`,Xs=class extends Go{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Dy:ve.nil}}get(){return this._scope}name(e){return new Ko(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,ve._)`${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=ve.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,Wo.Started);let l=r(u);if(l){let d=this.opts.es5?$e.varKinds.var:$e.varKinds.const;s=(0,ve._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ve._)`${s}${l}${this.opts._n}`;else throw new Ys(u);c.set(u,Wo.Completed)})}return s}};$e.ValueScope=Xs});var I=v(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 j=jr(),je=ei(),lt=jr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return lt._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return lt.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return lt.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return lt.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return lt.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return lt.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return lt.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return lt.Name}});var en=ei();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return en.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return en.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return en.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return en.varKinds}});N.operators={GT:new j._Code(">"),GTE:new j._Code(">="),LT:new j._Code("<"),LTE:new j._Code("<="),EQ:new j._Code("==="),NEQ:new j._Code("!=="),NOT:new j._Code("!"),OR:new j._Code("||"),AND:new j._Code("&&"),ADD:new j._Code("+")};var Xe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ti=class extends Xe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?je.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=Ft(this.rhs,e,r)),this}get names(){return this.rhs instanceof j._CodeOrName?this.rhs.names:{}}},Qo=class extends Xe{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 j.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Ft(this.rhs,e,r),this}get names(){let e=this.lhs instanceof j.Name?{}:{...this.lhs.names};return Xo(e,this.rhs)}},ri=class extends Qo{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},oi=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ni=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},si=class extends Xe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ii=class extends Xe{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=Ft(this.code,e,r),this}get names(){return this.code instanceof j._CodeOrName?this.code.names:{}}},Dr=class extends Xe{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)||(qy(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>xt(e,r.names),{})}},et=class extends Dr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ai=class extends Dr{},Ut=class extends et{};Ut.kind="else";var $t=class t extends et{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 Ut(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(lp(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=Ft(this.condition,e,r),this}get names(){let e=super.names;return Xo(e,this.condition),this.else&&xt(e,this.else.names),e}};$t.kind="if";var wt=class extends et{};wt.kind="for";var ci=class extends wt{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=Ft(this.iteration,e,r),this}get names(){return xt(super.names,this.iteration.names)}},ui=class extends wt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?je.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=Xo(super.names,this.from);return Xo(e,this.to)}},Yo=class extends wt{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=Ft(this.iterable,e,r),this}get names(){return xt(super.names,this.iterable.names)}},qr=class extends et{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)}};qr.kind="func";var Mr=class extends Dr{render(e){return"return "+super.render(e)}};Mr.kind="return";var li=class extends et{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&&xt(e,this.catch.names),this.finally&&xt(e,this.finally.names),e}},Lr=class extends et{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Lr.kind="catch";var Ur=class extends et{render(e){return"finally"+super.render(e)}};Ur.kind="finally";var di=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new je.Scope({parent:e}),this._nodes=[new ai]}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 ti(e,s,o)),s}const(e,r,o){return this._def(je.varKinds.const,e,r,o)}let(e,r,o){return this._def(je.varKinds.let,e,r,o)}var(e,r,o){return this._def(je.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new Qo(e,r,o))}add(e,r){return this._leafNode(new ri(e,N.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==j.nil&&this._leafNode(new ii(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,j.addCodeArg)(r,n));return r.push("}"),new j._Code(r)}if(e,r,o){if(this._blockNode(new $t(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 $t(e))}else(){return this._elseNode(new Ut)}endIf(){return this._endBlockNode($t,Ut)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new ci(e),r)}forRange(e,r,o,n,s=this.opts.es5?je.varKinds.var:je.varKinds.let){let i=this._scope.toName(e);return this._for(new ui(s,i,r,o),()=>n(i))}forOf(e,r,o,n=je.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof j.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,j._)`${i}.length`,a=>{this.var(s,(0,j._)`${i}[${a}]`),o(s)})}return this._for(new Yo("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?je.varKinds.var:je.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,j._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new Yo("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(wt)}label(e){return this._leafNode(new oi(e))}break(e){return this._leafNode(new ni(e))}return(e){let r=new Mr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Mr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new li;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Lr(s),r(s)}return o&&(this._currNode=n.finally=new Ur,this.code(o)),this._endBlockNode(Lr,Ur)}throw(e){return this._leafNode(new si(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=j.nil,o,n){return this._blockNode(new qr(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(qr)}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 $t))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=di;function xt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Xo(t,e){return e instanceof j._CodeOrName?xt(t,e.names):t}function Ft(t,e,r){if(t instanceof j.Name)return o(t);if(!n(t))return t;return new j._Code(t._items.reduce((s,i)=>(i instanceof j.Name&&(i=o(i)),i instanceof j._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 j._Code&&s._items.some(i=>i instanceof j.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function qy(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function lp(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,j._)`!${pi(t)}`}N.not=lp;var My=dp(N.operators.AND);function Ly(...t){return t.reduce(My)}N.and=Ly;var Uy=dp(N.operators.OR);function Fy(...t){return t.reduce(Uy)}N.or=Fy;function dp(t){return(e,r)=>e===j.nil?r:r===j.nil?e:(0,j._)`${pi(e)} ${t} ${pi(r)}`}function pi(t){return t instanceof j.Name?t:(0,j._)`(${t})`}});var q=v(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.checkStrictMode=A.getErrorPath=A.Type=A.useFunc=A.setEvaluated=A.evaluatedPropsToName=A.mergeEvaluated=A.eachItem=A.unescapeJsonPointer=A.escapeJsonPointer=A.escapeFragment=A.unescapeFragment=A.schemaRefOrVal=A.schemaHasRulesButRef=A.schemaHasRules=A.checkUnknownRules=A.alwaysValidSchema=A.toHash=void 0;var B=I(),Vy=jr();function By(t){let e={};for(let r of t)e[r]=!0;return e}A.toHash=By;function Jy(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(mp(t,e),!hp(e,t.self.RULES.all))}A.alwaysValidSchema=Jy;function mp(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]||yp(t,`unknown keyword: "${s}"`)}A.checkUnknownRules=mp;function hp(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}A.schemaHasRules=hp;function Hy(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}A.schemaHasRulesButRef=Hy;function Wy({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,B._)`${r}`}return(0,B._)`${t}${e}${(0,B.getProperty)(o)}`}A.schemaRefOrVal=Wy;function Gy(t){return gp(decodeURIComponent(t))}A.unescapeFragment=Gy;function Ky(t){return encodeURIComponent(mi(t))}A.escapeFragment=Ky;function mi(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}A.escapeJsonPointer=mi;function gp(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}A.unescapeJsonPointer=gp;function Qy(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}A.eachItem=Qy;function pp({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof B.Name?(s instanceof B.Name?t(n,s,i):e(n,s,i),i):s instanceof B.Name?(e(n,i,s),s):r(s,i);return a===B.Name&&!(c instanceof B.Name)?o(n,c):c}}A.mergeEvaluated={props:pp({mergeNames:(t,e,r)=>t.if((0,B._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,B._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,B._)`${r} || {}`).code((0,B._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,B._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,B._)`${r} || {}`),hi(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:_p}),items:pp({mergeNames:(t,e,r)=>t.if((0,B._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,B._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,B._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,B._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function _p(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,B._)`{}`);return e!==void 0&&hi(t,r,e),r}A.evaluatedPropsToName=_p;function hi(t,e,r){Object.keys(r).forEach(o=>t.assign((0,B._)`${e}${(0,B.getProperty)(o)}`,!0))}A.setEvaluated=hi;var fp={};function Yy(t,e){return t.scopeValue("func",{ref:e,code:fp[e.code]||(fp[e.code]=new Vy._Code(e.code))})}A.useFunc=Yy;var fi;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(fi||(A.Type=fi={}));function Xy(t,e,r){if(t instanceof B.Name){let o=e===fi.Num;return r?o?(0,B._)`"[" + ${t} + "]"`:(0,B._)`"['" + ${t} + "']"`:o?(0,B._)`"/" + ${t}`:(0,B._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,B.getProperty)(t).toString():"/"+mi(t)}A.getErrorPath=Xy;function yp(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}A.checkStrictMode=yp});var tt=v(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});var pe=I(),eb={data:new pe.Name("data"),valCxt:new pe.Name("valCxt"),instancePath:new pe.Name("instancePath"),parentData:new pe.Name("parentData"),parentDataProperty:new pe.Name("parentDataProperty"),rootData:new pe.Name("rootData"),dynamicAnchors:new pe.Name("dynamicAnchors"),vErrors:new pe.Name("vErrors"),errors:new pe.Name("errors"),this:new pe.Name("this"),self:new pe.Name("self"),scope:new pe.Name("scope"),json:new pe.Name("json"),jsonPos:new pe.Name("jsonPos"),jsonLen:new pe.Name("jsonLen"),jsonPart:new pe.Name("jsonPart")};gi.default=eb});var Fr=v(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 M=I(),tn=q(),_e=tt();fe.keywordError={message:({keyword:t})=>(0,M.str)`must pass "${t}" keyword validation`};fe.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,M.str)`"${t}" keyword must be ${e} ($data)`:(0,M.str)`"${t}" keyword is invalid ($data)`};function tb(t,e=fe.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=$p(t,e,r);o??(i||a)?bp(s,c):vp(n,(0,M._)`[${c}]`)}fe.reportError=tb;function rb(t,e=fe.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=$p(t,e,r);bp(n,a),s||i||vp(o,_e.default.vErrors)}fe.reportExtraError=rb;function ob(t,e){t.assign(_e.default.errors,e),t.if((0,M._)`${_e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,M._)`${_e.default.vErrors}.length`,e),()=>t.assign(_e.default.vErrors,null)))}fe.resetErrorsCount=ob;function nb({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,_e.default.errors,a=>{t.const(i,(0,M._)`${_e.default.vErrors}[${a}]`),t.if((0,M._)`${i}.instancePath === undefined`,()=>t.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)(_e.default.instancePath,s.errorPath))),t.assign((0,M._)`${i}.schemaPath`,(0,M.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,M._)`${i}.schema`,r),t.assign((0,M._)`${i}.data`,o))})}fe.extendErrors=nb;function bp(t,e){let r=t.const("err",e);t.if((0,M._)`${_e.default.vErrors} === null`,()=>t.assign(_e.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${_e.default.vErrors}.push(${r})`),t.code((0,M._)`${_e.default.errors}++`)}function vp(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,M._)`new ${t.ValidationError}(${e})`):(r.assign((0,M._)`${o}.errors`,e),r.return(!1))}var kt={keyword:new M.Name("keyword"),schemaPath:new M.Name("schemaPath"),params:new M.Name("params"),propertyName:new M.Name("propertyName"),message:new M.Name("message"),schema:new M.Name("schema"),parentSchema:new M.Name("parentSchema")};function $p(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,M._)`{}`:sb(t,e,r)}function sb(t,e,r={}){let{gen:o,it:n}=t,s=[ib(n,r),ab(t,r)];return cb(t,e,s),o.object(...s)}function ib({errorPath:t},{instancePath:e}){let r=e?(0,M.str)`${t}${(0,tn.getErrorPath)(e,tn.Type.Str)}`:t;return[_e.default.instancePath,(0,M.strConcat)(_e.default.instancePath,r)]}function ab({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,M.str)`${e}/${t}`;return r&&(n=(0,M.str)`${n}${(0,tn.getErrorPath)(r,tn.Type.Str)}`),[kt.schemaPath,n]}function cb(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([kt.keyword,n],[kt.params,typeof e=="function"?e(t):e||(0,M._)`{}`]),c.messages&&o.push([kt.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([kt.schema,i],[kt.parentSchema,(0,M._)`${l}${d}`],[_e.default.data,s]),u&&o.push([kt.propertyName,u])}});var xp=v(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.boolOrEmptySchema=Vt.topBoolOrEmptySchema=void 0;var ub=Fr(),lb=I(),db=tt(),pb={message:"boolean schema is false"};function fb(t){let{gen:e,schema:r,validateName:o}=t;r===!1?wp(t,!1):typeof r=="object"&&r.$async===!0?e.return(db.default.data):(e.assign((0,lb._)`${o}.errors`,null),e.return(!0))}Vt.topBoolOrEmptySchema=fb;function mb(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),wp(t)):r.var(e,!0)}Vt.boolOrEmptySchema=mb;function wp(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,ub.reportError)(n,pb,void 0,e)}});var _i=v(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.getRules=Bt.isJSONType=void 0;var hb=["string","number","integer","boolean","null","object","array"],gb=new Set(hb);function _b(t){return typeof t=="string"&&gb.has(t)}Bt.isJSONType=_b;function yb(){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:{}}}Bt.getRules=yb});var yi=v(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.shouldUseRule=dt.shouldUseGroup=dt.schemaHasRulesForType=void 0;function bb({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&kp(t,o)}dt.schemaHasRulesForType=bb;function kp(t,e){return e.rules.some(r=>zp(t,r))}dt.shouldUseGroup=kp;function zp(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=zp});var Vr=v(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 vb=_i(),$b=yi(),wb=Fr(),O=I(),Sp=q(),Jt;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Jt||(me.DataType=Jt={}));function xb(t){let e=Pp(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}me.getSchemaTypes=xb;function Pp(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(vb.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}me.getJSONTypes=Pp;function kb(t,e){let{gen:r,data:o,opts:n}=t,s=zb(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,Jt.Wrong);r.if(a,()=>{s.length?Sb(t,e,s):$i(t)})}return i}me.coerceAndCheckDataType=kb;var Tp=new Set(["string","number","integer","boolean","null"]);function zb(t,e){return e?t.filter(r=>Tp.has(r)||e==="array"&&r==="array"):[]}function Sb(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,O._)`typeof ${n}`),a=o.let("coerced",(0,O._)`undefined`);s.coerceTypes==="array"&&o.if((0,O._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,O._)`${n}[0]`).assign(i,(0,O._)`typeof ${n}`).if(vi(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,O._)`${a} !== undefined`);for(let u of r)(Tp.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),$i(t),o.endIf(),o.if((0,O._)`${a} !== undefined`,()=>{o.assign(n,a),Pb(t,a)});function c(u){switch(u){case"string":o.elseIf((0,O._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,O._)`"" + ${n}`).elseIf((0,O._)`${n} === null`).assign(a,(0,O._)`""`);return;case"number":o.elseIf((0,O._)`${i} == "boolean" || ${n} === null
|
|
4
|
+
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,O._)`+${n}`);return;case"integer":o.elseIf((0,O._)`${i} === "boolean" || ${n} === null
|
|
5
|
+
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,O._)`+${n}`);return;case"boolean":o.elseIf((0,O._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,O._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,O._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,O._)`${i} === "string" || ${i} === "number"
|
|
6
|
+
|| ${i} === "boolean" || ${n} === null`).assign(a,(0,O._)`[${n}]`)}}}function Pb({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,O._)`${e} !== undefined`,()=>t.assign((0,O._)`${e}[${r}]`,o))}function bi(t,e,r,o=Jt.Correct){let n=o===Jt.Correct?O.operators.EQ:O.operators.NEQ,s;switch(t){case"null":return(0,O._)`${e} ${n} null`;case"array":s=(0,O._)`Array.isArray(${e})`;break;case"object":s=(0,O._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,O._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,O._)`typeof ${e} ${n} ${t}`}return o===Jt.Correct?s:(0,O.not)(s);function i(a=O.nil){return(0,O.and)((0,O._)`typeof ${e} == "number"`,a,r?(0,O._)`isFinite(${e})`:O.nil)}}me.checkDataType=bi;function vi(t,e,r,o){if(t.length===1)return bi(t[0],e,r,o);let n,s=(0,Sp.toHash)(t);if(s.array&&s.object){let i=(0,O._)`typeof ${e} != "object"`;n=s.null?i:(0,O._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=O.nil;s.number&&delete s.integer;for(let i in s)n=(0,O.and)(n,bi(i,e,r,o));return n}me.checkDataTypes=vi;var Tb={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,O._)`{type: ${t}}`:(0,O._)`{type: ${e}}`};function $i(t){let e=Eb(t);(0,wb.reportError)(e,Tb)}me.reportTypeError=$i;function Eb(t){let{gen:e,data:r,schema:o}=t,n=(0,Sp.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Rp=v(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.assignDefaults=void 0;var Ht=I(),Rb=q();function Ob(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Ep(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Ep(t,s,n.default))}rn.assignDefaults=Ob;function Ep(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Ht._)`${s}${(0,Ht.getProperty)(e)}`;if(n){(0,Rb.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Ht._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Ht._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Ht._)`${a} = ${(0,Ht.stringify)(r)}`)}});var Ne=v(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 K=I(),wi=q(),pt=tt(),Ib=q();function Nb(t,e){let{gen:r,data:o,it:n}=t;r.if(ki(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,K._)`${e}`},!0),t.error()})}V.checkReportMissingProp=Nb;function Ab({gen:t,data:e,it:{opts:r}},o,n){return(0,K.or)(...o.map(s=>(0,K.and)(ki(t,e,s,r.ownProperties),(0,K._)`${n} = ${s}`)))}V.checkMissingProp=Ab;function Zb(t,e){t.setParams({missingProperty:e},!0),t.error()}V.reportMissingProp=Zb;function Op(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,K._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=Op;function xi(t,e,r){return(0,K._)`${Op(t)}.call(${e}, ${r})`}V.isOwnProperty=xi;function Cb(t,e,r,o){let n=(0,K._)`${e}${(0,K.getProperty)(r)} !== undefined`;return o?(0,K._)`${n} && ${xi(t,e,r)}`:n}V.propertyInData=Cb;function ki(t,e,r,o){let n=(0,K._)`${e}${(0,K.getProperty)(r)} === undefined`;return o?(0,K.or)(n,(0,K.not)(xi(t,e,r))):n}V.noPropertyInData=ki;function Ip(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}V.allSchemaProperties=Ip;function jb(t,e){return Ip(e).filter(r=>!(0,wi.alwaysValidSchema)(t,e[r]))}V.schemaProperties=jb;function Db({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,K._)`${t}, ${e}, ${o}${n}`:e,d=[[pt.default.instancePath,(0,K.strConcat)(pt.default.instancePath,s)],[pt.default.parentData,i.parentData],[pt.default.parentDataProperty,i.parentDataProperty],[pt.default.rootData,pt.default.rootData]];i.opts.dynamicRef&&d.push([pt.default.dynamicAnchors,pt.default.dynamicAnchors]);let p=(0,K._)`${l}, ${r.object(...d)}`;return c!==K.nil?(0,K._)`${a}.call(${c}, ${p})`:(0,K._)`${a}(${p})`}V.callValidateCode=Db;var qb=(0,K._)`new RegExp`;function Mb({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,K._)`${n.code==="new RegExp"?qb:(0,Ib.useFunc)(t,n)}(${r}, ${o})`})}V.usePattern=Mb;function Lb(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,K._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:wi.Type.Num},s),e.if((0,K.not)(s),a)})}}V.validateArray=Lb;function Ub(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,wi.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,K._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,K.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}V.validateUnion=Ub});var Zp=v(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.validateKeywordUsage=Ve.validSchemaType=Ve.funcKeywordCode=Ve.macroKeywordCode=void 0;var ye=I(),zt=tt(),Fb=Ne(),Vb=Fr();function Bb(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=Ap(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ye.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ve.macroKeywordCode=Bb;function Jb(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;Wb(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=Ap(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)_(),e.modifying&&Np(t),y(()=>t.error());else{let b=e.async?f():m();e.modifying&&Np(t),y(()=>Hb(t,b))}}function f(){let b=o.let("ruleErrs",null);return o.try(()=>_((0,ye._)`await `),P=>o.assign(d,!1).if((0,ye._)`${P} instanceof ${c.ValidationError}`,()=>o.assign(b,(0,ye._)`${P}.errors`),()=>o.throw(P))),b}function m(){let b=(0,ye._)`${l}.errors`;return o.assign(b,null),_(ye.nil),b}function _(b=e.async?(0,ye._)`await `:ye.nil){let P=c.opts.passContext?zt.default.this:zt.default.self,x=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,ye._)`${b}${(0,Fb.callValidateCode)(t,l,P,x)}`,e.modifying)}function y(b){var P;o.if((0,ye.not)((P=e.valid)!==null&&P!==void 0?P:d),b)}}Ve.funcKeywordCode=Jb;function Np(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ye._)`${o.parentData}[${o.parentDataProperty}]`))}function Hb(t,e){let{gen:r}=t;r.if((0,ye._)`Array.isArray(${e})`,()=>{r.assign(zt.default.vErrors,(0,ye._)`${zt.default.vErrors} === null ? ${e} : ${zt.default.vErrors}.concat(${e})`).assign(zt.default.errors,(0,ye._)`${zt.default.vErrors}.length`),(0,Vb.extendErrors)(t)},()=>t.error())}function Wb({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Ap(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,ye.stringify)(r)})}function Gb(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")}Ve.validSchemaType=Gb;function Kb({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)}}Ve.validateKeywordUsage=Kb});var jp=v(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.extendSubschemaMode=ft.extendSubschemaData=ft.getSubschema=void 0;var Be=I(),Cp=q();function Qb(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,Be._)`${t.schemaPath}${(0,Be.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Be._)`${t.schemaPath}${(0,Be.getProperty)(e)}${(0,Be.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Cp.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')}ft.getSubschema=Qb;function Yb(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:d}=e,p=a.let("data",(0,Be._)`${e.data}${(0,Be.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Be.str)`${u}${(0,Cp.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Be._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Be.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]}}ft.extendSubschemaData=Yb;function Xb(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}ft.extendSubschemaMode=Xb});var zi=v((nR,Dp)=>{"use strict";Dp.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 Mp=v((sR,qp)=>{"use strict";var mt=qp.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(){};on(e,o,n,t,"",t)};mt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};mt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};mt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};mt.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 on(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 d=o[l];if(Array.isArray(d)){if(l in mt.arrayKeywords)for(var p=0;p<d.length;p++)on(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in mt.propsKeywords){if(d&&typeof d=="object")for(var f in d)on(t,e,r,d[f],n+"/"+l+"/"+ev(f),s,n,l,o,f)}else(l in mt.keywords||t.allKeys&&!(l in mt.skipKeywords))&&on(t,e,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function ev(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Br=v(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getSchemaRefs=we.resolveUrl=we.normalizeId=we._getFullPath=we.getFullPath=we.inlineRef=void 0;var tv=q(),rv=zi(),ov=Mp(),nv=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function sv(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Si(t):e?Lp(t)<=e:!1}we.inlineRef=sv;var iv=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Si(t){for(let e in t){if(iv.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Si)||typeof r=="object"&&Si(r))return!0}return!1}function Lp(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!nv.has(r)&&(typeof t[r]=="object"&&(0,tv.eachItem)(t[r],o=>e+=Lp(o)),e===1/0))return 1/0}return e}function Up(t,e="",r){r!==!1&&(e=Wt(e));let o=t.parse(e);return Fp(t,o)}we.getFullPath=Up;function Fp(t,e){return t.serialize(e).split("#")[0]+"#"}we._getFullPath=Fp;var av=/#\/?$/;function Wt(t){return t?t.replace(av,""):""}we.normalizeId=Wt;function cv(t,e,r){return r=Wt(r),t.resolve(e,r)}we.resolveUrl=cv;var uv=/^[a-z_][-a-z0-9._]*$/i;function lv(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Wt(t[r]||e),s={"":n},i=Up(o,n,!1),a={},c=new Set;return ov(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let _=i+p,y=s[m];typeof d[r]=="string"&&(y=b.call(this,d[r])),P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),s[p]=y;function b(x){let S=this.opts.uriResolver.resolve;if(x=Wt(y?S(y,x):x),c.has(x))throw l(x);c.add(x);let w=this.refs[x];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?u(d,w.schema,x):x!==Wt(_)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=_),x}function P(x){if(typeof x=="string"){if(!uv.test(x))throw new Error(`invalid anchor "${x}"`);b.call(this,`#${x}`)}}}),a;function u(d,p,f){if(p!==void 0&&!rv(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}we.getSchemaRefs=lv});var Wr=v(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.getData=ht.KeywordCxt=ht.validateFunctionCode=void 0;var Wp=xp(),Vp=Vr(),Ti=yi(),nn=Vr(),dv=Rp(),Hr=Zp(),Pi=jp(),z=I(),E=tt(),pv=Br(),rt=q(),Jr=Fr();function fv(t){if(Qp(t)&&(Yp(t),Kp(t))){gv(t);return}Gp(t,()=>(0,Wp.topBoolOrEmptySchema)(t))}ht.validateFunctionCode=fv;function Gp({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,z._)`${E.default.data}, ${E.default.valCxt}`,o.$async,()=>{t.code((0,z._)`"use strict"; ${Bp(r,n)}`),hv(t,n),t.code(s)}):t.func(e,(0,z._)`${E.default.data}, ${mv(n)}`,o.$async,()=>t.code(Bp(r,n)).code(s))}function mv(t){return(0,z._)`{${E.default.instancePath}="", ${E.default.parentData}, ${E.default.parentDataProperty}, ${E.default.rootData}=${E.default.data}${t.dynamicRef?(0,z._)`, ${E.default.dynamicAnchors}={}`:z.nil}}={}`}function hv(t,e){t.if(E.default.valCxt,()=>{t.var(E.default.instancePath,(0,z._)`${E.default.valCxt}.${E.default.instancePath}`),t.var(E.default.parentData,(0,z._)`${E.default.valCxt}.${E.default.parentData}`),t.var(E.default.parentDataProperty,(0,z._)`${E.default.valCxt}.${E.default.parentDataProperty}`),t.var(E.default.rootData,(0,z._)`${E.default.valCxt}.${E.default.rootData}`),e.dynamicRef&&t.var(E.default.dynamicAnchors,(0,z._)`${E.default.valCxt}.${E.default.dynamicAnchors}`)},()=>{t.var(E.default.instancePath,(0,z._)`""`),t.var(E.default.parentData,(0,z._)`undefined`),t.var(E.default.parentDataProperty,(0,z._)`undefined`),t.var(E.default.rootData,E.default.data),e.dynamicRef&&t.var(E.default.dynamicAnchors,(0,z._)`{}`)})}function gv(t){let{schema:e,opts:r,gen:o}=t;Gp(t,()=>{r.$comment&&e.$comment&&ef(t),$v(t),o.let(E.default.vErrors,null),o.let(E.default.errors,0),r.unevaluated&&_v(t),Xp(t),kv(t)})}function _v(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,z._)`${r}.evaluated`),e.if((0,z._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,z._)`${t.evaluated}.props`,(0,z._)`undefined`)),e.if((0,z._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,z._)`${t.evaluated}.items`,(0,z._)`undefined`))}function Bp(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,z._)`/*# sourceURL=${r} */`:z.nil}function yv(t,e){if(Qp(t)&&(Yp(t),Kp(t))){bv(t,e);return}(0,Wp.boolOrEmptySchema)(t,e)}function Kp({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 Qp(t){return typeof t.schema!="boolean"}function bv(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&ef(t),wv(t),xv(t);let s=o.const("_errs",E.default.errors);Xp(t,s),o.var(e,(0,z._)`${s} === ${E.default.errors}`)}function Yp(t){(0,rt.checkUnknownRules)(t),vv(t)}function Xp(t,e){if(t.opts.jtd)return Jp(t,[],!1,e);let r=(0,Vp.getSchemaTypes)(t.schema),o=(0,Vp.coerceAndCheckDataType)(t,r);Jp(t,r,!o,e)}function vv(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,rt.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function $v(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,rt.checkStrictMode)(t,"default is ignored in the schema root")}function wv(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,pv.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function xv(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ef({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,z._)`${E.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,z.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,z._)`${E.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function kv(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,z._)`${E.default.errors} === 0`,()=>e.return(E.default.data),()=>e.throw((0,z._)`new ${n}(${E.default.vErrors})`)):(e.assign((0,z._)`${o}.errors`,E.default.vErrors),s.unevaluated&&zv(t),e.return((0,z._)`${E.default.errors} === 0`))}function zv({gen:t,evaluated:e,props:r,items:o}){r instanceof z.Name&&t.assign((0,z._)`${e}.props`,r),o instanceof z.Name&&t.assign((0,z._)`${e}.items`,o)}function Jp(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,rt.schemaHasRulesButRef)(s,l))){n.block(()=>rf(t,"$ref",l.all.$ref.definition));return}c.jtd||Sv(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Ti.shouldUseGroup)(s,p)&&(p.type?(n.if((0,nn.checkDataType)(p.type,i,c.strictNumbers)),Hp(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,nn.reportTypeError)(t)),n.endIf()):Hp(t,p),a||n.if((0,z._)`${E.default.errors} === ${o||0}`))}}function Hp(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,dv.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ti.shouldUseRule)(o,s)&&rf(t,s.keyword,s.definition,e.type)})}function Sv(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Pv(t,e),t.opts.allowUnionTypes||Tv(t,e),Ev(t,t.dataTypes))}function Pv(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{tf(t.dataTypes,r)||Ei(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Ov(t,e)}}function Tv(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ei(t,"use allowUnionTypes to allow union type keyword")}function Ev(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Ti.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Rv(e,i))&&Ei(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Rv(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function tf(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Ov(t,e){let r=[];for(let o of t.dataTypes)tf(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Ei(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,rt.checkStrictMode)(t,e,t.opts.strictTypes)}var sn=class{constructor(e,r,o){if((0,Hr.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,rt.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",of(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Hr.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",E.default.errors))}result(e,r,o){this.failResult((0,z.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,z.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,z._)`${r} !== undefined && (${(0,z.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?Jr.reportExtraError:Jr.reportError)(this,this.def.error,r)}$dataError(){(0,Jr.reportError)(this,this.def.$dataError||Jr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Jr.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=z.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=z.nil,r=z.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,z.or)((0,z._)`${n} === undefined`,r)),e!==z.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==z.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,z.or)(i(),a());function i(){if(o.length){if(!(r instanceof z.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,z._)`${(0,nn.checkDataTypes)(c,r,s.opts.strictNumbers,nn.DataType.Wrong)}`}return z.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,z._)`!${c}(${r})`}return z.nil}}subschema(e,r){let o=(0,Pi.getSubschema)(this.it,e);(0,Pi.extendSubschemaData)(o,this.it,e),(0,Pi.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return yv(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=rt.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=rt.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,z.Name)),!0}};ht.KeywordCxt=sn;function rf(t,e,r,o){let n=new sn(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Hr.funcKeywordCode)(n,r):"macro"in r?(0,Hr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Hr.funcKeywordCode)(n,r)}var Iv=/^\/(?:[^~]|~0|~1)*$/,Nv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function of(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return E.default.rootData;if(t[0]==="/"){if(!Iv.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=E.default.rootData}else{let u=Nv.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,z._)`${s}${(0,z.getProperty)((0,rt.unescapeJsonPointer)(u))}`,i=(0,z._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}ht.getData=of});var an=v(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});var Ri=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Oi.default=Ri});var Gr=v(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});var Ii=Br(),Ni=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Ii.resolveUrl)(e,r,o),this.missingSchema=(0,Ii.normalizeId)((0,Ii.getFullPath)(e,this.missingRef))}};Ai.default=Ni});var un=v(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.resolveSchema=Ae.getCompilingSchema=Ae.resolveRef=Ae.compileSchema=Ae.SchemaEnv=void 0;var De=I(),Av=an(),St=tt(),qe=Br(),nf=q(),Zv=Wr(),Gt=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={}}};Ae.SchemaEnv=Gt;function Ci(t){let e=sf.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:Av.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:St.default.data,parentData:St.default.parentData,parentDataProperty:St.default.parentDataProperty,dataNames:[St.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,Zv.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(St.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${St.default.self}`,`${St.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:d,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(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Ae.compileSchema=Ci;function Cv(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=qv.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 Gt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=jv.call(this,s)}Ae.resolveRef=Cv;function jv(t){return(0,qe.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Ci.call(this,t)}function sf(t){for(let e of this._compilations)if(Dv(e,t))return e}Ae.getCompilingSchema=sf;function Dv(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function qv(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||cn.call(this,t,e)}function cn(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 Zi.call(this,r,t);let s=(0,qe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=cn.call(this,t,i);return typeof a?.schema!="object"?void 0:Zi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Ci.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 Gt({schema:a,schemaId:c,root:t,baseId:n})}return Zi.call(this,r,i)}}Ae.resolveSchema=cn;var Mv=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zi(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,nf.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Mv.has(a)&&u&&(e=(0,qe.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,nf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,qe.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=cn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Gt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var af=v((dR,Lv)=>{Lv.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 qi=v((pR,ff)=>{"use strict";var Uv=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),uf=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),ji=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),lf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Fv=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Di(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 Vv=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function cf(t){return t.length=0,!0}function Bv(t,e,r){if(t.length){let o=Di(t);if(o!=="")e.push(o);else return r.error=!0,!1;t.length=0}return!0}function Jv(t){let e=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Bv;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=cf}else{n.push(u);continue}}return n.length&&(a===cf?r.zone=n.join(""):i?o.push(n.join("")):o.push(Di(n))),r.address=o.join(""),r}function df(t){if(Hv(t,":")<2)return{host:t,isIPV6:!1};let e=Jv(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 Hv(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function Wv(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 Gv={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Kv=/[@/?#:]/g,Qv=/[@/?#]/g;function pf(t,e){let r=e?Qv:Kv;return r.lastIndex=0,t.replace(r,o=>Gv[o])}function Yv(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(ji(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&lf(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function Xv(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(ji(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&lf(s)?e+=s:e+="%"+n,r+=2;continue}}Fv(t[r])?e+=t[r]:e+=escape(t[r])}return e}function e$(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(ji(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function t$(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!uf(r)){let o=df(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=pf(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}ff.exports={nonSimpleDomain:Vv,recomposeAuthority:t$,reescapeHostDelimiters:pf,normalizePercentEncoding:Yv,normalizePathEncoding:Xv,escapePreservingEscapes:e$,removeDotSegments:Wv,isIPv4:uf,isUUID:Uv,normalizeIPv6:df,stringArrayToHexStripped:Di}});var yf=v((fR,_f)=>{"use strict";var{isUUID:r$}=qi(),o$=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n$=["http","https","ws","wss","urn","urn:uuid"];function s$(t){return n$.indexOf(t)!==-1}function Mi(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 mf(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function hf(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 i$(t){return t.secure=Mi(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function a$(t){if((t.port===(Mi(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 c$(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(o$);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=Li(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function u$(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=Li(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 l$(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!r$(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function d$(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var gf={scheme:"http",domainHost:!0,parse:mf,serialize:hf},p$={scheme:"https",domainHost:gf.domainHost,parse:mf,serialize:hf},ln={scheme:"ws",domainHost:!0,parse:i$,serialize:a$},f$={scheme:"wss",domainHost:ln.domainHost,parse:ln.parse,serialize:ln.serialize},m$={scheme:"urn",parse:c$,serialize:u$,skipNormalize:!0},h$={scheme:"urn:uuid",parse:l$,serialize:d$,skipNormalize:!0},dn={http:gf,https:p$,ws:ln,wss:f$,urn:m$,"urn:uuid":h$};Object.setPrototypeOf(dn,null);function Li(t){return t&&(dn[t]||dn[t.toLowerCase()])||void 0}_f.exports={wsIsSecure:Mi,SCHEMES:dn,isValidSchemeName:s$,getSchemeHandler:Li}});var kf=v((mR,pn)=>{"use strict";var{normalizeIPv6:g$,removeDotSegments:Kr,recomposeAuthority:_$,normalizePercentEncoding:y$,normalizePathEncoding:b$,escapePreservingEscapes:v$,reescapeHostDelimiters:$$,isIPv4:w$,nonSimpleDomain:x$}=qi(),{SCHEMES:k$,getSchemeHandler:vf}=yf();function z$(t,e){return typeof t=="string"?t=R$(t,e):typeof t=="object"&&(t=Kt(Pt(t,e),e)),t}function S$(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=$f(Kt(t,o),Kt(e,o),o,!0);return o.skipEscape=!0,Pt(n,o)}function $f(t,e,r,o){let n={};return o||(t=Kt(Pt(t,r),r),e=Kt(Pt(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=Kr(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=Kr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Kr(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=Kr(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 P$(t,e,r){let o=bf(t,r),n=bf(e,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Pt(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=vf(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=y$(r.path):(r.path=v$(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=_$(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=Kr(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 T$=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function E$(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 wf(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(T$);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=E$(o,i);if(a!==void 0&&(o.error=o.error||a,n=!0),o.host)if(w$(o.host)===!1){let l=g$(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=vf(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&o.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&x$(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}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=$$(unescape(o.host),s))),o.path&&(o.path=b$(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 Kt(t,e){return wf(t,e).parsed}function R$(t,e){return xf(t,e).normalized}function xf(t,e){let{parsed:r,malformedAuthorityOrPort:o}=wf(t,e);return{normalized:o?t:Pt(r,e),malformedAuthorityOrPort:o}}function bf(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:o}=xf(t,e);return o?void 0:r}if(typeof t=="object")return Pt(t,e)}var Ui={SCHEMES:k$,normalize:z$,resolve:S$,resolveComponent:$f,equal:P$,serialize:Pt,parse:Kt};pn.exports=Ui;pn.exports.default=Ui;pn.exports.fastUri=Ui});var Sf=v(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});var zf=kf();zf.code='require("ajv/dist/runtime/uri").default';Fi.default=zf});var Af=v(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 O$=Wr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return O$.KeywordCxt}});var Qt=I();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Qt._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Qt.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Qt.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Qt.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Qt.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return Qt.CodeGen}});var I$=an(),Of=Gr(),N$=_i(),Qr=un(),A$=I(),Yr=Br(),fn=Vr(),Bi=q(),Pf=af(),Z$=Sf(),If=(t,e)=>new RegExp(t,e);If.code="new RegExp";var C$=["removeAdditional","useDefaults","coerceTypes"],j$=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),D$={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."},q$={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Tf=200;function M$(t){var e,r,o,n,s,i,a,c,u,l,d,p,f,m,_,y,b,P,x,S,w,ke,Te,ir,An;let ar=t.strict,Zn=(e=t.code)===null||e===void 0?void 0:e.optimize,Fa=Zn===!0||Zn===void 0?1:Zn||0,Va=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:If,sh=(n=t.uriResolver)!==null&&n!==void 0?n:Z$.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:ar)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:ar)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:ar)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:ar)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:ar)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Fa,regExp:Va}:{optimize:Fa,regExp:Va},loopRequired:(_=t.loopRequired)!==null&&_!==void 0?_:Tf,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Tf,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(P=t.messages)!==null&&P!==void 0?P:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(S=t.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(ke=t.validateSchema)!==null&&ke!==void 0?ke:!0,validateFormats:(Te=t.validateFormats)!==null&&Te!==void 0?Te:!0,unicodeRegExp:(ir=t.unicodeRegExp)!==null&&ir!==void 0?ir:!0,int32range:(An=t.int32range)!==null&&An!==void 0?An:!0,uriResolver:sh}}var Xr=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,...M$(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new A$.ValueScope({scope:{},prefixes:j$,es5:r,lines:o}),this.logger=J$(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,N$.getRules)(),Ef.call(this,D$,e,"NOT SUPPORTED"),Ef.call(this,q$,e,"DEPRECATED","warn"),this._metaOpts=V$.call(this),e.formats&&U$.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&F$.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),L$.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=Pf;o==="id"&&(n={...Pf},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,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Of.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(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,Yr.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=Rf.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new Qr.SchemaEnv({schema:{},schemaId:o});if(r=Qr.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=Rf.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,Yr.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(W$.call(this,o,r),!r)return(0,Bi.eachItem)(o,s=>Vi.call(this,s)),this;K$.call(this,r);let n={...r,type:(0,fn.getJSONTypes)(r.type),schemaType:(0,fn.getJSONTypes)(r.schemaType)};return(0,Bi.eachItem)(o,n.type.length===0?s=>Vi.call(this,s,n):s=>n.type.forEach(i=>Vi.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]=Nf(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,Yr.normalizeId)(i||o);let u=Yr.getSchemaRefs.call(this,e,o);return c=new Qr.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):Qr.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{Qr.compileSchema.call(this,e)}finally{this.opts=r}}};Xr.ValidationError=I$.default;Xr.MissingRefError=Of.default;le.default=Xr;function Ef(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 Rf(t){return t=(0,Yr.normalizeId)(t),this.schemas[t]||this.refs[t]}function L$(){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 U$(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function F$(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 V$(){let t={...this.opts};for(let e of C$)delete t[e];return t}var B$={log(){},warn(){},error(){}};function J$(t){if(t===!1)return B$;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 H$=/^[a-z_$][a-z0-9_$:-]*$/i;function W$(t,e){let{RULES:r}=this;if((0,Bi.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!H$.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 Vi(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,fn.getJSONTypes)(e.type),schemaType:(0,fn.getJSONTypes)(e.schemaType)}};e.before?G$.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 G$(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 K$(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Nf(e)),t.validateSchema=this.compile(e,!0))}var Q$={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Nf(t){return{anyOf:[t,Q$]}}});var Zf=v(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});var Y$={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ji.default=Y$});var qf=v(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.callRef=Tt.getValidate=void 0;var X$=Gr(),Cf=Ne(),xe=I(),Yt=tt(),jf=un(),mn=q(),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 d();let l=jf.resolveRef.call(c,u,n,r);if(l===void 0)throw new X$.default(o.opts.uriResolver,n,r);if(l instanceof jf.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return hn(t,i,s,s.$async);let m=e.scopeValue("root",{ref:u});return hn(t,(0,xe._)`${m}.validate`,u,u.$async)}function p(m){let _=Df(t,m);hn(t,_,m,m.$async)}function f(m){let _=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,xe.stringify)(m)}:{ref:m}),y=e.name("valid"),b=t.subschema({schema:m,dataTypes:[],schemaPath:xe.nil,topSchemaRef:_,errSchemaPath:r},y);t.mergeEvaluated(b),t.ok(y)}}};function Df(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,xe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Tt.getValidate=Df;function hn(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Yt.default.this:xe.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,xe._)`await ${(0,Cf.callValidateCode)(t,e,u)}`),f(e),i||n.assign(m,!0)},_=>{n.if((0,xe._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),p(_),i||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,Cf.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(m){let _=(0,xe._)`${m}.errors`;n.assign(Yt.default.vErrors,(0,xe._)`${Yt.default.vErrors} === null ? ${_} : ${Yt.default.vErrors}.concat(${_})`),n.assign(Yt.default.errors,(0,xe._)`${Yt.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=mn.mergeEvaluated.props(n,y.props,s.props));else{let b=n.var("props",(0,xe._)`${m}.evaluated.props`);s.props=mn.mergeEvaluated.props(n,b,s.props,xe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=mn.mergeEvaluated.items(n,y.items,s.items));else{let b=n.var("items",(0,xe._)`${m}.evaluated.items`);s.items=mn.mergeEvaluated.items(n,b,s.items,xe.Name)}}}Tt.callRef=hn;Tt.default=ew});var Mf=v(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var tw=Zf(),rw=qf(),ow=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",tw.default,rw.default];Hi.default=ow});var Lf=v(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var gn=I(),gt=gn.operators,_n={maximum:{okStr:"<=",ok:gt.LTE,fail:gt.GT},minimum:{okStr:">=",ok:gt.GTE,fail:gt.LT},exclusiveMaximum:{okStr:"<",ok:gt.LT,fail:gt.GTE},exclusiveMinimum:{okStr:">",ok:gt.GT,fail:gt.LTE}},nw={message:({keyword:t,schemaCode:e})=>(0,gn.str)`must be ${_n[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gn._)`{comparison: ${_n[t].okStr}, limit: ${e}}`},sw={keyword:Object.keys(_n),type:"number",schemaType:"number",$data:!0,error:nw,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,gn._)`${r} ${_n[e].fail} ${o} || isNaN(${r})`)}};Wi.default=sw});var Uf=v(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});var eo=I(),iw={message:({schemaCode:t})=>(0,eo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,eo._)`{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,eo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,eo._)`${i} !== parseInt(${i})`;t.fail$data((0,eo._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Gi.default=aw});var Vf=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});function Ff(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}Ki.default=Ff;Ff.code='require("ajv/dist/runtime/ucs2length").default'});var Bf=v(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var Et=I(),cw=q(),uw=Vf(),lw={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Et.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Et._)`{limit: ${t}}`},dw={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"?Et.operators.GT:Et.operators.LT,i=n.opts.unicode===!1?(0,Et._)`${r}.length`:(0,Et._)`${(0,cw.useFunc)(t.gen,uw.default)}(${r})`;t.fail$data((0,Et._)`${i} ${s} ${o}`)}};Qi.default=dw});var Jf=v(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var pw=Ne(),fw=q(),Xt=I(),mw={message:({schemaCode:t})=>(0,Xt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Xt._)`{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,Xt._)`new RegExp`:(0,fw.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Xt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Xt._)`!${l}`)}else{let c=(0,pw.usePattern)(t,n);t.fail$data((0,Xt._)`!${c}.test(${r})`)}}};Yi.default=hw});var Hf=v(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var to=I(),gw={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,to.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,to._)`{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"?to.operators.GT:to.operators.LT;t.fail$data((0,to._)`Object.keys(${r}).length ${n} ${o}`)}};Xi.default=_w});var Wf=v(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var ro=Ne(),oo=I(),yw=q(),bw={message:({params:{missingProperty:t}})=>(0,oo.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,oo._)`{missingProperty: ${t}}`},vw={keyword:"required",type:"object",schemaType:"array",$data:!0,error:bw,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,b=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,yw.checkStrictMode)(i,b,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(oo.nil,d);else for(let f of r)(0,ro.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,ro.checkMissingProp)(t,r,f)),(0,ro.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",o,f=>{t.setParams({missingProperty:f}),e.if((0,ro.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,o,()=>{e.assign(m,(0,ro.propertyInData)(e,n,f,a.ownProperties)),e.if((0,oo.not)(m),()=>{t.error(),e.break()})},oo.nil)}}};ea.default=vw});var Gf=v(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});var no=I(),$w={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,no.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,no._)`{limit: ${t}}`},ww={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:$w,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?no.operators.GT:no.operators.LT;t.fail$data((0,no._)`${r}.length ${n} ${o}`)}};ta.default=ww});var yn=v(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var Kf=zi();Kf.code='require("ajv/dist/runtime/equal").default';ra.default=Kf});var Qf=v(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var oa=Vr(),de=I(),xw=q(),kw=yn(),zw={message:({params:{i:t,j:e}})=>(0,de.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,de._)`{i: ${t}, j: ${e}}`},Sw={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,oa.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,de._)`${i} === false`),t.ok(c);function l(){let m=e.let("i",(0,de._)`${r}.length`),_=e.let("j");t.setParams({i:m,j:_}),e.assign(c,!0),e.if((0,de._)`${m} > 1`,()=>(d()?p:f)(m,_))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,_){let y=e.name("item"),b=(0,oa.checkDataTypes)(u,y,a.opts.strictNumbers,oa.DataType.Wrong),P=e.const("indices",(0,de._)`{}`);e.for((0,de._)`;${m}--;`,()=>{e.let(y,(0,de._)`${r}[${m}]`),e.if(b,(0,de._)`continue`),u.length>1&&e.if((0,de._)`typeof ${y} == "string"`,(0,de._)`${y} += "_"`),e.if((0,de._)`typeof ${P}[${y}] == "number"`,()=>{e.assign(_,(0,de._)`${P}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,de._)`${P}[${y}] = ${m}`)})}function f(m,_){let y=(0,xw.useFunc)(e,kw.default),b=e.name("outer");e.label(b).for((0,de._)`;${m}--;`,()=>e.for((0,de._)`${_} = ${m}; ${_}--;`,()=>e.if((0,de._)`${y}(${r}[${m}], ${r}[${_}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};na.default=Sw});var Yf=v(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var sa=I(),Pw=q(),Tw=yn(),Ew={message:"must be equal to constant",params:({schemaCode:t})=>(0,sa._)`{allowedValue: ${t}}`},Rw={keyword:"const",$data:!0,error:Ew,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,sa._)`!${(0,Pw.useFunc)(e,Tw.default)}(${r}, ${n})`):t.fail((0,sa._)`${s} !== ${r}`)}};ia.default=Rw});var Xf=v(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var so=I(),Ow=q(),Iw=yn(),Nw={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,so._)`{allowedValues: ${t}}`},Aw={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,Ow.useFunc)(e,Iw.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,so.or)(...n.map((m,_)=>p(f,_)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,so._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,m){let _=n[m];return typeof _=="object"&&_!==null?(0,so._)`${u()}(${r}, ${f}[${m}])`:(0,so._)`${r} === ${_}`}}};aa.default=Aw});var em=v(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var Zw=Lf(),Cw=Uf(),jw=Bf(),Dw=Jf(),qw=Hf(),Mw=Wf(),Lw=Gf(),Uw=Qf(),Fw=Yf(),Vw=Xf(),Bw=[Zw.default,Cw.default,jw.default,Dw.default,qw.default,Mw.default,Lw.default,Uw.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Fw.default,Vw.default];ca.default=Bw});var la=v(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.validateAdditionalItems=void 0;var Rt=I(),ua=q(),Jw={message:({params:{len:t}})=>(0,Rt.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Rt._)`{limit: ${t}}`},Hw={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Jw,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,ua.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}tm(t,o)}};function tm(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Rt._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,Rt._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,ua.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,Rt._)`${a} <= ${e.length}`);r.if((0,Rt.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:ua.Type.Num},u),i.allErrors||r.if((0,Rt.not)(u),()=>r.break())})}}io.validateAdditionalItems=tm;io.default=Hw});var da=v(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.validateTuple=void 0;var rm=I(),bn=q(),Ww=Ne(),Gw={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return om(t,"additionalItems",e);r.items=!0,!(0,bn.alwaysValidSchema)(r,e)&&t.ok((0,Ww.validateArray)(t))}};function om(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=bn.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,rm._)`${s}.length`);r.forEach((d,p)=>{(0,bn.alwaysValidSchema)(a,d)||(o.if((0,rm._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,m=r.length,_=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!_){let y=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,bn.checkStrictMode)(a,y,p.strictTuples)}}}ao.validateTuple=om;ao.default=Gw});var nm=v(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var Kw=da(),Qw={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Kw.validateTuple)(t,"items")};pa.default=Qw});var im=v(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var sm=I(),Yw=q(),Xw=Ne(),e0=la(),t0={message:({params:{len:t}})=>(0,sm.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sm._)`{limit: ${t}}`},r0={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:t0,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,Yw.alwaysValidSchema)(o,e)&&(n?(0,e0.validateAdditionalItems)(t,n):t.ok((0,Xw.validateArray)(t)))}};fa.default=r0});var am=v(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var Ze=I(),vn=q(),o0={message:({params:{min:t,max:e}})=>e===void 0?(0,Ze.str)`must contain at least ${t} valid item(s)`:(0,Ze.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Ze._)`{minContains: ${t}}`:(0,Ze._)`{minContains: ${t}, maxContains: ${e}}`},n0={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:o0,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,Ze._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,vn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,vn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,vn.alwaysValidSchema)(s,r)){let _=(0,Ze._)`${l} >= ${i}`;a!==void 0&&(_=(0,Ze._)`${_} && ${l} <= ${a}`),t.pass(_);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,Ze._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let _=e.name("_valid"),y=e.let("count",0);f(_,()=>e.if(_,()=>m(y)))}function f(_,y){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:vn.Type.Num,compositeRule:!0},_),y()})}function m(_){e.code((0,Ze._)`${_}++`),a===void 0?e.if((0,Ze._)`${_} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,Ze._)`${_} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,Ze._)`${_} >= ${i}`,()=>e.assign(d,!0)))}}};ma.default=n0});var lm=v(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.validateSchemaDeps=Je.validatePropertyDeps=Je.error=void 0;var ha=I(),s0=q(),co=Ne();Je.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,ha.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,ha._)`{property: ${t},
|
|
7
7
|
missingProperty: ${o},
|
|
8
8
|
depsCount: ${e},
|
|
9
|
-
deps: ${r}}`};var iz={keyword:"dependencies",type:"object",schemaType:"object",error:Je.error,code(t){let[e,r]=az(t);cm(t,e),um(t,r)}};function az({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 cm(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,co.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,co.checkReportMissingProp)(t,u)}):(r.if((0,ha._)`${c} && (${(0,co.checkMissingProp)(t,a,s)})`),(0,co.reportMissingProp)(t,s),r.else())}}Je.validatePropertyDeps=cm;function um(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,sz.alwaysValidSchema)(s,e[a])||(r.if((0,co.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))}Je.validateSchemaDeps=um;Je.default=iz});var pm=b(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var dm=I(),cz=D(),uz={message:"property name must be valid",params:({params:t})=>(0,dm._)`{propertyName: ${t.propertyName}}`},lz={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:uz,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,cz.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,dm.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};ga.default=lz});var ya=b(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var $n=Ne(),Me=I(),dz=tt(),zn=D(),pz={message:"must NOT have additional properties",params:({params:t})=>(0,Me._)`{additionalProperty: ${t.additionalProperty}}`},fz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:pz,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,$n.allSchemaProperties)(o.properties),l=(0,$n.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Me._)`${s} === ${dz.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let v;if(u.length>8){let P=(0,zn.schemaRefOrVal)(i,o.properties,"properties");v=(0,$n.isOwnProperty)(e,P,y)}else u.length?v=(0,Me.or)(...u.map(P=>(0,Me._)`${y} === ${P}`)):v=Me.nil;return l.length&&(v=(0,Me.or)(v,...l.map(P=>(0,Me._)`${(0,$n.usePattern)(t,P)}.test(${y})`))),(0,Me.not)(v)}function f(y){e.code((0,Me._)`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,Me.not)(v),()=>{t.reset(),f(y)})):(_(y,v),a||e.if((0,Me.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)}}};_a.default=fz});var hm=b(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var mz=Br(),fm=Ne(),va=D(),mm=ya(),hz={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&&mm.default.code(new mz.KeywordCxt(s,mm.default,"additionalProperties"));let i=(0,fm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=va.mergeEvaluated.props(e,(0,va.toHash)(i),s.props));let a=i.filter(d=>!(0,va.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,fm.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};ba.default=hz});var vm=b($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var gm=Ne(),wn=I(),_m=D(),ym=D(),gz={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,gm.allSchemaProperties)(r),c=a.filter(_=>(0,_m.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 wn.Name)&&(s.props=(0,ym.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){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,_m.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function m(_){e.forIn("key",o,y=>{e.if((0,wn._)`${(0,gm.usePattern)(t,_)}.test(${y})`,()=>{let v=c.includes(_);v||t.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:ym.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,wn._)`${d}[${y}]`,!0):!v&&!s.allErrors&&e.if((0,wn.not)(l),()=>e.break())})})}}};$a.default=gz});var bm=b(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var _z=D(),yz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,_z.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"}};za.default=yz});var $m=b(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var vz=Ne(),bz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:vz.validateUnion,error:{message:"must match a schema in anyOf"}};wa.default=bz});var zm=b(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var xn=I(),$z=D(),zz={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,xn._)`{passingSchemas: ${t.passing}}`},wz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:zz,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,d)=>{let p;(0,$z.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,xn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,xn._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,xn.Name)})})}}};xa.default=wz});var wm=b(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var xz=D(),kz={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,xz.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};ka.default=kz});var Sm=b(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var kn=I(),km=D(),Sz={message:({params:t})=>(0,kn.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,kn._)`{failingKeyword: ${t.ifClause}}`},Pz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Sz,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,km.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=xm(o,"then"),s=xm(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,kn.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,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,kn._)`${l}`):t.setParams({ifClause:l})}}}};function xm(t,e){let r=t.schema[e];return r!==void 0&&!(0,km.alwaysValidSchema)(t,r)}Sa.default=Pz});var Pm=b(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var Ez=D(),Tz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Ez.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Pa.default=Tz});var Em=b(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var Oz=la(),Rz=nm(),Iz=da(),Nz=im(),jz=am(),Zz=lm(),Az=pm(),Cz=ya(),qz=hm(),Dz=vm(),Mz=bm(),Lz=$m(),Uz=zm(),Fz=wm(),Vz=Sm(),Jz=Pm();function Hz(t=!1){let e=[Mz.default,Lz.default,Uz.default,Fz.default,Vz.default,Jz.default,Az.default,Cz.default,Zz.default,qz.default,Dz.default];return t?e.push(Rz.default,Nz.default):e.push(Oz.default,Iz.default),e.push(jz.default),e}Ea.default=Hz});var Tm=b(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var oe=I(),Kz={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},Bz={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Kz,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.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})`,z=(0,oe._)`(typeof ${v} == "function" ? ${S} : ${v}.test(${o}))`;return(0,oe._)`${v} && ${v} !== true && ${y} === ${e} && !${z}`}}function f(){let m=d.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){d.logger.warn(z());return}throw new Error(z());function z(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function w(z){let xe=z instanceof RegExp?(0,oe.regexpCode)(z):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Ee=r.scopeValue("formats",{key:s,ref:z,code:xe});return typeof z=="object"&&!(z instanceof RegExp)?[z.type||"string",z.validate,(0,oe._)`${Ee}.validate`]:["string",z,Ee]}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})`}}}};Ta.default=Bz});var Om=b(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Gz=Tm(),Wz=[Gz.default];Oa.default=Wz});var Rm=b(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.contentVocabulary=er.metadataVocabulary=void 0;er.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];er.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Nm=b(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var Yz=Mf(),Qz=em(),Xz=Em(),ew=Om(),Im=Rm(),tw=[Yz.default,Qz.default,(0,Xz.default)(),ew.default,Im.metadataVocabulary,Im.contentVocabulary];Ra.default=tw});var Zm=b(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.DiscrError=void 0;var jm;(function(t){t.Tag="tag",t.Mapping="mapping"})(jm||(Sn.DiscrError=jm={}))});var Cm=b(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var tr=I(),Ia=Zm(),Am=un(),rw=Gr(),ow=D(),nw={message:({params:{discrError:t,tagName:e}})=>t===Ia.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,tr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},sw={keyword:"discriminator",type:"object",schemaType:"object",error:nw,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,tr._)`${r}${(0,tr.getProperty)(a)}`);e.if((0,tr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Ia.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,tr._)`${u} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:Ia.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),_=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(_,tr.Name),m}function p(){var f;let m={},_=v(n),y=!0;for(let S=0;S<i.length;S++){let z=i[S];if(z?.$ref&&!(0,ow.schemaHasRulesButRef)(z,s.self.RULES)){let Ee=z.$ref;if(z=Am.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Ee),z instanceof Am.SchemaEnv&&(z=z.schema),z===void 0)throw new rw.default(s.opts.uriResolver,s.baseId,Ee)}let xe=(f=z?.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(z)),P(xe,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,z){if(S.const)w(S.const,z);else if(S.enum)for(let xe of S.enum)w(xe,z);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(S,z){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[S]=z}}}};Na.default=sw});var qm=b((rR,iw)=>{iw.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 Za=b((Y,ja)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var aw=jf(),cw=Nm(),uw=Cm(),Dm=qm(),lw=["/properties"],Pn="http://json-schema.org/draft-07/schema",rr=class extends aw.default{_addVocabularies(){super._addVocabularies(),cw.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(uw.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Dm,lw):Dm;this.addMetaSchema(e,Pn,!1),this.refs["http://json-schema.org/schema"]=Pn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Pn)?Pn:void 0)}};Y.Ajv=rr;ja.exports=Y=rr;ja.exports.Ajv=rr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=rr;var dw=Br();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return dw.KeywordCxt}});var or=I();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return or._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return or.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return or.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return or.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return or.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return or.CodeGen}});var pw=an();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return pw.default}});var fw=Gr();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return fw.default}})});var Km=b(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.formatNames=Ke.fastFormats=Ke.fullFormats=void 0;function He(t,e){return{validate:t,compare:e}}Ke.fullFormats={date:He(Fm,Da),time:He(Ca(!0),Ma),"date-time":He(Mm(!0),Jm),"iso-time":He(Ca(),Vm),"iso-date-time":He(Mm(),Hm),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:vw,"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:Sw,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:bw,int32:{type:"number",validate:ww},int64:{type:"number",validate:xw},float:{type:"number",validate:Um},double:{type:"number",validate:Um},password:!0,binary:!0};Ke.fastFormats={...Ke.fullFormats,date:He(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Da),time:He(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ma),"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,Jm),"iso-time":He(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Vm),"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,Hm),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};Ke.formatNames=Object.keys(Ke.fullFormats);function mw(t){return t%4===0&&(t%100!==0||t%400===0)}var hw=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gw=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Fm(t){let e=hw.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&&mw(r)?29:gw[o])}function Da(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Aa=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ca(t){return function(r){let o=Aa.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 d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ma(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 Vm(t,e){if(!(t&&e))return;let r=Aa.exec(t),o=Aa.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 qa=/t|\s/i;function Mm(t){let e=Ca(t);return function(o){let n=o.split(qa);return n.length===2&&Fm(n[0])&&e(n[1])}}function Jm(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function Hm(t,e){if(!(t&&e))return;let[r,o]=t.split(qa),[n,s]=e.split(qa),i=Da(r,n);if(i!==void 0)return i||Ma(o,s)}var _w=/\/|:/,yw=/^(?:[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 vw(t){return _w.test(t)&&yw.test(t)}var Lm=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function bw(t){return Lm.lastIndex=0,Lm.test(t)}var $w=-(2**31),zw=2**31-1;function ww(t){return Number.isInteger(t)&&t<=zw&&t>=$w}function xw(t){return Number.isInteger(t)}function Um(){return!0}var kw=/[^\\]\\Z/;function Sw(t){if(kw.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Bm=b(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.formatLimitDefinition=void 0;var Pw=Za(),Le=I(),_t=Le.operators,En={formatMaximum:{okStr:"<=",ok:_t.LTE,fail:_t.GT},formatMinimum:{okStr:">=",ok:_t.GTE,fail:_t.LT},formatExclusiveMaximum:{okStr:"<",ok:_t.LT,fail:_t.GTE},formatExclusiveMinimum:{okStr:">",ok:_t.GT,fail:_t.LTE}},Ew={message:({keyword:t,schemaCode:e})=>(0,Le.str)`should be ${En[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Le._)`{comparison: ${En[t].okStr}, limit: ${e}}`};nr.formatLimitDefinition={keyword:Object.keys(En),type:"string",schemaType:"string",$data:!0,error:Ew,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 Pw.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Le._)`${p}[${c.schemaCode}]`);t.fail$data((0,Le.or)((0,Le._)`typeof ${f} != "object"`,(0,Le._)`${f} instanceof RegExp`,(0,Le._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,Le._)`${i.code.formats}${(0,Le.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,Le._)`${p}.compare(${r}, ${o}) ${En[n].fail} 0`}},dependencies:["format"]};var Tw=t=>(t.addKeyword(nr.formatLimitDefinition),t);nr.default=Tw});var Qm=b((uo,Ym)=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});var sr=Km(),Ow=Bm(),La=I(),Gm=new La.Name("fullFormats"),Rw=new La.Name("fastFormats"),Ua=(t,e={keywords:!0})=>{if(Array.isArray(e))return Wm(t,e,sr.fullFormats,Gm),t;let[r,o]=e.mode==="fast"?[sr.fastFormats,Rw]:[sr.fullFormats,Gm],n=e.formats||sr.formatNames;return Wm(t,n,r,o),e.keywords&&(0,Ow.default)(t),t};Ua.get=(t,e="full")=>{let o=(e==="fast"?sr.fastFormats:sr.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function Wm(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,La._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}Ym.exports=uo=Ua;Object.defineProperty(uo,"__esModule",{value:!0});uo.default=Ua});var Ka;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 d=0;d<l.length;d++){let p=l[d];p in a||(a[p]=u[p].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 Ue=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Rt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Ka=globalThis).__zod_globalConfig??(Ka.__zod_globalConfig={});var It=globalThis.__zod_globalConfig;function ke(t){return t&&Object.assign(It,t),It}var q={};Ja(q,{BIGINT_FORMAT_RANGES:()=>Ya,Class:()=>qn,NUMBER_FORMAT_RANGES:()=>Vn,aborted:()=>st,allowsEval:()=>Ln,assert:()=>gh,assertEqual:()=>ph,assertIs:()=>mh,assertNever:()=>hh,assertNotEqual:()=>fh,assignProp:()=>ot,base64ToUint8Array:()=>Xa,base64urlToUint8Array:()=>Nh,cached:()=>jt,captureStackTrace:()=>mo,cleanEnum:()=>Ih,cleanRegex:()=>dr,clone:()=>Ae,cloneDef:()=>yh,createTransparentProxy:()=>xh,defineLazy:()=>U,esc:()=>fo,escapeRegex:()=>We,explicitlyAborted:()=>Jn,extend:()=>Ph,finalizeIssue:()=>Te,floatSafeRemainder:()=>Dn,getElementAtPath:()=>vh,getEnumValues:()=>ur,getLengthableOrigin:()=>pr,getParsedType:()=>wh,getSizableOrigin:()=>Qa,hexToUint8Array:()=>Zh,isObject:()=>yt,isPlainObject:()=>nt,issue:()=>Zt,joinValues:()=>po,jsonStringifyReplacer:()=>Nt,merge:()=>Th,mergeDefs:()=>Ge,normalizeParams:()=>E,nullish:()=>lr,numKeys:()=>zh,objectClone:()=>_h,omit:()=>Sh,optionalKeys:()=>Fn,parsedType:()=>Hn,partial:()=>Oh,pick:()=>kh,prefixIssues:()=>Ye,primitiveTypes:()=>Wa,promiseAllObject:()=>bh,propertyKeyTypes:()=>Un,randomString:()=>$h,required:()=>Rh,safeExtend:()=>Eh,shallowClone:()=>Ga,slugify:()=>Mn,stringifyPrimitive:()=>ho,uint8ArrayToBase64:()=>ec,uint8ArrayToBase64url:()=>jh,uint8ArrayToHex:()=>Ah,unwrapMessage:()=>cr});function ph(t){return t}function fh(t){return t}function mh(t){}function hh(t){throw new Error("Unexpected value in exhaustive check")}function gh(t){}function ur(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=>ho(r)).join(e)}function Nt(t,e){return typeof e=="bigint"?e.toString():e}function jt(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function lr(t){return t==null}function dr(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Dn(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 Ba=Symbol("evaluating");function U(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==Ba)return o===void 0&&(o=Ba,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function _h(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ot(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ge(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function yh(t){return Ge(t._zod.def)}function vh(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function bh(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 $h(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function fo(t){return JSON.stringify(t)}function Mn(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mo="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function yt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Ln=jt(()=>{if(It.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function nt(t){if(yt(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(yt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ga(t){return nt(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function zh(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var wh=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}`)}},Un=new Set(["string","number","symbol"]),Wa=new Set(["string","number","bigint","boolean","symbol","undefined"]);function We(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(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 xh(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 ho(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Fn(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Vn={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]},Ya={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function kh(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=Ge(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 ot(this,"shape",i),i},checks:[]});return Ae(t,s)}function Sh(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=Ge(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 ot(this,"shape",i),i},checks:[]});return Ae(t,s)}function Ph(t,e){if(!nt(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=Ge(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return ot(this,"shape",s),s}});return Ae(t,n)}function Eh(t,e){if(!nt(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ge(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return ot(this,"shape",o),o}});return Ae(t,r)}function Th(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=Ge(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return ot(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Ae(t,r)}function Oh(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=Ge(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 ot(this,"shape",c),c},checks:[]});return Ae(e,i)}function Rh(t,e,r){let o=Ge(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 ot(this,"shape",s),s}});return Ae(e,o)}function st(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 Jn(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 cr(t){return typeof t=="string"?t:t?.message}function Te(t,e,r){let o=t.message?t.message:cr(t.inst?._zod.def?.error?.(t))??cr(e?.error?.(t))??cr(r.customError?.(t))??cr(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 Qa(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function pr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Hn(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 Zt(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Ih(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Xa(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 ec(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Nh(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Xa(e+r)}function jh(t){return ec(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Zh(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 Ah(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var qn=class{constructor(...e){}};var tc=(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,Nt,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},go=g("$ZodError",tc),Kn=g("$ZodError",tc,{Parent:Error});function rc(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 oc(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 _o=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 Ue;if(i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Te(c,s,ke())));throw mo(a,n?.callee),a}return i.value};var yo=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=>Te(c,s,ke())));throw mo(a,n?.callee),a}return i.value};var fr=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 Ue;return s.issues.length?{success:!1,error:new(t??go)(s.issues.map(i=>Te(i,n,ke())))}:{success:!0,data:s.value}},mr=fr(Kn),hr=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=>Te(i,n,ke())))}:{success:!0,data:s.value}},vo=hr(Kn),nc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return _o(t)(e,r,n)};var sc=t=>(e,r,o)=>_o(t)(e,r,o);var ic=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return yo(t)(e,r,n)};var ac=t=>async(e,r,o)=>yo(t)(e,r,o);var cc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return fr(t)(e,r,n)};var uc=t=>(e,r,o)=>fr(t)(e,r,o);var lc=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return hr(t)(e,r,n)};var dc=t=>async(e,r,o)=>hr(t)(e,r,o);var pc=/^[cC][0-9a-z]{6,}$/,fc=/^[0-9a-z]+$/,mc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hc=/^[0-9a-vA-V]{20}$/,gc=/^[A-Za-z0-9]{27}$/,_c=/^[a-zA-Z0-9_-]{21}$/,yc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var vc=/^([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})$/,Bn=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 bc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var qh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $c(){return new RegExp(qh,"u")}var zc=/^(?:(?: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])$/,wc=/^(([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 xc=/^((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])$/,kc=/^(([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])$/,Sc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gn=/^[A-Za-z0-9_-]*$/;var Pc=/^https?$/,Ec=/^\+[1-9]\d{6,14}$/,Tc="(?:(?:\\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])))",Oc=new RegExp(`^${Tc}$`);function Rc(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 Ic(t){return new RegExp(`^${Rc(t)}$`)}function Nc(t){let e=Rc({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(`^${Tc}T(?:${o})$`)}var jc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Zc=/^-?\d+$/,Wn=/^-?\d+(?:\.\d+)?$/,Ac=/^(?:true|false)$/i,Cc=/^null$/i;var qc=/^[^A-Z]*$/,Dc=/^[^a-z]*$/;var ie=g("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Mc={number:"number",bigint:"bigint",object:"date"},Yn=g("$ZodCheckLessThan",(t,e)=>{ie.init(t,e);let r=Mc[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})}}),Qn=g("$ZodCheckGreaterThan",(t,e)=>{ie.init(t,e);let r=Mc[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})}}),Lc=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):Dn(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})}}),Uc=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]=Vn[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=Zc)}),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 Fc=g("$ZodCheckMaxLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(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=pr(n);o.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Vc=g("$ZodCheckMinLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(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=pr(n);o.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Jc=g("$ZodCheckLengthEquals",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(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=pr(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})}}),gr=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=()=>{})}),Hc=g("$ZodCheckRegex",(t,e)=>{gr.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})}}),Kc=g("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=qc),gr.init(t,e)}),Bc=g("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Dc),gr.init(t,e)}),Gc=g("$ZodCheckIncludes",(t,e)=>{ie.init(t,e);let r=We(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})}}),Wc=g("$ZodCheckStartsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`^${We(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})}}),Yc=g("$ZodCheckEndsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`.*${We(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 Qc=g("$ZodCheckOverwrite",(t,e)=>{ie.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var $o=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(`
|
|
9
|
+
deps: ${r}}`};var i0={keyword:"dependencies",type:"object",schemaType:"object",error:Je.error,code(t){let[e,r]=a0(t);cm(t,e),um(t,r)}};function a0({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 cm(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,co.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,co.checkReportMissingProp)(t,u)}):(r.if((0,ha._)`${c} && (${(0,co.checkMissingProp)(t,a,s)})`),(0,co.reportMissingProp)(t,s),r.else())}}Je.validatePropertyDeps=cm;function um(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,s0.alwaysValidSchema)(s,e[a])||(r.if((0,co.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))}Je.validateSchemaDeps=um;Je.default=i0});var pm=v(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var dm=I(),c0=q(),u0={message:"property name must be valid",params:({params:t})=>(0,dm._)`{propertyName: ${t.propertyName}}`},l0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:u0,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,c0.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,dm.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};ga.default=l0});var ya=v(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var $n=Ne(),Me=I(),d0=tt(),wn=q(),p0={message:"must NOT have additional properties",params:({params:t})=>(0,Me._)`{additionalProperty: ${t.additionalProperty}}`},f0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:p0,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,wn.alwaysValidSchema)(i,r))return;let u=(0,$n.allSchemaProperties)(o.properties),l=(0,$n.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Me._)`${s} === ${d0.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let b;if(u.length>8){let P=(0,wn.schemaRefOrVal)(i,o.properties,"properties");b=(0,$n.isOwnProperty)(e,P,y)}else u.length?b=(0,Me.or)(...u.map(P=>(0,Me._)`${y} === ${P}`)):b=Me.nil;return l.length&&(b=(0,Me.or)(b,...l.map(P=>(0,Me._)`${(0,$n.usePattern)(t,P)}.test(${y})`))),(0,Me.not)(b)}function f(y){e.code((0,Me._)`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,wn.alwaysValidSchema)(i,r)){let b=e.name("valid");c.removeAdditional==="failing"?(_(y,b,!1),e.if((0,Me.not)(b),()=>{t.reset(),f(y)})):(_(y,b),a||e.if((0,Me.not)(b),()=>e.break()))}}function _(y,b,P){let x={keyword:"additionalProperties",dataProp:y,dataPropType:wn.Type.Str};P===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,b)}}};_a.default=f0});var hm=v(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var m0=Wr(),fm=Ne(),ba=q(),mm=ya(),h0={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&&mm.default.code(new m0.KeywordCxt(s,mm.default,"additionalProperties"));let i=(0,fm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=ba.mergeEvaluated.props(e,(0,ba.toHash)(i),s.props));let a=i.filter(d=>!(0,ba.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,fm.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};va.default=h0});var bm=v($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var gm=Ne(),xn=I(),_m=q(),ym=q(),g0={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,gm.allSchemaProperties)(r),c=a.filter(_=>(0,_m.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 xn.Name)&&(s.props=(0,ym.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){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,_m.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function m(_){e.forIn("key",o,y=>{e.if((0,xn._)`${(0,gm.usePattern)(t,_)}.test(${y})`,()=>{let b=c.includes(_);b||t.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:ym.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,xn._)`${d}[${y}]`,!0):!b&&!s.allErrors&&e.if((0,xn.not)(l),()=>e.break())})})}}};$a.default=g0});var vm=v(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var _0=q(),y0={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,_0.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"}};wa.default=y0});var $m=v(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var b0=Ne(),v0={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:b0.validateUnion,error:{message:"must match a schema in anyOf"}};xa.default=v0});var wm=v(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var kn=I(),$0=q(),w0={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,kn._)`{passingSchemas: ${t.passing}}`},x0={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:w0,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,d)=>{let p;(0,$0.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,kn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,kn._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,kn.Name)})})}}};ka.default=x0});var xm=v(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var k0=q(),z0={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,k0.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};za.default=z0});var Sm=v(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var zn=I(),zm=q(),S0={message:({params:t})=>(0,zn.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,zn._)`{failingKeyword: ${t.ifClause}}`},P0={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:S0,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,zm.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=km(o,"then"),s=km(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,zn.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,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,zn._)`${l}`):t.setParams({ifClause:l})}}}};function km(t,e){let r=t.schema[e];return r!==void 0&&!(0,zm.alwaysValidSchema)(t,r)}Sa.default=P0});var Pm=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var T0=q(),E0={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,T0.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Pa.default=E0});var Tm=v(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var R0=la(),O0=nm(),I0=da(),N0=im(),A0=am(),Z0=lm(),C0=pm(),j0=ya(),D0=hm(),q0=bm(),M0=vm(),L0=$m(),U0=wm(),F0=xm(),V0=Sm(),B0=Pm();function J0(t=!1){let e=[M0.default,L0.default,U0.default,F0.default,V0.default,B0.default,C0.default,j0.default,Z0.default,D0.default,q0.default];return t?e.push(O0.default,N0.default):e.push(R0.default,I0.default),e.push(A0.default),e}Ta.default=J0});var Em=v(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var oe=I(),H0={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},W0={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:H0,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),_=r.const("fDef",(0,oe._)`${m}[${i}]`),y=r.let("fType"),b=r.let("format");r.if((0,oe._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${_}.type || "string"`).assign(b,(0,oe._)`${_}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(b,_)),t.fail$data((0,oe.or)(P(),x()));function P(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${b}`}function x(){let S=l.$async?(0,oe._)`(${_}.async ? await ${b}(${o}) : ${b}(${o}))`:(0,oe._)`${b}(${o})`,w=(0,oe._)`(typeof ${b} == "function" ? ${S} : ${b}.test(${o}))`;return(0,oe._)`${b} && ${b} !== true && ${y} === ${e} && !${w}`}}function f(){let m=d.formats[s];if(!m){P();return}if(m===!0)return;let[_,y,b]=x(m);_===e&&t.pass(S());function P(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function x(w){let ke=w instanceof RegExp?(0,oe.regexpCode)(w):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Te=r.scopeValue("formats",{key:s,ref:w,code:ke});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,oe._)`${Te}.validate`]:["string",w,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 ${b}(${o})`}return typeof y=="function"?(0,oe._)`${b}(${o})`:(0,oe._)`${b}.test(${o})`}}}};Ea.default=W0});var Rm=v(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var G0=Em(),K0=[G0.default];Ra.default=K0});var Om=v(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.contentVocabulary=er.metadataVocabulary=void 0;er.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];er.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Nm=v(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Q0=Mf(),Y0=em(),X0=Tm(),ex=Rm(),Im=Om(),tx=[Q0.default,Y0.default,(0,X0.default)(),ex.default,Im.metadataVocabulary,Im.contentVocabulary];Oa.default=tx});var Zm=v(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.DiscrError=void 0;var Am;(function(t){t.Tag="tag",t.Mapping="mapping"})(Am||(Sn.DiscrError=Am={}))});var jm=v(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var tr=I(),Ia=Zm(),Cm=un(),rx=Gr(),ox=q(),nx={message:({params:{discrError:t,tagName:e}})=>t===Ia.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,tr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},sx={keyword:"discriminator",type:"object",schemaType:"object",error:nx,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,tr._)`${r}${(0,tr.getProperty)(a)}`);e.if((0,tr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Ia.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,tr._)`${u} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:Ia.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),_=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(_,tr.Name),m}function p(){var f;let m={},_=b(n),y=!0;for(let S=0;S<i.length;S++){let w=i[S];if(w?.$ref&&!(0,ox.schemaHasRulesButRef)(w,s.self.RULES)){let Te=w.$ref;if(w=Cm.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Te),w instanceof Cm.SchemaEnv&&(w=w.schema),w===void 0)throw new rx.default(s.opts.uriResolver,s.baseId,Te)}let ke=(f=w?.properties)===null||f===void 0?void 0:f[a];if(typeof ke!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||b(w)),P(ke,S)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function b({required:S}){return Array.isArray(S)&&S.includes(a)}function P(S,w){if(S.const)x(S.const,w);else if(S.enum)for(let ke of S.enum)x(ke,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(S,w){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[S]=w}}}};Na.default=sx});var Dm=v((rO,ix)=>{ix.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 Za=v((Q,Aa)=>{"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 ax=Af(),cx=Nm(),ux=jm(),qm=Dm(),lx=["/properties"],Pn="http://json-schema.org/draft-07/schema",rr=class extends ax.default{_addVocabularies(){super._addVocabularies(),cx.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(ux.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(qm,lx):qm;this.addMetaSchema(e,Pn,!1),this.refs["http://json-schema.org/schema"]=Pn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Pn)?Pn:void 0)}};Q.Ajv=rr;Aa.exports=Q=rr;Aa.exports.Ajv=rr;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=rr;var dx=Wr();Object.defineProperty(Q,"KeywordCxt",{enumerable:!0,get:function(){return dx.KeywordCxt}});var or=I();Object.defineProperty(Q,"_",{enumerable:!0,get:function(){return or._}});Object.defineProperty(Q,"str",{enumerable:!0,get:function(){return or.str}});Object.defineProperty(Q,"stringify",{enumerable:!0,get:function(){return or.stringify}});Object.defineProperty(Q,"nil",{enumerable:!0,get:function(){return or.nil}});Object.defineProperty(Q,"Name",{enumerable:!0,get:function(){return or.Name}});Object.defineProperty(Q,"CodeGen",{enumerable:!0,get:function(){return or.CodeGen}});var px=an();Object.defineProperty(Q,"ValidationError",{enumerable:!0,get:function(){return px.default}});var fx=Gr();Object.defineProperty(Q,"MissingRefError",{enumerable:!0,get:function(){return fx.default}})});var Hm=v(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.formatNames=We.fastFormats=We.fullFormats=void 0;function He(t,e){return{validate:t,compare:e}}We.fullFormats={date:He(Fm,qa),time:He(ja(!0),Ma),"date-time":He(Mm(!0),Bm),"iso-time":He(ja(),Vm),"iso-date-time":He(Mm(),Jm),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:bx,"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:Sx,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:vx,int32:{type:"number",validate:xx},int64:{type:"number",validate:kx},float:{type:"number",validate:Um},double:{type:"number",validate:Um},password:!0,binary:!0};We.fastFormats={...We.fullFormats,date:He(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,qa),time:He(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ma),"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,Bm),"iso-time":He(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Vm),"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,Jm),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 mx(t){return t%4===0&&(t%100!==0||t%400===0)}var hx=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gx=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Fm(t){let e=hx.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&&mx(r)?29:gx[o])}function qa(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Ca=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function ja(t){return function(r){let o=Ca.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 d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ma(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 Vm(t,e){if(!(t&&e))return;let r=Ca.exec(t),o=Ca.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 Da=/t|\s/i;function Mm(t){let e=ja(t);return function(o){let n=o.split(Da);return n.length===2&&Fm(n[0])&&e(n[1])}}function Bm(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function Jm(t,e){if(!(t&&e))return;let[r,o]=t.split(Da),[n,s]=e.split(Da),i=qa(r,n);if(i!==void 0)return i||Ma(o,s)}var _x=/\/|:/,yx=/^(?:[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 bx(t){return _x.test(t)&&yx.test(t)}var Lm=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function vx(t){return Lm.lastIndex=0,Lm.test(t)}var $x=-(2**31),wx=2**31-1;function xx(t){return Number.isInteger(t)&&t<=wx&&t>=$x}function kx(t){return Number.isInteger(t)}function Um(){return!0}var zx=/[^\\]\\Z/;function Sx(t){if(zx.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Wm=v(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.formatLimitDefinition=void 0;var Px=Za(),Le=I(),_t=Le.operators,Tn={formatMaximum:{okStr:"<=",ok:_t.LTE,fail:_t.GT},formatMinimum:{okStr:">=",ok:_t.GTE,fail:_t.LT},formatExclusiveMaximum:{okStr:"<",ok:_t.LT,fail:_t.GTE},formatExclusiveMinimum:{okStr:">",ok:_t.GT,fail:_t.LTE}},Tx={message:({keyword:t,schemaCode:e})=>(0,Le.str)`should be ${Tn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Le._)`{comparison: ${Tn[t].okStr}, limit: ${e}}`};nr.formatLimitDefinition={keyword:Object.keys(Tn),type:"string",schemaType:"string",$data:!0,error:Tx,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 Px.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Le._)`${p}[${c.schemaCode}]`);t.fail$data((0,Le.or)((0,Le._)`typeof ${f} != "object"`,(0,Le._)`${f} instanceof RegExp`,(0,Le._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,Le._)`${i.code.formats}${(0,Le.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,Le._)`${p}.compare(${r}, ${o}) ${Tn[n].fail} 0`}},dependencies:["format"]};var Ex=t=>(t.addKeyword(nr.formatLimitDefinition),t);nr.default=Ex});var Ym=v((uo,Qm)=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});var sr=Hm(),Rx=Wm(),La=I(),Gm=new La.Name("fullFormats"),Ox=new La.Name("fastFormats"),Ua=(t,e={keywords:!0})=>{if(Array.isArray(e))return Km(t,e,sr.fullFormats,Gm),t;let[r,o]=e.mode==="fast"?[sr.fastFormats,Ox]:[sr.fullFormats,Gm],n=e.formats||sr.formatNames;return Km(t,n,r,o),e.keywords&&(0,Rx.default)(t),t};Ua.get=(t,e="full")=>{let o=(e==="fast"?sr.fastFormats:sr.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function Km(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,La._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}Qm.exports=uo=Ua;Object.defineProperty(uo,"__esModule",{value:!0});uo.default=Ua});var Ha;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 d=0;d<l.length;d++){let p=l[d];p in a||(a[p]=u[p].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 Fe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ot=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Ha=globalThis).__zod_globalConfig??(Ha.__zod_globalConfig={});var It=globalThis.__zod_globalConfig;function ze(t){return t&&Object.assign(It,t),It}var D={};Ba(D,{BIGINT_FORMAT_RANGES:()=>Qa,Class:()=>Dn,NUMBER_FORMAT_RANGES:()=>Vn,aborted:()=>st,allowsEval:()=>Ln,assert:()=>gh,assertEqual:()=>ph,assertIs:()=>mh,assertNever:()=>hh,assertNotEqual:()=>fh,assignProp:()=>ot,base64ToUint8Array:()=>Xa,base64urlToUint8Array:()=>Nh,cached:()=>At,captureStackTrace:()=>mo,cleanEnum:()=>Ih,cleanRegex:()=>dr,clone:()=>Ce,cloneDef:()=>yh,createTransparentProxy:()=>kh,defineLazy:()=>U,esc:()=>fo,escapeRegex:()=>Ke,explicitlyAborted:()=>Bn,extend:()=>Ph,finalizeIssue:()=>Ee,floatSafeRemainder:()=>qn,getElementAtPath:()=>bh,getEnumValues:()=>ur,getLengthableOrigin:()=>pr,getParsedType:()=>xh,getSizableOrigin:()=>Ya,hexToUint8Array:()=>Zh,isObject:()=>yt,isPlainObject:()=>nt,issue:()=>Zt,joinValues:()=>po,jsonStringifyReplacer:()=>Nt,merge:()=>Eh,mergeDefs:()=>Ge,normalizeParams:()=>T,nullish:()=>lr,numKeys:()=>wh,objectClone:()=>_h,omit:()=>Sh,optionalKeys:()=>Fn,parsedType:()=>Jn,partial:()=>Rh,pick:()=>zh,prefixIssues:()=>Qe,primitiveTypes:()=>Ka,promiseAllObject:()=>vh,propertyKeyTypes:()=>Un,randomString:()=>$h,required:()=>Oh,safeExtend:()=>Th,shallowClone:()=>Ga,slugify:()=>Mn,stringifyPrimitive:()=>ho,uint8ArrayToBase64:()=>ec,uint8ArrayToBase64url:()=>Ah,uint8ArrayToHex:()=>Ch,unwrapMessage:()=>cr});function ph(t){return t}function fh(t){return t}function mh(t){}function hh(t){throw new Error("Unexpected value in exhaustive check")}function gh(t){}function ur(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=>ho(r)).join(e)}function Nt(t,e){return typeof e=="bigint"?e.toString():e}function At(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function lr(t){return t==null}function dr(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function qn(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 Wa=Symbol("evaluating");function U(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==Wa)return o===void 0&&(o=Wa,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function _h(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ot(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ge(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function yh(t){return Ge(t._zod.def)}function bh(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function vh(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 $h(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function fo(t){return JSON.stringify(t)}function Mn(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mo="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function yt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Ln=At(()=>{if(It.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function nt(t){if(yt(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(yt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ga(t){return nt(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function wh(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var xh=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}`)}},Un=new Set(["string","number","symbol"]),Ka=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ke(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ce(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function T(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 kh(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 ho(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Fn(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Vn={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]},Qa={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zh(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=Ge(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 ot(this,"shape",i),i},checks:[]});return Ce(t,s)}function Sh(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=Ge(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 ot(this,"shape",i),i},checks:[]});return Ce(t,s)}function Ph(t,e){if(!nt(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=Ge(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return ot(this,"shape",s),s}});return Ce(t,n)}function Th(t,e){if(!nt(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ge(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return ot(this,"shape",o),o}});return Ce(t,r)}function Eh(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=Ge(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return ot(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Ce(t,r)}function Rh(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=Ge(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 ot(this,"shape",c),c},checks:[]});return Ce(e,i)}function Oh(t,e,r){let o=Ge(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 ot(this,"shape",s),s}});return Ce(e,o)}function st(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 Bn(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 Qe(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function cr(t){return typeof t=="string"?t:t?.message}function Ee(t,e,r){let o=t.message?t.message:cr(t.inst?._zod.def?.error?.(t))??cr(e?.error?.(t))??cr(r.customError?.(t))??cr(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 Ya(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function pr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Jn(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 Zt(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Ih(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Xa(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 ec(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Nh(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Xa(e+r)}function Ah(t){return ec(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Zh(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 Ch(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Dn=class{constructor(...e){}};var tc=(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,Nt,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},go=g("$ZodError",tc),Hn=g("$ZodError",tc,{Parent:Error});function rc(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 oc(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 _o=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 Fe;if(i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Ee(c,s,ze())));throw mo(a,n?.callee),a}return i.value};var yo=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=>Ee(c,s,ze())));throw mo(a,n?.callee),a}return i.value};var fr=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 Fe;return s.issues.length?{success:!1,error:new(t??go)(s.issues.map(i=>Ee(i,n,ze())))}:{success:!0,data:s.value}},mr=fr(Hn),hr=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=>Ee(i,n,ze())))}:{success:!0,data:s.value}},bo=hr(Hn),nc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return _o(t)(e,r,n)};var sc=t=>(e,r,o)=>_o(t)(e,r,o);var ic=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return yo(t)(e,r,n)};var ac=t=>async(e,r,o)=>yo(t)(e,r,o);var cc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return fr(t)(e,r,n)};var uc=t=>(e,r,o)=>fr(t)(e,r,o);var lc=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return hr(t)(e,r,n)};var dc=t=>async(e,r,o)=>hr(t)(e,r,o);var pc=/^[cC][0-9a-z]{6,}$/,fc=/^[0-9a-z]+$/,mc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hc=/^[0-9a-vA-V]{20}$/,gc=/^[A-Za-z0-9]{27}$/,_c=/^[a-zA-Z0-9_-]{21}$/,yc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var bc=/^([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})$/,Wn=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 vc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Dh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $c(){return new RegExp(Dh,"u")}var wc=/^(?:(?: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 kc=/^((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])$/,zc=/^(([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])$/,Sc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gn=/^[A-Za-z0-9_-]*$/;var Pc=/^https?$/,Tc=/^\+[1-9]\d{6,14}$/,Ec="(?:(?:\\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])))",Rc=new RegExp(`^${Ec}$`);function Oc(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 Ic(t){return new RegExp(`^${Oc(t)}$`)}function Nc(t){let e=Oc({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(`^${Ec}T(?:${o})$`)}var Ac=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Zc=/^-?\d+$/,Kn=/^-?\d+(?:\.\d+)?$/,Cc=/^(?:true|false)$/i,jc=/^null$/i;var Dc=/^[^A-Z]*$/,qc=/^[^a-z]*$/;var ie=g("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Mc={number:"number",bigint:"bigint",object:"date"},Qn=g("$ZodCheckLessThan",(t,e)=>{ie.init(t,e);let r=Mc[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})}}),Yn=g("$ZodCheckGreaterThan",(t,e)=>{ie.init(t,e);let r=Mc[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})}}),Lc=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):qn(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})}}),Uc=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]=Vn[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=Zc)}),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 Fc=g("$ZodCheckMaxLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(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=pr(n);o.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Vc=g("$ZodCheckMinLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(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=pr(n);o.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Bc=g("$ZodCheckLengthEquals",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(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=pr(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})}}),gr=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=()=>{})}),Jc=g("$ZodCheckRegex",(t,e)=>{gr.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})}}),Hc=g("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Dc),gr.init(t,e)}),Wc=g("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=qc),gr.init(t,e)}),Gc=g("$ZodCheckIncludes",(t,e)=>{ie.init(t,e);let r=Ke(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})}}),Kc=g("$ZodCheckStartsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`^${Ke(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})}}),Qc=g("$ZodCheckEndsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`.*${Ke(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 Yc=g("$ZodCheckOverwrite",(t,e)=>{ie.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var $o=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
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 eu={major:4,minor:4,patch:3};var
|
|
11
|
+
`))}};var eu={major:4,minor:4,patch:3};var H=g("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=eu;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=st(i),l;for(let d of a){if(d._zod.def.when){if(Bn(i)||!d._zod.def.when(i))continue}else if(u)continue;let p=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Fe;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==p&&(u||(u=st(i,p)))});else{if(i.issues.length===p)continue;u||(u=st(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(st(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Fe;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 Fe;return c.then(u=>n(u,o,a))}return n(c,o,a)}}U(t,"~standard",()=>({validate:n=>{try{let s=mr(t,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return bo(t,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ko=g("$ZodString",(t,e)=>{H.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Ac(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}}),W=g("$ZodStringFormat",(t,e)=>{gr.init(t,e),ko.init(t,e)}),uu=g("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=bc),W.init(t,e)}),lu=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=Wn(o))}else e.pattern??(e.pattern=Wn());W.init(t,e)}),du=g("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=vc),W.init(t,e)}),pu=g("$ZodURL",(t,e)=>{W.init(t,e),t._zod.check=r=>{try{let o=r.value.trim();if(!e.normalize&&e.protocol?.source===Pc.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})}}}),fu=g("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=$c()),W.init(t,e)}),mu=g("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=_c),W.init(t,e)}),hu=g("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=pc),W.init(t,e)}),gu=g("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=fc),W.init(t,e)}),_u=g("$ZodULID",(t,e)=>{e.pattern??(e.pattern=mc),W.init(t,e)}),yu=g("$ZodXID",(t,e)=>{e.pattern??(e.pattern=hc),W.init(t,e)}),bu=g("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=gc),W.init(t,e)}),vu=g("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Nc(e)),W.init(t,e)}),$u=g("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Rc),W.init(t,e)}),wu=g("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Ic(e)),W.init(t,e)}),xu=g("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=yc),W.init(t,e)}),ku=g("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=wc),W.init(t,e),t._zod.bag.format="ipv4"}),zu=g("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=xc),W.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 Su=g("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=kc),W.init(t,e)}),Pu=g("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=zc),W.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 Tu(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Eu=g("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Sc),W.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{Tu(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Lh(t){if(!Gn.test(t))return!1;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Tu(r)}var Ru=g("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Gn),W.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Lh(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Ou=g("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Tc),W.init(t,e)});function Uh(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 Iu=g("$ZodJWT",(t,e)=>{W.init(t,e),t._zod.check=r=>{Uh(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var es=g("$ZodNumber",(t,e)=>{H.init(t,e),t._zod.pattern=t._zod.bag.pattern??Kn,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}}),Nu=g("$ZodNumberFormat",(t,e)=>{Uc.init(t,e),es.init(t,e)}),Au=g("$ZodBoolean",(t,e)=>{H.init(t,e),t._zod.pattern=Cc,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 Zu=g("$ZodNull",(t,e)=>{H.init(t,e),t._zod.pattern=jc,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 Cu=g("$ZodUnknown",(t,e)=>{H.init(t,e),t._zod.parse=r=>r}),ju=g("$ZodNever",(t,e)=>{H.init(t,e),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function tu(t,e,r){t.issues.length&&e.issues.push(...Qe(r,t.issues)),e.value[r]=t.value}var Du=g("$ZodArray",(t,e)=>{H.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=>tu(u,r,i))):tu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function xo(t,e,r,o,n,s){let i=r in o;if(t.issues.length){if(n&&s&&!i)return;e.issues.push(...Qe(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 qu(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=Fn(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Mu(t,e,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let p in e){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}let f=c.run({value:e[p],issues:[]},o);f instanceof Promise?t.push(f.then(m=>xo(m,r,p,e,l,d))):xo(f,r,p,e,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}var Fh=g("$ZodObject",(t,e)=>{if(H.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=At(()=>qu(e));U(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 d of l.values)c[u].add(d)}}return c});let n=yt,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=[],d=i.shape;for(let p of i.keys){let f=d[p],m=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[p],issues:[]},c);y instanceof Promise?l.push(y.then(b=>xo(b,a,p,u,m,_))):xo(y,a,p,u,m,_)}return s?Mu(l,u,a,c,o.value,t):l.length?Promise.all(l).then(()=>a):a}}),Lu=g("$ZodObjectJIT",(t,e)=>{Fh.init(t,e);let r=t._zod.parse,o=At(()=>qu(e)),n=p=>{let f=new $o(["shape","payload","ctx"]),m=o.value,_=x=>{let S=fo(x);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),b=0;for(let x of m.keys)y[x]=`key_${b++}`;f.write("const newResult = {};");for(let x of m.keys){let S=y[x],w=fo(x),ke=p[x],Te=ke?._zod?.optin==="optional",ir=ke?._zod?.optout==="optional";f.write(`const ${S} = ${_(x)};`),Te&&ir?f.write(`
|
|
12
12
|
if (${S}.issues.length) {
|
|
13
|
-
if (${
|
|
13
|
+
if (${w} in input) {
|
|
14
14
|
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
15
15
|
...iss,
|
|
16
|
-
path: iss.path ? [${
|
|
16
|
+
path: iss.path ? [${w}, ...iss.path] : [${w}]
|
|
17
17
|
})));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
if (${S}.value === undefined) {
|
|
22
|
-
if (${
|
|
23
|
-
newResult[${
|
|
22
|
+
if (${w} in input) {
|
|
23
|
+
newResult[${w}] = undefined;
|
|
24
24
|
}
|
|
25
25
|
} else {
|
|
26
|
-
newResult[${
|
|
26
|
+
newResult[${w}] = ${S}.value;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
`):
|
|
29
|
+
`):Te?f.write(`
|
|
30
30
|
if (${S}.issues.length) {
|
|
31
31
|
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
32
32
|
...iss,
|
|
33
|
-
path: iss.path ? [${
|
|
33
|
+
path: iss.path ? [${w}, ...iss.path] : [${w}]
|
|
34
34
|
})));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (${S}.value === undefined) {
|
|
38
|
-
if (${
|
|
39
|
-
newResult[${
|
|
38
|
+
if (${w} in input) {
|
|
39
|
+
newResult[${w}] = undefined;
|
|
40
40
|
}
|
|
41
41
|
} else {
|
|
42
|
-
newResult[${
|
|
42
|
+
newResult[${w}] = ${S}.value;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
`):f.write(`
|
|
46
|
-
const ${S}_present = ${
|
|
46
|
+
const ${S}_present = ${w} in input;
|
|
47
47
|
if (${S}.issues.length) {
|
|
48
48
|
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
49
49
|
...iss,
|
|
50
|
-
path: iss.path ? [${
|
|
50
|
+
path: iss.path ? [${w}, ...iss.path] : [${w}]
|
|
51
51
|
})));
|
|
52
52
|
}
|
|
53
53
|
if (!${S}_present && !${S}.issues.length) {
|
|
@@ -55,84 +55,310 @@ var ih=Object.create;var An=Object.defineProperty;var ah=Object.getOwnPropertyDe
|
|
|
55
55
|
code: "invalid_type",
|
|
56
56
|
expected: "nonoptional",
|
|
57
57
|
input: undefined,
|
|
58
|
-
path: [${
|
|
58
|
+
path: [${w}]
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
if (${S}_present) {
|
|
63
63
|
if (${S}.value === undefined) {
|
|
64
|
-
newResult[${
|
|
64
|
+
newResult[${w}] = undefined;
|
|
65
65
|
} else {
|
|
66
|
-
newResult[${
|
|
66
|
+
newResult[${w}] = ${S}.value;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
`)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(w,S)=>P(p,w,S)},s,i=yt,a=!It.jitless,u=a&&Ln.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=o.value);let m=p.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(e.shape)),p=s(p,f),l?Mu([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function ru(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=>!st(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=>Te(i,o,ke())))}),e)}var ts=g("$ZodUnion",(t,e)=>{K.init(t,e),U(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),U(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),U(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),U(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=>dr(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=>ru(a,o,t,n)):ru(i,o,t,n)}});var Uu=g("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ts.init(t,e);let r=t._zod.parse;U(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=jt(()=>{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(!yt(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)}}),Fu=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])=>ou(r,c,u)):ou(r,s,i)}});function Xn(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(nt(t)&&nt(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=Xn(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=Xn(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 ou(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}),st(t))return t;let i=Xn(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 Vu=g("$ZodRecord",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!nt(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=>Te(f,o,ke())),input:u,path:[u],inst:t});continue}let d=l.value,p=e.valueType._zod.run({value:n[u],issues:[]},o);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&r.issues.push(...Ye(u,f.issues)),r.value[d]=f.value})):(p.issues.length&&r.issues.push(...Ye(u,p.issues)),r.value[d]=p.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"&&Wn.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Te(d,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(d=>{d.issues.length&&r.issues.push(...Ye(a,d.issues)),r.value[c.value]=d.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 Ju=g("$ZodEnum",(t,e)=>{K.init(t,e);let r=ur(e.entries),o=new Set(r);t._zod.values=o,t._zod.pattern=new RegExp(`^(${r.filter(n=>Un.has(typeof n)).map(n=>typeof n=="string"?We(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}}),Hu=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"?We(o):o?We(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 Ku=g("$ZodTransform",(t,e)=>{K.init(t,e),t._zod.optin="optional",t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Rt(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 Ue;return r.value=n,r.fallback=!0,r}});function nu(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var rs=g("$ZodOptional",(t,e)=>{K.init(t,e),t._zod.optin="optional",t._zod.optout="optional",U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${dr(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=>nu(i,n)):nu(s,n)}return r.value===void 0?r:e.innerType._zod.run(r,o)}}),Bu=g("$ZodExactOptional",(t,e)=>{rs.init(t,e),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,o)=>e.innerType._zod.run(r,o)}),Gu=g("$ZodNullable",(t,e)=>{K.init(t,e),U(t._zod,"optin",()=>e.innerType._zod.optin),U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${dr(r.source)}|null)$`):void 0}),U(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)}),Wu=g("$ZodDefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",U(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=>su(s,e)):su(n,e)}});function su(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Yu=g("$ZodPrefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",U(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))}),Qu=g("$ZodNonOptional",(t,e)=>{K.init(t,e),U(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=>iu(s,t)):iu(n,t)}});function iu(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 Xu=g("$ZodCatch",(t,e)=>{K.init(t,e),t._zod.optin="optional",U(t._zod,"optout",()=>e.innerType._zod.optout),U(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=>Te(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=>Te(s,o,ke()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var os=g("$ZodPipe",(t,e)=>{K.init(t,e),U(t._zod,"values",()=>e.in._zod.values),U(t._zod,"optin",()=>e.in._zod.optin),U(t._zod,"optout",()=>e.out._zod.optout),U(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 el=g("$ZodPreprocess",(t,e)=>{os.init(t,e)}),tl=g("$ZodReadonly",(t,e)=>{K.init(t,e),U(t._zod,"propValues",()=>e.innerType._zod.propValues),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"optin",()=>e.innerType?._zod?.optin),U(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(au):au(n)}});function au(t){return t.value=Object.freeze(t.value),t}var rl=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=>cu(s,r,o,t));cu(n,r,o,t)}});function cu(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(Zt(n))}}var Vh=()=>{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=Hn(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${ho(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 ol(){return{localeError:Vh()}}var nl;var ns=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 Jh(){return new ns}(nl=globalThis).__zod_globalRegistry??(nl.__zod_globalRegistry=Jh());var vt=globalThis.__zod_globalRegistry;function sl(t,e){return new t({type:"string",...E(e)})}function il(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function ss(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function cl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function ul(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function ll(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function dl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function pl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function fl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function ml(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function hl(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function gl(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function _l(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function yl(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function vl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function bl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function $l(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function zl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function wl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function xl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function kl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function Sl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function Pl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function El(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function Tl(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function Ol(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function Rl(t,e){return new t({type:"number",checks:[],...E(e)})}function Il(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function Nl(t,e){return new t({type:"boolean",...E(e)})}function jl(t,e){return new t({type:"null",...E(e)})}function Zl(t){return new t({type:"unknown"})}function Al(t,e){return new t({type:"never",...E(e)})}function ko(t,e){return new Yn({check:"less_than",...E(e),value:t,inclusive:!1})}function _r(t,e){return new Yn({check:"less_than",...E(e),value:t,inclusive:!0})}function So(t,e){return new Qn({check:"greater_than",...E(e),value:t,inclusive:!1})}function yr(t,e){return new Qn({check:"greater_than",...E(e),value:t,inclusive:!0})}function Po(t,e){return new Lc({check:"multiple_of",...E(e),value:t})}function Eo(t,e){return new Fc({check:"max_length",...E(e),maximum:t})}function At(t,e){return new Vc({check:"min_length",...E(e),minimum:t})}function To(t,e){return new Jc({check:"length_equals",...E(e),length:t})}function is(t,e){return new Hc({check:"string_format",format:"regex",...E(e),pattern:t})}function as(t){return new Kc({check:"string_format",format:"lowercase",...E(t)})}function cs(t){return new Bc({check:"string_format",format:"uppercase",...E(t)})}function us(t,e){return new Gc({check:"string_format",format:"includes",...E(e),includes:t})}function ls(t,e){return new Wc({check:"string_format",format:"starts_with",...E(e),prefix:t})}function ds(t,e){return new Yc({check:"string_format",format:"ends_with",...E(e),suffix:t})}function it(t){return new Qc({check:"overwrite",tx:t})}function ps(t){return it(e=>e.normalize(t))}function fs(){return it(t=>t.trim())}function ms(){return it(t=>t.toLowerCase())}function hs(){return it(t=>t.toUpperCase())}function gs(){return it(t=>Mn(t))}function Cl(t,e,r){return new t({type:"array",element:e,...E(r)})}function ql(t,e,r){let o=E(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function Dl(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function Ml(t,e){let r=Hh(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))}},t(o.value,o)),e);return r}function Hh(t,e){let r=new ie({check:"custom",...E(e)});return r._zod.check=t,r}function _s(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??vt,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 p=i.schema,f=e.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(i.ref||(i.ref=d),re(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&he(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 ys(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 d=t.external.registry.get(i[0])?.id,p=t.external.uri??(m=>m);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__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 d in l)delete l[d];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
|
-
|
|
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 vs(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},d=c.ref;if(c.ref=null,d){o(d);let f=t.seen.get(d),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===d)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 p=a._zod.parent;if(p&&p!==d){o(p);let f=t.seen.get(p);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:vr(e,"input",t.processors),output:vr(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function he(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 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 t._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 Ll=(t,e={})=>r=>{let o=_s({...r,processors:e});return re(t,o),ys(o,t),vs(o,t)},vr=(t,e,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=_s({...n??{},target:s,io:e,processors:r});return re(t,i),ys(i,t),vs(i,t)};var Kh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ul=(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=Kh[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Fl=(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 d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";d?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),p?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},Vl=(t,e,r,o)=>{r.type="boolean"};var Jl=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Hl=(t,e,r,o)=>{r.not={}};var Kl=(t,e,r,o)=>{};var Bl=(t,e,r,o)=>{let n=t._zod.def,s=ur(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Gl=(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 Wl=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Yl=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Ql=(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"]})},Xl=(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)},ed=(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},td=(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 rd=(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 d of c)n.patternProperties[d.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(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},od=(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"}]},nd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType},sd=(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))},id=(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)))},ad=(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},cd=(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},ud=(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 bs=(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 Ct(t){return!!t._zod}function at(t,e){return Ct(t)?mr(t,e):t.safeParse(e)}function Oo(t){if(!t)return;let e;if(Ct(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ld(t){if(Ct(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 $r={};Ja($r,{ZodISODate:()=>pd,ZodISODateTime:()=>dd,ZodISODuration:()=>md,ZodISOTime:()=>fd,date:()=>zs,datetime:()=>$s,duration:()=>xs,time:()=>ws});var dd=g("ZodISODateTime",(t,e)=>{bu.init(t,e),Q.init(t,e)});function $s(t){return Pl(dd,t)}var pd=g("ZodISODate",(t,e)=>{$u.init(t,e),Q.init(t,e)});function zs(t){return El(pd,t)}var fd=g("ZodISOTime",(t,e)=>{zu.init(t,e),Q.init(t,e)});function ws(t){return Tl(fd,t)}var md=g("ZodISODuration",(t,e)=>{wu.init(t,e),Q.init(t,e)});function xs(t){return Ol(md,t)}var rg=(t,e)=>{go.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>oc(t,r)},flatten:{value:r=>rc(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Nt,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Nt,2)}},isEmpty:{get(){return t.issues.length===0}}})};var Se=g("ZodError",rg,{Parent:Error});var hd=_o(Se),gd=yo(Se),_d=fr(Se),yd=hr(Se),vd=nc(Se),bd=sc(Se),$d=ic(Se),zd=ac(Se),wd=cc(Se),xd=uc(Se),kd=lc(Se),Sd=dc(Se);var Pd=new WeakMap;function zr(t,e,r){let o=Object.getPrototypeOf(t),n=Pd.get(o);if(n||(n=new Set,Pd.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:vr(t,"input"),output:vr(t,"output")}}),t.toJSONSchema=Ll(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,o)=>hd(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>_d(t,r,o),t.parseAsync=async(r,o)=>gd(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>yd(t,r,o),t.spa=t.safeParseAsync,t.encode=(r,o)=>vd(t,r,o),t.decode=(r,o)=>bd(t,r,o),t.encodeAsync=async(r,o)=>$d(t,r,o),t.decodeAsync=async(r,o)=>zd(t,r,o),t.safeEncode=(r,o)=>wd(t,r,o),t.safeDecode=(r,o)=>xd(t,r,o),t.safeEncodeAsync=async(r,o)=>kd(t,r,o),t.safeDecodeAsync=async(r,o)=>Sd(t,r,o),zr(t,"ZodType",{check(...r){let o=this.def;return this.clone(q.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ae(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(Hg(r,o))},superRefine(r,o){return this.check(Kg(r,o))},overwrite(r){return this.check(it(r))},optional(){return ee(this)},exactOptional(){return jg(this)},nullable(){return Rd(this)},nullish(){return ee(Rd(this))},nonoptional(r){return Mg(this,r)},array(){return A(this)},or(r){return G([this,r])},and(r){return Io(this,r)},transform(r){return Id(this,qd(r))},default(r){return Cg(this,r)},prefault(r){return Dg(this,r)},catch(r){return Ug(this,r)},pipe(r){return Id(this,r)},readonly(){return Jg(this)},describe(r){let o=this.clone();return vt.add(o,{description:r}),o},meta(...r){if(r.length===0)return vt.get(this);let o=this.clone();return vt.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 vt.get(t)?.description},configurable:!0}),t)),Nd=g("_ZodString",(t,e)=>{xo.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Ul(t,o,n,s);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,zr(t,"_ZodString",{regex(...o){return this.check(is(...o))},includes(...o){return this.check(us(...o))},startsWith(...o){return this.check(ls(...o))},endsWith(...o){return this.check(ds(...o))},min(...o){return this.check(At(...o))},max(...o){return this.check(Eo(...o))},length(...o){return this.check(To(...o))},nonempty(...o){return this.check(At(1,...o))},lowercase(o){return this.check(as(o))},uppercase(o){return this.check(cs(o))},trim(){return this.check(fs())},normalize(...o){return this.check(ps(...o))},toLowerCase(){return this.check(ms())},toUpperCase(){return this.check(hs())},slugify(){return this.check(gs())}})}),ng=g("ZodString",(t,e)=>{xo.init(t,e),Nd.init(t,e),t.email=r=>t.check(il(sg,r)),t.url=r=>t.check(dl(ig,r)),t.jwt=r=>t.check(Sl($g,r)),t.emoji=r=>t.check(pl(ag,r)),t.guid=r=>t.check(ss(Ed,r)),t.uuid=r=>t.check(al(Ro,r)),t.uuidv4=r=>t.check(cl(Ro,r)),t.uuidv6=r=>t.check(ul(Ro,r)),t.uuidv7=r=>t.check(ll(Ro,r)),t.nanoid=r=>t.check(fl(cg,r)),t.guid=r=>t.check(ss(Ed,r)),t.cuid=r=>t.check(ml(ug,r)),t.cuid2=r=>t.check(hl(lg,r)),t.ulid=r=>t.check(gl(dg,r)),t.base64=r=>t.check(wl(yg,r)),t.base64url=r=>t.check(xl(vg,r)),t.xid=r=>t.check(_l(pg,r)),t.ksuid=r=>t.check(yl(fg,r)),t.ipv4=r=>t.check(vl(mg,r)),t.ipv6=r=>t.check(bl(hg,r)),t.cidrv4=r=>t.check($l(gg,r)),t.cidrv6=r=>t.check(zl(_g,r)),t.e164=r=>t.check(kl(bg,r)),t.datetime=r=>t.check($s(r)),t.date=r=>t.check(zs(r)),t.time=r=>t.check(ws(r)),t.duration=r=>t.check(xs(r))});function h(t){return sl(ng,t)}var Q=g("ZodStringFormat",(t,e)=>{B.init(t,e),Nd.init(t,e)}),sg=g("ZodEmail",(t,e)=>{du.init(t,e),Q.init(t,e)});var Ed=g("ZodGUID",(t,e)=>{uu.init(t,e),Q.init(t,e)});var Ro=g("ZodUUID",(t,e)=>{lu.init(t,e),Q.init(t,e)});var ig=g("ZodURL",(t,e)=>{pu.init(t,e),Q.init(t,e)});var ag=g("ZodEmoji",(t,e)=>{fu.init(t,e),Q.init(t,e)});var cg=g("ZodNanoID",(t,e)=>{mu.init(t,e),Q.init(t,e)});var ug=g("ZodCUID",(t,e)=>{hu.init(t,e),Q.init(t,e)});var lg=g("ZodCUID2",(t,e)=>{gu.init(t,e),Q.init(t,e)});var dg=g("ZodULID",(t,e)=>{_u.init(t,e),Q.init(t,e)});var pg=g("ZodXID",(t,e)=>{yu.init(t,e),Q.init(t,e)});var fg=g("ZodKSUID",(t,e)=>{vu.init(t,e),Q.init(t,e)});var mg=g("ZodIPv4",(t,e)=>{xu.init(t,e),Q.init(t,e)});var hg=g("ZodIPv6",(t,e)=>{ku.init(t,e),Q.init(t,e)});var gg=g("ZodCIDRv4",(t,e)=>{Su.init(t,e),Q.init(t,e)});var _g=g("ZodCIDRv6",(t,e)=>{Pu.init(t,e),Q.init(t,e)});var yg=g("ZodBase64",(t,e)=>{Tu.init(t,e),Q.init(t,e)});var vg=g("ZodBase64URL",(t,e)=>{Ou.init(t,e),Q.init(t,e)});var bg=g("ZodE164",(t,e)=>{Ru.init(t,e),Q.init(t,e)});var $g=g("ZodJWT",(t,e)=>{Iu.init(t,e),Q.init(t,e)});var jd=g("ZodNumber",(t,e)=>{es.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Fl(t,o,n,s),zr(t,"ZodNumber",{gt(o,n){return this.check(So(o,n))},gte(o,n){return this.check(yr(o,n))},min(o,n){return this.check(yr(o,n))},lt(o,n){return this.check(ko(o,n))},lte(o,n){return this.check(_r(o,n))},max(o,n){return this.check(_r(o,n))},int(o){return this.check(Td(o))},safe(o){return this.check(Td(o))},positive(o){return this.check(So(0,o))},nonnegative(o){return this.check(yr(0,o))},negative(o){return this.check(ko(0,o))},nonpositive(o){return this.check(_r(0,o))},multipleOf(o,n){return this.check(Po(o,n))},step(o,n){return this.check(Po(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 F(t){return Rl(jd,t)}var zg=g("ZodNumberFormat",(t,e)=>{Nu.init(t,e),jd.init(t,e)});function Td(t){return Il(zg,t)}var wg=g("ZodBoolean",(t,e)=>{ju.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Vl(t,r,o,n)});function se(t){return Nl(wg,t)}var xg=g("ZodNull",(t,e)=>{Zu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Jl(t,r,o,n)});function Zd(t){return jl(xg,t)}var kg=g("ZodUnknown",(t,e)=>{Au.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Kl(t,r,o,n)});function X(){return Zl(kg)}var Sg=g("ZodNever",(t,e)=>{Cu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Hl(t,r,o,n)});function Pg(t){return Al(Sg,t)}var Eg=g("ZodArray",(t,e)=>{qu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Ql(t,r,o,n),t.element=e.element,zr(t,"ZodArray",{min(r,o){return this.check(At(r,o))},nonempty(r){return this.check(At(1,r))},max(r,o){return this.check(Eo(r,o))},length(r,o){return this.check(To(r,o))},unwrap(){return this.element}})});function A(t,e){return Cl(Eg,t,e)}var Ad=g("ZodObject",(t,e)=>{Lu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Xl(t,r,o,n),q.defineLazy(t,"shape",()=>e.shape),zr(t,"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:Pg()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return q.extend(this,r)},safeExtend(r){return q.safeExtend(this,r)},merge(r){return q.merge(this,r)},pick(r){return q.pick(this,r)},omit(r){return q.omit(this,r)},partial(...r){return q.partial(Dd,this,r[0])},required(...r){return q.required(Md,this,r[0])}})});function $(t,e){let r={type:"object",shape:t??{},...q.normalizeParams(e)};return new Ad(r)}function ge(t,e){return new Ad({type:"object",shape:t,catchall:X(),...q.normalizeParams(e)})}var Cd=g("ZodUnion",(t,e)=>{ts.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ed(t,r,o,n),t.options=e.options});function G(t,e){return new Cd({type:"union",options:t,...q.normalizeParams(e)})}var Tg=g("ZodDiscriminatedUnion",(t,e)=>{Cd.init(t,e),Uu.init(t,e)});function Ss(t,e,r){return new Tg({type:"union",options:e,discriminator:t,...q.normalizeParams(r)})}var Og=g("ZodIntersection",(t,e)=>{Fu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>td(t,r,o,n)});function Io(t,e){return new Og({type:"intersection",left:t,right:e})}var Od=g("ZodRecord",(t,e)=>{Vu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>rd(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function H(t,e,r){return!e||!e._zod?new Od({type:"record",keyType:h(),valueType:t,...q.normalizeParams(e)}):new Od({type:"record",keyType:t,valueType:e,...q.normalizeParams(r)})}var ks=g("ZodEnum",(t,e)=>{Ju.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Bl(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 ks({...e,checks:[],...q.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 ks({...e,checks:[],...q.normalizeParams(n),entries:s})}});function ve(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new ks({type:"enum",entries:r,...q.normalizeParams(e)})}var Rg=g("ZodLiteral",(t,e)=>{Hu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Gl(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 x(t,e){return new Rg({type:"literal",values:Array.isArray(t)?t:[t],...q.normalizeParams(e)})}var Ig=g("ZodTransform",(t,e)=>{Ku.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Yl(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Rt(t.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(q.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(q.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 qd(t){return new Ig({type:"transform",transform:t})}var Dd=g("ZodOptional",(t,e)=>{rs.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>bs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new Dd({type:"optional",innerType:t})}var Ng=g("ZodExactOptional",(t,e)=>{Bu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>bs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function jg(t){return new Ng({type:"optional",innerType:t})}var Zg=g("ZodNullable",(t,e)=>{Gu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>od(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Rd(t){return new Zg({type:"nullable",innerType:t})}var Ag=g("ZodDefault",(t,e)=>{Wu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>sd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Cg(t,e){return new Ag({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():q.shallowClone(e)}})}var qg=g("ZodPrefault",(t,e)=>{Yu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>id(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Dg(t,e){return new qg({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():q.shallowClone(e)}})}var Md=g("ZodNonOptional",(t,e)=>{Qu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>nd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Mg(t,e){return new Md({type:"nonoptional",innerType:t,...q.normalizeParams(e)})}var Lg=g("ZodCatch",(t,e)=>{Xu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ad(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Ug(t,e){return new Lg({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Ld=g("ZodPipe",(t,e)=>{os.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>cd(t,r,o,n),t.in=e.in,t.out=e.out});function Id(t,e){return new Ld({type:"pipe",in:t,out:e})}var Fg=g("ZodPreprocess",(t,e)=>{Ld.init(t,e),el.init(t,e)}),Vg=g("ZodReadonly",(t,e)=>{tl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ud(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Jg(t){return new Vg({type:"readonly",innerType:t})}var Ud=g("ZodCustom",(t,e)=>{rl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Wl(t,r,o,n)});function Fd(t,e){return ql(Ud,t??(()=>!0),e)}function Hg(t,e={}){return Dl(Ud,t,e)}function Kg(t,e){return Ml(t,e)}function Ps(t,e){return new Fg({type:"pipe",in:qd(t),out:e})}ke(ol());var Ts="2025-11-25";var Vd=[Ts,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ct="io.modelcontextprotocol/related-task",jo="2.0",ne=Fd(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Jd=G([h(),F().int()]),Hd=h(),rS=ge({ttl:F().optional(),pollInterval:F().optional()}),Bg=$({ttl:F().optional()}),Gg=$({taskId:h()}),Os=ge({progressToken:Jd.optional(),[ct]:Gg.optional()}),Pe=$({_meta:Os.optional()}),wr=Pe.extend({task:Bg.optional()}),Kd=t=>wr.safeParse(t).success,ae=$({method:h(),params:Pe.loose().optional()}),Oe=$({_meta:Os.optional()}),Re=$({method:h(),params:Oe.loose().optional()}),ce=ge({_meta:Os.optional()}),Zo=G([h(),F().int()]),Bd=$({jsonrpc:x(jo),id:Zo,...ae.shape}).strict(),Rs=t=>Bd.safeParse(t).success,Gd=$({jsonrpc:x(jo),...Re.shape}).strict(),Wd=t=>Gd.safeParse(t).success,Is=$({jsonrpc:x(jo),id:Zo,result:ce}).strict(),xr=t=>Is.safeParse(t).success;var Z;(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"})(Z||(Z={}));var Ns=$({jsonrpc:x(jo),id:Zo.optional(),error:$({code:F().int(),message:h(),data:X().optional()})}).strict();var Yd=t=>Ns.safeParse(t).success;var Qd=G([Bd,Gd,Is,Ns]),oS=G([Is,Ns]),Ao=ce.strict(),Wg=Oe.extend({requestId:Zo.optional(),reason:h().optional()}),Co=Re.extend({method:x("notifications/cancelled"),params:Wg}),Yg=$({src:h(),mimeType:h().optional(),sizes:A(h()).optional(),theme:ve(["light","dark"]).optional()}),kr=$({icons:A(Yg).optional()}),qt=$({name:h(),title:h().optional()}),Xd=qt.extend({...qt.shape,...kr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),Qg=Io($({applyDefaults:se().optional()}),H(h(),X())),Xg=Ps(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Io($({form:Qg.optional(),url:ne.optional()}),H(h(),X()).optional())),e_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({sampling:ge({createMessage:ne.optional()}).optional(),elicitation:ge({create:ne.optional()}).optional()}).optional()}),t_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({tools:ge({call:ne.optional()}).optional()}).optional()}),r_=$({experimental:H(h(),ne).optional(),sampling:$({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:Xg.optional(),roots:$({listChanged:se().optional()}).optional(),tasks:e_.optional(),extensions:H(h(),ne).optional()}),o_=Pe.extend({protocolVersion:h(),capabilities:r_,clientInfo:Xd}),js=ae.extend({method:x("initialize"),params:o_});var n_=$({experimental:H(h(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:$({listChanged:se().optional()}).optional(),resources:$({subscribe:se().optional(),listChanged:se().optional()}).optional(),tools:$({listChanged:se().optional()}).optional(),tasks:t_.optional(),extensions:H(h(),ne).optional()}),s_=ce.extend({protocolVersion:h(),capabilities:n_,serverInfo:Xd,instructions:h().optional()}),Zs=Re.extend({method:x("notifications/initialized"),params:Oe.optional()});var qo=ae.extend({method:x("ping"),params:Pe.optional()}),i_=$({progress:F(),total:ee(F()),message:ee(h())}),a_=$({...Oe.shape,...i_.shape,progressToken:Jd}),Do=Re.extend({method:x("notifications/progress"),params:a_}),c_=Pe.extend({cursor:Hd.optional()}),Sr=ae.extend({params:c_.optional()}),Pr=ce.extend({nextCursor:Hd.optional()}),u_=ve(["working","input_required","completed","failed","cancelled"]),Er=$({taskId:h(),status:u_,ttl:G([F(),Zd()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ee(F()),statusMessage:ee(h())}),Dt=ce.extend({task:Er}),l_=Oe.merge(Er),Tr=Re.extend({method:x("notifications/tasks/status"),params:l_}),Mo=ae.extend({method:x("tasks/get"),params:Pe.extend({taskId:h()})}),Lo=ce.merge(Er),Uo=ae.extend({method:x("tasks/result"),params:Pe.extend({taskId:h()})}),nS=ce.loose(),Fo=Sr.extend({method:x("tasks/list")}),Vo=Pr.extend({tasks:A(Er)}),Jo=ae.extend({method:x("tasks/cancel"),params:Pe.extend({taskId:h()})}),ep=ce.merge(Er),tp=$({uri:h(),mimeType:ee(h()),_meta:H(h(),X()).optional()}),rp=tp.extend({text:h()}),As=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),op=tp.extend({blob:As}),Or=ve(["user","assistant"]),Mt=$({audience:A(Or).optional(),priority:F().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),np=$({...qt.shape,...kr.shape,uri:h(),description:ee(h()),mimeType:ee(h()),size:ee(F()),annotations:Mt.optional(),_meta:ee(ge({}))}),d_=$({...qt.shape,...kr.shape,uriTemplate:h(),description:ee(h()),mimeType:ee(h()),annotations:Mt.optional(),_meta:ee(ge({}))}),Cs=Sr.extend({method:x("resources/list")}),p_=Pr.extend({resources:A(np)}),f_=Sr.extend({method:x("resources/templates/list")}),m_=Pr.extend({resourceTemplates:A(d_)}),qs=Pe.extend({uri:h()}),h_=qs,Ds=ae.extend({method:x("resources/read"),params:h_}),g_=ce.extend({contents:A(G([rp,op]))}),__=Re.extend({method:x("notifications/resources/list_changed"),params:Oe.optional()}),y_=qs,v_=ae.extend({method:x("resources/subscribe"),params:y_}),b_=qs,$_=ae.extend({method:x("resources/unsubscribe"),params:b_}),z_=Oe.extend({uri:h()}),w_=Re.extend({method:x("notifications/resources/updated"),params:z_}),x_=$({name:h(),description:ee(h()),required:ee(se())}),k_=$({...qt.shape,...kr.shape,description:ee(h()),arguments:ee(A(x_)),_meta:ee(ge({}))}),S_=Sr.extend({method:x("prompts/list")}),P_=Pr.extend({prompts:A(k_)}),E_=Pe.extend({name:h(),arguments:H(h(),h()).optional()}),T_=ae.extend({method:x("prompts/get"),params:E_}),Ms=$({type:x("text"),text:h(),annotations:Mt.optional(),_meta:H(h(),X()).optional()}),Ls=$({type:x("image"),data:As,mimeType:h(),annotations:Mt.optional(),_meta:H(h(),X()).optional()}),Us=$({type:x("audio"),data:As,mimeType:h(),annotations:Mt.optional(),_meta:H(h(),X()).optional()}),O_=$({type:x("tool_use"),name:h(),id:h(),input:H(h(),X()),_meta:H(h(),X()).optional()}),R_=$({type:x("resource"),resource:G([rp,op]),annotations:Mt.optional(),_meta:H(h(),X()).optional()}),I_=np.extend({type:x("resource_link")}),Fs=G([Ms,Ls,Us,I_,R_]),N_=$({role:Or,content:Fs}),j_=ce.extend({description:h().optional(),messages:A(N_)}),Z_=Re.extend({method:x("notifications/prompts/list_changed"),params:Oe.optional()}),A_=$({title:h().optional(),readOnlyHint:se().optional(),destructiveHint:se().optional(),idempotentHint:se().optional(),openWorldHint:se().optional()}),C_=$({taskSupport:ve(["required","optional","forbidden"]).optional()}),sp=$({...qt.shape,...kr.shape,description:h().optional(),inputSchema:$({type:x("object"),properties:H(h(),ne).optional(),required:A(h()).optional()}).catchall(X()),outputSchema:$({type:x("object"),properties:H(h(),ne).optional(),required:A(h()).optional()}).catchall(X()).optional(),annotations:A_.optional(),execution:C_.optional(),_meta:H(h(),X()).optional()}),Vs=Sr.extend({method:x("tools/list")}),q_=Pr.extend({tools:A(sp)}),Ho=ce.extend({content:A(Fs).default([]),structuredContent:H(h(),X()).optional(),isError:se().optional()}),sS=Ho.or(ce.extend({toolResult:X()})),D_=wr.extend({name:h(),arguments:H(h(),X()).optional()}),Rr=ae.extend({method:x("tools/call"),params:D_}),M_=Re.extend({method:x("notifications/tools/list_changed"),params:Oe.optional()}),iS=$({autoRefresh:se().default(!0),debounceMs:F().int().nonnegative().default(300)}),Ir=ve(["debug","info","notice","warning","error","critical","alert","emergency"]),L_=Pe.extend({level:Ir}),Js=ae.extend({method:x("logging/setLevel"),params:L_}),U_=Oe.extend({level:Ir,logger:h().optional(),data:X()}),F_=Re.extend({method:x("notifications/message"),params:U_}),V_=$({name:h().optional()}),J_=$({hints:A(V_).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),H_=$({mode:ve(["auto","required","none"]).optional()}),K_=$({type:x("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:A(Fs).default([]),structuredContent:$({}).loose().optional(),isError:se().optional(),_meta:H(h(),X()).optional()}),B_=Ss("type",[Ms,Ls,Us]),No=Ss("type",[Ms,Ls,Us,O_,K_]),G_=$({role:Or,content:G([No,A(No)]),_meta:H(h(),X()).optional()}),W_=wr.extend({messages:A(G_),modelPreferences:J_.optional(),systemPrompt:h().optional(),includeContext:ve(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:A(h()).optional(),metadata:ne.optional(),tools:A(sp).optional(),toolChoice:H_.optional()}),Y_=ae.extend({method:x("sampling/createMessage"),params:W_}),Nr=ce.extend({model:h(),stopReason:ee(ve(["endTurn","stopSequence","maxTokens"]).or(h())),role:Or,content:B_}),Hs=ce.extend({model:h(),stopReason:ee(ve(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Or,content:G([No,A(No)])}),Q_=$({type:x("boolean"),title:h().optional(),description:h().optional(),default:se().optional()}),X_=$({type:x("string"),title:h().optional(),description:h().optional(),minLength:F().optional(),maxLength:F().optional(),format:ve(["email","uri","date","date-time"]).optional(),default:h().optional()}),ey=$({type:ve(["number","integer"]),title:h().optional(),description:h().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),ty=$({type:x("string"),title:h().optional(),description:h().optional(),enum:A(h()),default:h().optional()}),ry=$({type:x("string"),title:h().optional(),description:h().optional(),oneOf:A($({const:h(),title:h()})),default:h().optional()}),oy=$({type:x("string"),title:h().optional(),description:h().optional(),enum:A(h()),enumNames:A(h()).optional(),default:h().optional()}),ny=G([ty,ry]),sy=$({type:x("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:$({type:x("string"),enum:A(h())}),default:A(h()).optional()}),iy=$({type:x("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:$({anyOf:A($({const:h(),title:h()}))}),default:A(h()).optional()}),ay=G([sy,iy]),cy=G([oy,ny,ay]),uy=G([cy,Q_,X_,ey]),ly=wr.extend({mode:x("form").optional(),message:h(),requestedSchema:$({type:x("object"),properties:H(h(),uy),required:A(h()).optional()})}),dy=wr.extend({mode:x("url"),message:h(),elicitationId:h(),url:h().url()}),py=G([ly,dy]),fy=ae.extend({method:x("elicitation/create"),params:py}),my=Oe.extend({elicitationId:h()}),hy=Re.extend({method:x("notifications/elicitation/complete"),params:my}),Lt=ce.extend({action:ve(["accept","decline","cancel"]),content:Ps(t=>t===null?void 0:t,H(h(),G([h(),F(),se(),A(h())])).optional())}),gy=$({type:x("ref/resource"),uri:h()});var _y=$({type:x("ref/prompt"),name:h()}),yy=Pe.extend({ref:G([_y,gy]),argument:$({name:h(),value:h()}),context:$({arguments:H(h(),h()).optional()}).optional()}),vy=ae.extend({method:x("completion/complete"),params:yy});var by=ce.extend({completion:ge({values:A(h()).max(100),total:ee(F().int()),hasMore:ee(se())})}),$y=$({uri:h().startsWith("file://"),name:h().optional(),_meta:H(h(),X()).optional()}),zy=ae.extend({method:x("roots/list"),params:Pe.optional()}),Ks=ce.extend({roots:A($y)}),wy=Re.extend({method:x("notifications/roots/list_changed"),params:Oe.optional()}),aS=G([qo,js,vy,Js,T_,S_,Cs,f_,Ds,v_,$_,Rr,Vs,Mo,Uo,Fo,Jo]),cS=G([Co,Do,Zs,wy,Tr]),uS=G([Ao,Nr,Hs,Lt,Ks,Lo,Vo,Dt]),lS=G([qo,Y_,fy,zy,Mo,Uo,Fo,Jo]),dS=G([Co,Do,F_,w_,__,M_,Z_,Tr,hy]),pS=G([Ao,s_,by,j_,P_,p_,m_,g_,Ho,q_,Lo,Vo,Dt]),O=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===Z.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Es(n.elicitations,r)}return new t(e,r,o)}},Es=class extends O{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Z.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function ut(t){return t==="completed"||t==="failed"||t==="cancelled"}var JS=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Bs(t){let r=Oo(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=ld(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Gs(t,e){let r=at(t,e);if(!r.success)throw r.error;return r.data}var Ty=6e4,Ko=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(Co,r=>{this._oncancel(r)}),this.setNotificationHandler(Do,r=>{this._onprogress(r)}),this.setRequestHandler(qo,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Mo,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new O(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Uo,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new O(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new O(Z.InvalidParams,`Task not found: ${s}`);if(!ut(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(ut(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ct]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Fo,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new O(Z.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Jo,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new O(Z.InvalidParams,`Task not found: ${r.params.taskId}`);if(ut(n.status))throw new O(Z.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new O(Z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof O?n:new O(Z.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),O.fromError(Z.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),xr(s)||Yd(s)?this._onresponse(s):Rs(s)?this._onrequest(s,i):Wd(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=O.fromError(Z.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?.[ct]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Kd(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 d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new O(Z.ConnectionClosed,"Request was cancelled");let f={...p,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,d,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 d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Z.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(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),xr(e))o(e);else{let i=new O(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(xr(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),xr(e))n(e);else{let i=O.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 O?i:new O(Z.InternalError,String(i))}}return}let s;try{let i=await this.request(e,Dt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new O(Z.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},ut(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new O(Z.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new O(Z.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof O?i:new O(Z.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 d=P=>{l(P)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(P){d(P);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ct]:c}});let m=P=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(P)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let w=P instanceof O?P:new O(Z.RequestTimeout,String(P));l(w)};this._responseHandlers.set(p,P=>{if(!o?.signal?.aborted){if(P instanceof Error)return l(P);try{let w=at(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??Ty,y=()=>m(O.fromError(Z.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(p,_,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let P=w=>{let S=this._responseHandlers.get(p);S?S(w):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,P),this._enqueueTaskMessage(v,{type:"request",message:f,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(p),l(w)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(p),l(P)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Lo,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},Vo,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},ep,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||{},[ct]: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||{},[ct]: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||{},[ct]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=Bs(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Gs(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=Bs(e);this._notificationHandlers.set(o,n=>{let s=Gs(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"&&Rs(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new O(Z.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 O(Z.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new O(Z.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 O(Z.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=Tr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ut(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new O(Z.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(ut(a.status))throw new O(Z.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=Tr.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ut(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function ip(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function ap(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];ip(i)&&ip(s)?r[n]={...i,...s}:r[n]=s}return r}var Xm=Ha(Za(),1),eh=Ha(Qm(),1);function Iw(){let t=new Xm.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,eh.default)(t),t}var Tn=class{constructor(e){this._ajv=e??Iw()}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 On=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(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Nr,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},Lt,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 th(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 rh(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 Rn=class extends Ko{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ir.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 Tn,this.setRequestHandler(js,o=>this._oninitialize(o)),this.setNotificationHandler(Zs,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Js,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Ir.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new On(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ap(this._capabilities,e)}setRequestHandler(e,r){let n=Oo(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(Ct(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=at(Rr,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new O(Z.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=at(Dt,p);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new O(Z.InvalidParams,`Invalid task creation result: ${_}`)}return m.data}let f=at(Ho,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new O(Z.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){rh(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&th(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:Vd.includes(r)?r:Ts,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"},Ao)}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(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Hs,r):this.request({method:"sampling/createMessage",params:e},Nr,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},Lt,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},Lt,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new O(Z.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof O?i:new O(Z.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},Ks,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"})}};import nh from"node:process";var In=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),
|
|
74
|
-
`}var Nn=class{constructor(e=nh.stdin,r=nh.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new In,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=oh(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(x,S)=>P(p,x,S)},s,i=yt,a=!It.jitless,u=a&&Ln.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=o.value);let m=p.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(e.shape)),p=s(p,f),l?Mu([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function ru(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=>!st(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=>Ee(i,o,ze())))}),e)}var ts=g("$ZodUnion",(t,e)=>{H.init(t,e),U(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),U(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),U(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),U(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=>dr(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=>ru(a,o,t,n)):ru(i,o,t,n)}});var Uu=g("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ts.init(t,e);let r=t._zod.parse;U(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=At(()=>{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(!yt(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)}}),Fu=g("$ZodIntersection",(t,e)=>{H.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])=>ou(r,c,u)):ou(r,s,i)}});function Xn(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(nt(t)&&nt(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=Xn(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=Xn(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 ou(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}),st(t))return t;let i=Xn(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 Vu=g("$ZodRecord",(t,e)=>{H.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!nt(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=>Ee(f,o,ze())),input:u,path:[u],inst:t});continue}let d=l.value,p=e.valueType._zod.run({value:n[u],issues:[]},o);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&r.issues.push(...Qe(u,f.issues)),r.value[d]=f.value})):(p.issues.length&&r.issues.push(...Qe(u,p.issues)),r.value[d]=p.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"&&Kn.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Ee(d,o,ze())),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(d=>{d.issues.length&&r.issues.push(...Qe(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Qe(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Bu=g("$ZodEnum",(t,e)=>{H.init(t,e);let r=ur(e.entries),o=new Set(r);t._zod.values=o,t._zod.pattern=new RegExp(`^(${r.filter(n=>Un.has(typeof n)).map(n=>typeof n=="string"?Ke(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}}),Ju=g("$ZodLiteral",(t,e)=>{if(H.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"?Ke(o):o?Ke(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 Hu=g("$ZodTransform",(t,e)=>{H.init(t,e),t._zod.optin="optional",t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ot(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 Fe;return r.value=n,r.fallback=!0,r}});function nu(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var rs=g("$ZodOptional",(t,e)=>{H.init(t,e),t._zod.optin="optional",t._zod.optout="optional",U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${dr(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=>nu(i,n)):nu(s,n)}return r.value===void 0?r:e.innerType._zod.run(r,o)}}),Wu=g("$ZodExactOptional",(t,e)=>{rs.init(t,e),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,o)=>e.innerType._zod.run(r,o)}),Gu=g("$ZodNullable",(t,e)=>{H.init(t,e),U(t._zod,"optin",()=>e.innerType._zod.optin),U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${dr(r.source)}|null)$`):void 0}),U(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)}),Ku=g("$ZodDefault",(t,e)=>{H.init(t,e),t._zod.optin="optional",U(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=>su(s,e)):su(n,e)}});function su(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Qu=g("$ZodPrefault",(t,e)=>{H.init(t,e),t._zod.optin="optional",U(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))}),Yu=g("$ZodNonOptional",(t,e)=>{H.init(t,e),U(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=>iu(s,t)):iu(n,t)}});function iu(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 Xu=g("$ZodCatch",(t,e)=>{H.init(t,e),t._zod.optin="optional",U(t._zod,"optout",()=>e.innerType._zod.optout),U(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=>Ee(i,o,ze()))},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=>Ee(s,o,ze()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var os=g("$ZodPipe",(t,e)=>{H.init(t,e),U(t._zod,"values",()=>e.in._zod.values),U(t._zod,"optin",()=>e.in._zod.optin),U(t._zod,"optout",()=>e.out._zod.optout),U(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=>wo(i,e.in,o)):wo(s,e.in,o)}let n=e.in._zod.run(r,o);return n instanceof Promise?n.then(s=>wo(s,e.out,o)):wo(n,e.out,o)}});function wo(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 el=g("$ZodPreprocess",(t,e)=>{os.init(t,e)}),tl=g("$ZodReadonly",(t,e)=>{H.init(t,e),U(t._zod,"propValues",()=>e.innerType._zod.propValues),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"optin",()=>e.innerType?._zod?.optin),U(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(au):au(n)}});function au(t){return t.value=Object.freeze(t.value),t}var rl=g("$ZodCustom",(t,e)=>{ie.init(t,e),H.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=>cu(s,r,o,t));cu(n,r,o,t)}});function cu(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(Zt(n))}}var Vh=()=>{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=Jn(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${ho(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 ol(){return{localeError:Vh()}}var nl;var ns=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 Bh(){return new ns}(nl=globalThis).__zod_globalRegistry??(nl.__zod_globalRegistry=Bh());var bt=globalThis.__zod_globalRegistry;function sl(t,e){return new t({type:"string",...T(e)})}function il(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...T(e)})}function ss(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...T(e)})}function al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...T(e)})}function cl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(e)})}function ul(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(e)})}function ll(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(e)})}function dl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...T(e)})}function pl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...T(e)})}function fl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(e)})}function ml(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...T(e)})}function hl(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(e)})}function gl(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...T(e)})}function _l(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...T(e)})}function yl(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(e)})}function bl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(e)})}function vl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(e)})}function $l(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(e)})}function wl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(e)})}function xl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...T(e)})}function kl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...T(e)})}function zl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...T(e)})}function Sl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...T(e)})}function Pl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}function Tl(t,e){return new t({type:"string",format:"date",check:"string_format",...T(e)})}function El(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}function Rl(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function Ol(t,e){return new t({type:"number",checks:[],...T(e)})}function Il(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}function Nl(t,e){return new t({type:"boolean",...T(e)})}function Al(t,e){return new t({type:"null",...T(e)})}function Zl(t){return new t({type:"unknown"})}function Cl(t,e){return new t({type:"never",...T(e)})}function zo(t,e){return new Qn({check:"less_than",...T(e),value:t,inclusive:!1})}function _r(t,e){return new Qn({check:"less_than",...T(e),value:t,inclusive:!0})}function So(t,e){return new Yn({check:"greater_than",...T(e),value:t,inclusive:!1})}function yr(t,e){return new Yn({check:"greater_than",...T(e),value:t,inclusive:!0})}function Po(t,e){return new Lc({check:"multiple_of",...T(e),value:t})}function To(t,e){return new Fc({check:"max_length",...T(e),maximum:t})}function Ct(t,e){return new Vc({check:"min_length",...T(e),minimum:t})}function Eo(t,e){return new Bc({check:"length_equals",...T(e),length:t})}function is(t,e){return new Jc({check:"string_format",format:"regex",...T(e),pattern:t})}function as(t){return new Hc({check:"string_format",format:"lowercase",...T(t)})}function cs(t){return new Wc({check:"string_format",format:"uppercase",...T(t)})}function us(t,e){return new Gc({check:"string_format",format:"includes",...T(e),includes:t})}function ls(t,e){return new Kc({check:"string_format",format:"starts_with",...T(e),prefix:t})}function ds(t,e){return new Qc({check:"string_format",format:"ends_with",...T(e),suffix:t})}function it(t){return new Yc({check:"overwrite",tx:t})}function ps(t){return it(e=>e.normalize(t))}function fs(){return it(t=>t.trim())}function ms(){return it(t=>t.toLowerCase())}function hs(){return it(t=>t.toUpperCase())}function gs(){return it(t=>Mn(t))}function jl(t,e,r){return new t({type:"array",element:e,...T(r)})}function Dl(t,e,r){let o=T(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function ql(t,e,r){return new t({type:"custom",check:"custom",fn:e,...T(r)})}function Ml(t,e){let r=Jh(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))}},t(o.value,o)),e);return r}function Jh(t,e){let r=new ie({check:"custom",...T(e)});return r._zod.check=t,r}function _s(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??bt,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 p=i.schema,f=e.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(i.ref||(i.ref=d),re(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&he(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 ys(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 d=t.external.registry.get(i[0])?.id,p=t.external.uri??(m=>m);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__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 d in l)delete l[d];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
|
+
|
|
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 bs(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},d=c.ref;if(c.ref=null,d){o(d);let f=t.seen.get(d),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===d)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 p=a._zod.parent;if(p&&p!==d){o(p);let f=t.seen.get(p);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:br(e,"input",t.processors),output:br(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function he(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 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 t._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 Ll=(t,e={})=>r=>{let o=_s({...r,processors:e});return re(t,o),ys(o,t),bs(o,t)},br=(t,e,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=_s({...n??{},target:s,io:e,processors:r});return re(t,i),ys(i,t),bs(i,t)};var Hh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ul=(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=Hh[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Fl=(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 d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";d?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),p?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},Vl=(t,e,r,o)=>{r.type="boolean"};var Bl=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Jl=(t,e,r,o)=>{r.not={}};var Hl=(t,e,r,o)=>{};var Wl=(t,e,r,o)=>{let n=t._zod.def,s=ur(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Gl=(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 Kl=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Ql=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Yl=(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"]})},Xl=(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)},ed=(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},td=(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 rd=(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 d of c)n.patternProperties[d.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(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},od=(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"}]},nd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType},sd=(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))},id=(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)))},ad=(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},cd=(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},ud=(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 vs=(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 jt(t){return!!t._zod}function at(t,e){return jt(t)?mr(t,e):t.safeParse(e)}function Ro(t){if(!t)return;let e;if(jt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ld(t){if(jt(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 $r={};Ba($r,{ZodISODate:()=>pd,ZodISODateTime:()=>dd,ZodISODuration:()=>md,ZodISOTime:()=>fd,date:()=>ws,datetime:()=>$s,duration:()=>ks,time:()=>xs});var dd=g("ZodISODateTime",(t,e)=>{vu.init(t,e),Y.init(t,e)});function $s(t){return Pl(dd,t)}var pd=g("ZodISODate",(t,e)=>{$u.init(t,e),Y.init(t,e)});function ws(t){return Tl(pd,t)}var fd=g("ZodISOTime",(t,e)=>{wu.init(t,e),Y.init(t,e)});function xs(t){return El(fd,t)}var md=g("ZodISODuration",(t,e)=>{xu.init(t,e),Y.init(t,e)});function ks(t){return Rl(md,t)}var rg=(t,e)=>{go.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>oc(t,r)},flatten:{value:r=>rc(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Nt,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Nt,2)}},isEmpty:{get(){return t.issues.length===0}}})};var Se=g("ZodError",rg,{Parent:Error});var hd=_o(Se),gd=yo(Se),_d=fr(Se),yd=hr(Se),bd=nc(Se),vd=sc(Se),$d=ic(Se),wd=ac(Se),xd=cc(Se),kd=uc(Se),zd=lc(Se),Sd=dc(Se);var Pd=new WeakMap;function wr(t,e,r){let o=Object.getPrototypeOf(t),n=Pd.get(o);if(n||(n=new Set,Pd.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)=>(H.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:br(t,"input"),output:br(t,"output")}}),t.toJSONSchema=Ll(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,o)=>hd(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>_d(t,r,o),t.parseAsync=async(r,o)=>gd(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>yd(t,r,o),t.spa=t.safeParseAsync,t.encode=(r,o)=>bd(t,r,o),t.decode=(r,o)=>vd(t,r,o),t.encodeAsync=async(r,o)=>$d(t,r,o),t.decodeAsync=async(r,o)=>wd(t,r,o),t.safeEncode=(r,o)=>xd(t,r,o),t.safeDecode=(r,o)=>kd(t,r,o),t.safeEncodeAsync=async(r,o)=>zd(t,r,o),t.safeDecodeAsync=async(r,o)=>Sd(t,r,o),wr(t,"ZodType",{check(...r){let o=this.def;return this.clone(D.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(Jg(r,o))},superRefine(r,o){return this.check(Hg(r,o))},overwrite(r){return this.check(it(r))},optional(){return ee(this)},exactOptional(){return Ag(this)},nullable(){return Od(this)},nullish(){return ee(Od(this))},nonoptional(r){return Mg(this,r)},array(){return C(this)},or(r){return G([this,r])},and(r){return Io(this,r)},transform(r){return Id(this,Dd(r))},default(r){return jg(this,r)},prefault(r){return qg(this,r)},catch(r){return Ug(this,r)},pipe(r){return Id(this,r)},readonly(){return Bg(this)},describe(r){let o=this.clone();return bt.add(o,{description:r}),o},meta(...r){if(r.length===0)return bt.get(this);let o=this.clone();return bt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return bt.get(t)?.description},configurable:!0}),t)),Nd=g("_ZodString",(t,e)=>{ko.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Ul(t,o,n,s);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,wr(t,"_ZodString",{regex(...o){return this.check(is(...o))},includes(...o){return this.check(us(...o))},startsWith(...o){return this.check(ls(...o))},endsWith(...o){return this.check(ds(...o))},min(...o){return this.check(Ct(...o))},max(...o){return this.check(To(...o))},length(...o){return this.check(Eo(...o))},nonempty(...o){return this.check(Ct(1,...o))},lowercase(o){return this.check(as(o))},uppercase(o){return this.check(cs(o))},trim(){return this.check(fs())},normalize(...o){return this.check(ps(...o))},toLowerCase(){return this.check(ms())},toUpperCase(){return this.check(hs())},slugify(){return this.check(gs())}})}),ng=g("ZodString",(t,e)=>{ko.init(t,e),Nd.init(t,e),t.email=r=>t.check(il(sg,r)),t.url=r=>t.check(dl(ig,r)),t.jwt=r=>t.check(Sl($g,r)),t.emoji=r=>t.check(pl(ag,r)),t.guid=r=>t.check(ss(Td,r)),t.uuid=r=>t.check(al(Oo,r)),t.uuidv4=r=>t.check(cl(Oo,r)),t.uuidv6=r=>t.check(ul(Oo,r)),t.uuidv7=r=>t.check(ll(Oo,r)),t.nanoid=r=>t.check(fl(cg,r)),t.guid=r=>t.check(ss(Td,r)),t.cuid=r=>t.check(ml(ug,r)),t.cuid2=r=>t.check(hl(lg,r)),t.ulid=r=>t.check(gl(dg,r)),t.base64=r=>t.check(xl(yg,r)),t.base64url=r=>t.check(kl(bg,r)),t.xid=r=>t.check(_l(pg,r)),t.ksuid=r=>t.check(yl(fg,r)),t.ipv4=r=>t.check(bl(mg,r)),t.ipv6=r=>t.check(vl(hg,r)),t.cidrv4=r=>t.check($l(gg,r)),t.cidrv6=r=>t.check(wl(_g,r)),t.e164=r=>t.check(zl(vg,r)),t.datetime=r=>t.check($s(r)),t.date=r=>t.check(ws(r)),t.time=r=>t.check(xs(r)),t.duration=r=>t.check(ks(r))});function h(t){return sl(ng,t)}var Y=g("ZodStringFormat",(t,e)=>{W.init(t,e),Nd.init(t,e)}),sg=g("ZodEmail",(t,e)=>{du.init(t,e),Y.init(t,e)});var Td=g("ZodGUID",(t,e)=>{uu.init(t,e),Y.init(t,e)});var Oo=g("ZodUUID",(t,e)=>{lu.init(t,e),Y.init(t,e)});var ig=g("ZodURL",(t,e)=>{pu.init(t,e),Y.init(t,e)});var ag=g("ZodEmoji",(t,e)=>{fu.init(t,e),Y.init(t,e)});var cg=g("ZodNanoID",(t,e)=>{mu.init(t,e),Y.init(t,e)});var ug=g("ZodCUID",(t,e)=>{hu.init(t,e),Y.init(t,e)});var lg=g("ZodCUID2",(t,e)=>{gu.init(t,e),Y.init(t,e)});var dg=g("ZodULID",(t,e)=>{_u.init(t,e),Y.init(t,e)});var pg=g("ZodXID",(t,e)=>{yu.init(t,e),Y.init(t,e)});var fg=g("ZodKSUID",(t,e)=>{bu.init(t,e),Y.init(t,e)});var mg=g("ZodIPv4",(t,e)=>{ku.init(t,e),Y.init(t,e)});var hg=g("ZodIPv6",(t,e)=>{zu.init(t,e),Y.init(t,e)});var gg=g("ZodCIDRv4",(t,e)=>{Su.init(t,e),Y.init(t,e)});var _g=g("ZodCIDRv6",(t,e)=>{Pu.init(t,e),Y.init(t,e)});var yg=g("ZodBase64",(t,e)=>{Eu.init(t,e),Y.init(t,e)});var bg=g("ZodBase64URL",(t,e)=>{Ru.init(t,e),Y.init(t,e)});var vg=g("ZodE164",(t,e)=>{Ou.init(t,e),Y.init(t,e)});var $g=g("ZodJWT",(t,e)=>{Iu.init(t,e),Y.init(t,e)});var Ad=g("ZodNumber",(t,e)=>{es.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Fl(t,o,n,s),wr(t,"ZodNumber",{gt(o,n){return this.check(So(o,n))},gte(o,n){return this.check(yr(o,n))},min(o,n){return this.check(yr(o,n))},lt(o,n){return this.check(zo(o,n))},lte(o,n){return this.check(_r(o,n))},max(o,n){return this.check(_r(o,n))},int(o){return this.check(Ed(o))},safe(o){return this.check(Ed(o))},positive(o){return this.check(So(0,o))},nonnegative(o){return this.check(yr(0,o))},negative(o){return this.check(zo(0,o))},nonpositive(o){return this.check(_r(0,o))},multipleOf(o,n){return this.check(Po(o,n))},step(o,n){return this.check(Po(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 F(t){return Ol(Ad,t)}var wg=g("ZodNumberFormat",(t,e)=>{Nu.init(t,e),Ad.init(t,e)});function Ed(t){return Il(wg,t)}var xg=g("ZodBoolean",(t,e)=>{Au.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Vl(t,r,o,n)});function se(t){return Nl(xg,t)}var kg=g("ZodNull",(t,e)=>{Zu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Bl(t,r,o,n)});function Zd(t){return Al(kg,t)}var zg=g("ZodUnknown",(t,e)=>{Cu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Hl(t,r,o,n)});function X(){return Zl(zg)}var Sg=g("ZodNever",(t,e)=>{ju.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Jl(t,r,o,n)});function Pg(t){return Cl(Sg,t)}var Tg=g("ZodArray",(t,e)=>{Du.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Yl(t,r,o,n),t.element=e.element,wr(t,"ZodArray",{min(r,o){return this.check(Ct(r,o))},nonempty(r){return this.check(Ct(1,r))},max(r,o){return this.check(To(r,o))},length(r,o){return this.check(Eo(r,o))},unwrap(){return this.element}})});function C(t,e){return jl(Tg,t,e)}var Cd=g("ZodObject",(t,e)=>{Lu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Xl(t,r,o,n),D.defineLazy(t,"shape",()=>e.shape),wr(t,"ZodObject",{keyof(){return be(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:Pg()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return D.extend(this,r)},safeExtend(r){return D.safeExtend(this,r)},merge(r){return D.merge(this,r)},pick(r){return D.pick(this,r)},omit(r){return D.omit(this,r)},partial(...r){return D.partial(qd,this,r[0])},required(...r){return D.required(Md,this,r[0])}})});function $(t,e){let r={type:"object",shape:t??{},...D.normalizeParams(e)};return new Cd(r)}function ge(t,e){return new Cd({type:"object",shape:t,catchall:X(),...D.normalizeParams(e)})}var jd=g("ZodUnion",(t,e)=>{ts.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ed(t,r,o,n),t.options=e.options});function G(t,e){return new jd({type:"union",options:t,...D.normalizeParams(e)})}var Eg=g("ZodDiscriminatedUnion",(t,e)=>{jd.init(t,e),Uu.init(t,e)});function Ss(t,e,r){return new Eg({type:"union",options:e,discriminator:t,...D.normalizeParams(r)})}var Rg=g("ZodIntersection",(t,e)=>{Fu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>td(t,r,o,n)});function Io(t,e){return new Rg({type:"intersection",left:t,right:e})}var Rd=g("ZodRecord",(t,e)=>{Vu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>rd(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function J(t,e,r){return!e||!e._zod?new Rd({type:"record",keyType:h(),valueType:t,...D.normalizeParams(e)}):new Rd({type:"record",keyType:t,valueType:e,...D.normalizeParams(r)})}var zs=g("ZodEnum",(t,e)=>{Bu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Wl(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 zs({...e,checks:[],...D.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 zs({...e,checks:[],...D.normalizeParams(n),entries:s})}});function be(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new zs({type:"enum",entries:r,...D.normalizeParams(e)})}var Og=g("ZodLiteral",(t,e)=>{Ju.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Gl(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 k(t,e){return new Og({type:"literal",values:Array.isArray(t)?t:[t],...D.normalizeParams(e)})}var Ig=g("ZodTransform",(t,e)=>{Hu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Ql(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ot(t.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(D.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(D.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 Dd(t){return new Ig({type:"transform",transform:t})}var qd=g("ZodOptional",(t,e)=>{rs.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new qd({type:"optional",innerType:t})}var Ng=g("ZodExactOptional",(t,e)=>{Wu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Ag(t){return new Ng({type:"optional",innerType:t})}var Zg=g("ZodNullable",(t,e)=>{Gu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>od(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Od(t){return new Zg({type:"nullable",innerType:t})}var Cg=g("ZodDefault",(t,e)=>{Ku.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>sd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function jg(t,e){return new Cg({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():D.shallowClone(e)}})}var Dg=g("ZodPrefault",(t,e)=>{Qu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>id(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function qg(t,e){return new Dg({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():D.shallowClone(e)}})}var Md=g("ZodNonOptional",(t,e)=>{Yu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>nd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Mg(t,e){return new Md({type:"nonoptional",innerType:t,...D.normalizeParams(e)})}var Lg=g("ZodCatch",(t,e)=>{Xu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ad(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Ug(t,e){return new Lg({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Ld=g("ZodPipe",(t,e)=>{os.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>cd(t,r,o,n),t.in=e.in,t.out=e.out});function Id(t,e){return new Ld({type:"pipe",in:t,out:e})}var Fg=g("ZodPreprocess",(t,e)=>{Ld.init(t,e),el.init(t,e)}),Vg=g("ZodReadonly",(t,e)=>{tl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ud(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Bg(t){return new Vg({type:"readonly",innerType:t})}var Ud=g("ZodCustom",(t,e)=>{rl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Kl(t,r,o,n)});function Fd(t,e){return Dl(Ud,t??(()=>!0),e)}function Jg(t,e={}){return ql(Ud,t,e)}function Hg(t,e){return Ml(t,e)}function Ps(t,e){return new Fg({type:"pipe",in:Dd(t),out:e})}ze(ol());var Es="2025-11-25";var Vd=[Es,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ct="io.modelcontextprotocol/related-task",Ao="2.0",ne=Fd(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Bd=G([h(),F().int()]),Jd=h(),rS=ge({ttl:F().optional(),pollInterval:F().optional()}),Wg=$({ttl:F().optional()}),Gg=$({taskId:h()}),Rs=ge({progressToken:Bd.optional(),[ct]:Gg.optional()}),Pe=$({_meta:Rs.optional()}),xr=Pe.extend({task:Wg.optional()}),Hd=t=>xr.safeParse(t).success,ae=$({method:h(),params:Pe.loose().optional()}),Re=$({_meta:Rs.optional()}),Oe=$({method:h(),params:Re.loose().optional()}),ce=ge({_meta:Rs.optional()}),Zo=G([h(),F().int()]),Wd=$({jsonrpc:k(Ao),id:Zo,...ae.shape}).strict(),Os=t=>Wd.safeParse(t).success,Gd=$({jsonrpc:k(Ao),...Oe.shape}).strict(),Kd=t=>Gd.safeParse(t).success,Is=$({jsonrpc:k(Ao),id:Zo,result:ce}).strict(),kr=t=>Is.safeParse(t).success;var Z;(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"})(Z||(Z={}));var Ns=$({jsonrpc:k(Ao),id:Zo.optional(),error:$({code:F().int(),message:h(),data:X().optional()})}).strict();var Qd=t=>Ns.safeParse(t).success;var Yd=G([Wd,Gd,Is,Ns]),oS=G([Is,Ns]),Co=ce.strict(),Kg=Re.extend({requestId:Zo.optional(),reason:h().optional()}),jo=Oe.extend({method:k("notifications/cancelled"),params:Kg}),Qg=$({src:h(),mimeType:h().optional(),sizes:C(h()).optional(),theme:be(["light","dark"]).optional()}),zr=$({icons:C(Qg).optional()}),Dt=$({name:h(),title:h().optional()}),Xd=Dt.extend({...Dt.shape,...zr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),Yg=Io($({applyDefaults:se().optional()}),J(h(),X())),Xg=Ps(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Io($({form:Yg.optional(),url:ne.optional()}),J(h(),X()).optional())),e_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({sampling:ge({createMessage:ne.optional()}).optional(),elicitation:ge({create:ne.optional()}).optional()}).optional()}),t_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({tools:ge({call:ne.optional()}).optional()}).optional()}),r_=$({experimental:J(h(),ne).optional(),sampling:$({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:Xg.optional(),roots:$({listChanged:se().optional()}).optional(),tasks:e_.optional(),extensions:J(h(),ne).optional()}),o_=Pe.extend({protocolVersion:h(),capabilities:r_,clientInfo:Xd}),As=ae.extend({method:k("initialize"),params:o_});var n_=$({experimental:J(h(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:$({listChanged:se().optional()}).optional(),resources:$({subscribe:se().optional(),listChanged:se().optional()}).optional(),tools:$({listChanged:se().optional()}).optional(),tasks:t_.optional(),extensions:J(h(),ne).optional()}),s_=ce.extend({protocolVersion:h(),capabilities:n_,serverInfo:Xd,instructions:h().optional()}),Zs=Oe.extend({method:k("notifications/initialized"),params:Re.optional()});var Do=ae.extend({method:k("ping"),params:Pe.optional()}),i_=$({progress:F(),total:ee(F()),message:ee(h())}),a_=$({...Re.shape,...i_.shape,progressToken:Bd}),qo=Oe.extend({method:k("notifications/progress"),params:a_}),c_=Pe.extend({cursor:Jd.optional()}),Sr=ae.extend({params:c_.optional()}),Pr=ce.extend({nextCursor:Jd.optional()}),u_=be(["working","input_required","completed","failed","cancelled"]),Tr=$({taskId:h(),status:u_,ttl:G([F(),Zd()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ee(F()),statusMessage:ee(h())}),qt=ce.extend({task:Tr}),l_=Re.merge(Tr),Er=Oe.extend({method:k("notifications/tasks/status"),params:l_}),Mo=ae.extend({method:k("tasks/get"),params:Pe.extend({taskId:h()})}),Lo=ce.merge(Tr),Uo=ae.extend({method:k("tasks/result"),params:Pe.extend({taskId:h()})}),nS=ce.loose(),Fo=Sr.extend({method:k("tasks/list")}),Vo=Pr.extend({tasks:C(Tr)}),Bo=ae.extend({method:k("tasks/cancel"),params:Pe.extend({taskId:h()})}),ep=ce.merge(Tr),tp=$({uri:h(),mimeType:ee(h()),_meta:J(h(),X()).optional()}),rp=tp.extend({text:h()}),Cs=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),op=tp.extend({blob:Cs}),Rr=be(["user","assistant"]),Mt=$({audience:C(Rr).optional(),priority:F().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),np=$({...Dt.shape,...zr.shape,uri:h(),description:ee(h()),mimeType:ee(h()),size:ee(F()),annotations:Mt.optional(),_meta:ee(ge({}))}),d_=$({...Dt.shape,...zr.shape,uriTemplate:h(),description:ee(h()),mimeType:ee(h()),annotations:Mt.optional(),_meta:ee(ge({}))}),js=Sr.extend({method:k("resources/list")}),p_=Pr.extend({resources:C(np)}),f_=Sr.extend({method:k("resources/templates/list")}),m_=Pr.extend({resourceTemplates:C(d_)}),Ds=Pe.extend({uri:h()}),h_=Ds,qs=ae.extend({method:k("resources/read"),params:h_}),g_=ce.extend({contents:C(G([rp,op]))}),__=Oe.extend({method:k("notifications/resources/list_changed"),params:Re.optional()}),y_=Ds,b_=ae.extend({method:k("resources/subscribe"),params:y_}),v_=Ds,$_=ae.extend({method:k("resources/unsubscribe"),params:v_}),w_=Re.extend({uri:h()}),x_=Oe.extend({method:k("notifications/resources/updated"),params:w_}),k_=$({name:h(),description:ee(h()),required:ee(se())}),z_=$({...Dt.shape,...zr.shape,description:ee(h()),arguments:ee(C(k_)),_meta:ee(ge({}))}),S_=Sr.extend({method:k("prompts/list")}),P_=Pr.extend({prompts:C(z_)}),T_=Pe.extend({name:h(),arguments:J(h(),h()).optional()}),E_=ae.extend({method:k("prompts/get"),params:T_}),Ms=$({type:k("text"),text:h(),annotations:Mt.optional(),_meta:J(h(),X()).optional()}),Ls=$({type:k("image"),data:Cs,mimeType:h(),annotations:Mt.optional(),_meta:J(h(),X()).optional()}),Us=$({type:k("audio"),data:Cs,mimeType:h(),annotations:Mt.optional(),_meta:J(h(),X()).optional()}),R_=$({type:k("tool_use"),name:h(),id:h(),input:J(h(),X()),_meta:J(h(),X()).optional()}),O_=$({type:k("resource"),resource:G([rp,op]),annotations:Mt.optional(),_meta:J(h(),X()).optional()}),I_=np.extend({type:k("resource_link")}),Fs=G([Ms,Ls,Us,I_,O_]),N_=$({role:Rr,content:Fs}),A_=ce.extend({description:h().optional(),messages:C(N_)}),Z_=Oe.extend({method:k("notifications/prompts/list_changed"),params:Re.optional()}),C_=$({title:h().optional(),readOnlyHint:se().optional(),destructiveHint:se().optional(),idempotentHint:se().optional(),openWorldHint:se().optional()}),j_=$({taskSupport:be(["required","optional","forbidden"]).optional()}),sp=$({...Dt.shape,...zr.shape,description:h().optional(),inputSchema:$({type:k("object"),properties:J(h(),ne).optional(),required:C(h()).optional()}).catchall(X()),outputSchema:$({type:k("object"),properties:J(h(),ne).optional(),required:C(h()).optional()}).catchall(X()).optional(),annotations:C_.optional(),execution:j_.optional(),_meta:J(h(),X()).optional()}),Vs=Sr.extend({method:k("tools/list")}),D_=Pr.extend({tools:C(sp)}),Jo=ce.extend({content:C(Fs).default([]),structuredContent:J(h(),X()).optional(),isError:se().optional()}),sS=Jo.or(ce.extend({toolResult:X()})),q_=xr.extend({name:h(),arguments:J(h(),X()).optional()}),Or=ae.extend({method:k("tools/call"),params:q_}),M_=Oe.extend({method:k("notifications/tools/list_changed"),params:Re.optional()}),iS=$({autoRefresh:se().default(!0),debounceMs:F().int().nonnegative().default(300)}),Ir=be(["debug","info","notice","warning","error","critical","alert","emergency"]),L_=Pe.extend({level:Ir}),Bs=ae.extend({method:k("logging/setLevel"),params:L_}),U_=Re.extend({level:Ir,logger:h().optional(),data:X()}),F_=Oe.extend({method:k("notifications/message"),params:U_}),V_=$({name:h().optional()}),B_=$({hints:C(V_).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),J_=$({mode:be(["auto","required","none"]).optional()}),H_=$({type:k("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:C(Fs).default([]),structuredContent:$({}).loose().optional(),isError:se().optional(),_meta:J(h(),X()).optional()}),W_=Ss("type",[Ms,Ls,Us]),No=Ss("type",[Ms,Ls,Us,R_,H_]),G_=$({role:Rr,content:G([No,C(No)]),_meta:J(h(),X()).optional()}),K_=xr.extend({messages:C(G_),modelPreferences:B_.optional(),systemPrompt:h().optional(),includeContext:be(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:C(h()).optional(),metadata:ne.optional(),tools:C(sp).optional(),toolChoice:J_.optional()}),Q_=ae.extend({method:k("sampling/createMessage"),params:K_}),Nr=ce.extend({model:h(),stopReason:ee(be(["endTurn","stopSequence","maxTokens"]).or(h())),role:Rr,content:W_}),Js=ce.extend({model:h(),stopReason:ee(be(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Rr,content:G([No,C(No)])}),Y_=$({type:k("boolean"),title:h().optional(),description:h().optional(),default:se().optional()}),X_=$({type:k("string"),title:h().optional(),description:h().optional(),minLength:F().optional(),maxLength:F().optional(),format:be(["email","uri","date","date-time"]).optional(),default:h().optional()}),ey=$({type:be(["number","integer"]),title:h().optional(),description:h().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),ty=$({type:k("string"),title:h().optional(),description:h().optional(),enum:C(h()),default:h().optional()}),ry=$({type:k("string"),title:h().optional(),description:h().optional(),oneOf:C($({const:h(),title:h()})),default:h().optional()}),oy=$({type:k("string"),title:h().optional(),description:h().optional(),enum:C(h()),enumNames:C(h()).optional(),default:h().optional()}),ny=G([ty,ry]),sy=$({type:k("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:$({type:k("string"),enum:C(h())}),default:C(h()).optional()}),iy=$({type:k("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:$({anyOf:C($({const:h(),title:h()}))}),default:C(h()).optional()}),ay=G([sy,iy]),cy=G([oy,ny,ay]),uy=G([cy,Y_,X_,ey]),ly=xr.extend({mode:k("form").optional(),message:h(),requestedSchema:$({type:k("object"),properties:J(h(),uy),required:C(h()).optional()})}),dy=xr.extend({mode:k("url"),message:h(),elicitationId:h(),url:h().url()}),py=G([ly,dy]),fy=ae.extend({method:k("elicitation/create"),params:py}),my=Re.extend({elicitationId:h()}),hy=Oe.extend({method:k("notifications/elicitation/complete"),params:my}),Lt=ce.extend({action:be(["accept","decline","cancel"]),content:Ps(t=>t===null?void 0:t,J(h(),G([h(),F(),se(),C(h())])).optional())}),gy=$({type:k("ref/resource"),uri:h()});var _y=$({type:k("ref/prompt"),name:h()}),yy=Pe.extend({ref:G([_y,gy]),argument:$({name:h(),value:h()}),context:$({arguments:J(h(),h()).optional()}).optional()}),by=ae.extend({method:k("completion/complete"),params:yy});var vy=ce.extend({completion:ge({values:C(h()).max(100),total:ee(F().int()),hasMore:ee(se())})}),$y=$({uri:h().startsWith("file://"),name:h().optional(),_meta:J(h(),X()).optional()}),wy=ae.extend({method:k("roots/list"),params:Pe.optional()}),Hs=ce.extend({roots:C($y)}),xy=Oe.extend({method:k("notifications/roots/list_changed"),params:Re.optional()}),aS=G([Do,As,by,Bs,E_,S_,js,f_,qs,b_,$_,Or,Vs,Mo,Uo,Fo,Bo]),cS=G([jo,qo,Zs,xy,Er]),uS=G([Co,Nr,Js,Lt,Hs,Lo,Vo,qt]),lS=G([Do,Q_,fy,wy,Mo,Uo,Fo,Bo]),dS=G([jo,qo,F_,x_,__,M_,Z_,Er,hy]),pS=G([Co,s_,vy,A_,P_,p_,m_,g_,Jo,D_,Lo,Vo,qt]),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===Z.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Ts(n.elicitations,r)}return new t(e,r,o)}},Ts=class extends R{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Z.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function ut(t){return t==="completed"||t==="failed"||t==="cancelled"}var BS=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ws(t){let r=Ro(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=ld(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Gs(t,e){let r=at(t,e);if(!r.success)throw r.error;return r.data}var Ey=6e4,Ho=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(jo,r=>{this._oncancel(r)}),this.setNotificationHandler(qo,r=>{this._onprogress(r)}),this.setRequestHandler(Do,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Mo,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Uo,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new R(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new R(Z.InvalidParams,`Task not found: ${s}`);if(!ut(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(ut(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ct]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Fo,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(Z.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Bo,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(Z.InvalidParams,`Task not found: ${r.params.taskId}`);if(ut(n.status))throw new R(Z.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(Z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof R?n:new R(Z.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(Z.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),kr(s)||Qd(s)?this._onresponse(s):Os(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 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(Z.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?.[ct]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Hd(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 d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new R(Z.ConnectionClosed,"Request was cancelled");let f={...p,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,d,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 d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Z.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(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),kr(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(kr(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),kr(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(Z.InternalError,String(i))}}return}let s;try{let i=await this.request(e,qt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(Z.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},ut(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(Z.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(Z.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(Z.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 d=P=>{l(P)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(P){d(P);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ct]:c}});let m=P=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(P)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let x=P instanceof R?P:new R(Z.RequestTimeout,String(P));l(x)};this._responseHandlers.set(p,P=>{if(!o?.signal?.aborted){if(P instanceof Error)return l(P);try{let x=at(r,P.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),o?.signal?.addEventListener("abort",()=>{m(o?.signal?.reason)});let _=o?.timeout??Ey,y=()=>m(R.fromError(Z.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(p,_,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let P=x=>{let S=this._responseHandlers.get(p);S?S(x):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,P),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(p),l(x)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(p),l(P)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Lo,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},Vo,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},ep,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||{},[ct]: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||{},[ct]: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||{},[ct]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=Ws(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Gs(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=Ws(e);this._notificationHandlers.set(o,n=>{let s=Gs(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"&&Os(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new R(Z.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(Z.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(Z.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(Z.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=Er.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ut(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(Z.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(ut(a.status))throw new R(Z.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=Er.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ut(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function ip(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function ap(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];ip(i)&&ip(s)?r[n]={...i,...s}:r[n]=s}return r}var Xm=Ja(Za(),1),eh=Ja(Ym(),1);function Ix(){let t=new Xm.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,eh.default)(t),t}var En=class{constructor(e){this._ajv=e??Ix()}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 Rn=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(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Nr,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},Lt,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 th(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 rh(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 On=class extends Ho{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ir.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 En,this.setRequestHandler(As,o=>this._oninitialize(o)),this.setNotificationHandler(Zs,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Bs,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Ir.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Rn(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ap(this._capabilities,e)}setRequestHandler(e,r){let n=Ro(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(jt(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=at(Or,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(Z.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=at(qt,p);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new R(Z.InvalidParams,`Invalid task creation result: ${_}`)}return m.data}let f=at(Jo,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(Z.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){rh(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&th(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:Vd.includes(r)?r:Es,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"},Co)}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(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Js,r):this.request({method:"sampling/createMessage",params:e},Nr,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},Lt,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},Lt,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(Z.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(Z.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},Hs,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"})}};import nh from"node:process";var In=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),Nx(r)}clear(){this._buffer=void 0}};function Nx(t){return Yd.parse(JSON.parse(t))}function oh(t){return JSON.stringify(t)+`
|
|
74
|
+
`}var Nn=class{constructor(e=nh.stdin,r=nh.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new In,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=oh(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};var Ue={general:`
|
|
75
|
+
# \u{1F5A5}\uFE0F ZeroWork RPA Architecture & Core Concepts
|
|
76
|
+
|
|
77
|
+
ZeroWork is a desktop-based Robotic Process Automation (RPA) platform designed to mimic human web interactions (clicking, typing, saving data).
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### \u{1F3DB}\uFE0F System Architecture
|
|
82
|
+
* **No Public REST API**: ZeroWork does NOT have a public REST API for creating, editing, or managing TaskBots.
|
|
83
|
+
* **External Integration**: Relies on **Webhooks** to trigger TaskBot runs remotely and pass dynamic data.
|
|
84
|
+
* **Outbound Data**: Uses the **Send HTTP Request** building block to transmit scraped data out to external services.
|
|
85
|
+
* **Dashboard & Creator Portal**: [creator.zerowork.io](https://creator.zerowork.io)
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### \u{1F511} Key Operational Concepts
|
|
90
|
+
|
|
91
|
+
1. **\u{1F916} TaskBots**: The core automation units that execute workflows inside a dedicated browser instance.
|
|
92
|
+
2. **\u{1F3D7}\uFE0F Building Blocks**: The modular actions (e.g., *Click*, *Save*, *Loop*, *Condition*, *HTTP Request*) assembled to form a TaskBot workflow.
|
|
93
|
+
3. **\u{1F517} Webhooks**: Dedicated URLs used to start a TaskBot run from external platforms (e.g., Claude, n8n, Zapier) and pass JSON payloads into the \`zw_webhook_data\` system variable.
|
|
94
|
+
4. **\u{1F500} Variables**: Temporary runtime data storage used for counters, dynamic text, or state tracking during a single TaskBot run.
|
|
95
|
+
5. **\u{1F4BF} Tables**: Structured data grids (*Native Tables* or *Google Sheets*) used for storing scraped data or feeding lists of items (e.g., profile links) into repeat loops.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### \u2699\uFE0F Advanced Execution Settings (Run Settings)
|
|
100
|
+
|
|
101
|
+
* **\u{1F4C5} Scheduler**: Allows scheduling recurring TaskBot runs directly from the creator dashboard.
|
|
102
|
+
* **\u{1F91D} TaskBot Sharing Options**: TaskBots can be shared via templates or direct links with other ZeroWork users.
|
|
103
|
+
* **\u{1F36A} Cookies & Authentication**: TaskBots maintain browser sessions. If a workflow accesses behind-login content (e.g., LinkedIn, Facebook), valid session cookies are required. Users can configure cookie preservation or add explicit login steps.
|
|
104
|
+
* **\u{1F6E1}\uFE0F Proxies**: To prevent IP bans or access region-locked content, users can assign HTTP/HTTPS/SOCKS5 proxies to specific TaskBots in Run Settings.
|
|
105
|
+
* **\u2601\uFE0F Remote (Cloud) Execution vs Local Agent**:
|
|
106
|
+
* **Local Agent (Default)**: TaskBots execute on the user's local machine via the background ZeroWork Agent.
|
|
107
|
+
* **Cloud Execution**: Runs entirely on ZeroWork's cloud infrastructure.
|
|
108
|
+
* **Windows VPS**: Users can install the ZeroWork Agent on a dedicated Windows Virtual Private Server (VPS) for 24/7 background automation.
|
|
109
|
+
* **\u{1F504} Agent Maintenance**: The ZeroWork Agent must be kept online and updated to the latest version to ensure stable websocket communication with the dashboard.
|
|
85
110
|
`,webhooks:`
|
|
86
|
-
Webhooks
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
111
|
+
# \u{1F517} ZeroWork Webhooks Guide (External Triggering & Dynamic Data)
|
|
112
|
+
|
|
113
|
+
Webhooks are the primary mechanism for controlling ZeroWork TaskBots programmatically from external AI agents, scripts, or workflow engines.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### \u{1F680} Configuration & Execution Flow
|
|
118
|
+
|
|
119
|
+
1. **Generate Webhook URL**:
|
|
120
|
+
* In the creator dashboard, open the TaskBot.
|
|
121
|
+
* Navigate to **Run Settings -> Trigger Run via Webhook**.
|
|
122
|
+
* Click **Generate Webhook URL**.
|
|
123
|
+
|
|
124
|
+
2. **Triggering Request**: Send an HTTP \`GET\` or \`POST\` request to the webhook URL.
|
|
125
|
+
* \`GET\` Request: Simply triggers the TaskBot run.
|
|
126
|
+
* \`POST\` Request (with JSON body): Triggers the run AND injects the JSON payload into the TaskBot's runtime environment.
|
|
127
|
+
|
|
128
|
+
3. **The \`zw_webhook_data\` Variable**:
|
|
129
|
+
* When a JSON payload is sent via \`POST\`, ZeroWork automatically stores the entire JSON object in a reserved system variable named \`zw_webhook_data\`.
|
|
130
|
+
|
|
131
|
+
4. **Extracting Dynamic Data (JSONPath)**:
|
|
132
|
+
* To use fields from the webhook payload inside building blocks (e.g., inserting a dynamic search query or recipient email), use JSONPath syntax within dynamic input fields.
|
|
133
|
+
* **Syntax**: \`{zw_webhook_data: $.propertyName}\`
|
|
134
|
+
* **Example**: If the webhook payload is \`{"email": "test@example.com", "filter": "coaches"}\`, use \`{zw_webhook_data: $.email}\` to insert the email address.
|
|
135
|
+
|
|
136
|
+
5. **Response & Queuing**:
|
|
137
|
+
* Webhook triggers return an immediate HTTP status acknowledging the trigger.
|
|
138
|
+
* If the local agent is busy or offline, runs may be queued or fail depending on agent availability.
|
|
91
139
|
`,variables:`
|
|
92
|
-
Variables
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
140
|
+
# \u{1F500} ZeroWork Variables Guide (State & Logic Management)
|
|
141
|
+
|
|
142
|
+
Variables provide flexible runtime storage for dynamic strings, numbers, and state flags across a TaskBot run.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### \u{1F4A1} Core Mechanics & Best Practices
|
|
147
|
+
|
|
148
|
+
* **\u23F3 Temporary Scope**: Variables persist only for the duration of the TaskBot run unless explicitly written to a Data Table.
|
|
149
|
+
* ** initializing & Setting**: Use the **Start Condition and Set Condition** block or **Update Data** block to assign initial values to variables.
|
|
150
|
+
* **\u{1F522} Counters & Quotas**: Variables are crucial for managing anti-spam limits (e.g., tracking the number of DMs sent).
|
|
151
|
+
* Use the **Number Operations** building block to increment or decrement a numeric variable (e.g., \`dm_counter + 1\`).
|
|
152
|
+
* **\u{1F500} Conditional Logic**: Use variables within **Start Condition** blocks to branch workflows or terminate loops early.
|
|
153
|
+
* *Example*: \`IF dm_counter >= 30 -> Break Repeat\`
|
|
154
|
+
* **\u{1F4DD} Dynamic Insertion**: Refer to variables inside any text input field using curly braces: \`{variable_name}\`.
|
|
97
155
|
`,tables:`
|
|
98
|
-
Tables
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
156
|
+
# \u{1F4BF} ZeroWork Data Tables Guide (Structured Data & Looping)
|
|
157
|
+
|
|
158
|
+
Data Tables serve as the primary database for TaskBots, enabling iterative loops over input lists and structured storage for scraped output.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### \u{1F5C2}\uFE0F Table Types & Architecture
|
|
163
|
+
|
|
164
|
+
1. **\u{1F4CA} Native Tables**: Built-in, high-performance local data grids. Supports direct CSV import and export. Ideal for rapid scraping or static contact lists.
|
|
165
|
+
2. **\u{1F4C8} Google Sheets Integration**: Live synchronization with external Google Sheets. Excellent for collaborative workflows, client-facing data, or multi-bot shared databases.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### \u{1F6E0}\uFE0F Google Sheets Advanced Mechanics & FAQs
|
|
170
|
+
|
|
171
|
+
* **\u{1F4E6} Batch Saving (Usage Limits)**: To prevent triggering Google Sheets API rate limits (quota errors), ZeroWork batches row updates.
|
|
172
|
+
* By default, TaskBots save updates to Google Sheets every **50 rows**.
|
|
173
|
+
* **Adjustment**: Users can change this batch size in the *Additional options* of the **Start Repeat** building block (e.g., setting batch size to \`1\` forces immediate saving after every single row).
|
|
174
|
+
* **\u{1F46F} Duplication Behavior**: If TaskBot A (linked to Google Sheet A) is duplicated to create TaskBot B, TaskBot B receives a new internal table ID but continues pointing to the SAME physical Google Sheet A. Users can click **"Edit Google Sheet link"** in TaskBot B to connect a new sheet without re-mapping column references, provided column names match exactly.
|
|
175
|
+
* **\u{1F510} Re-Authentication Workflow**: If Google Sheets authentication expires or corrupts, users must visit their Google Account settings -> **Data & Privacy -> Third-party apps -> ZeroWork -> "Delete all connections"**, then re-authenticate from the ZeroWork dashboard.
|
|
176
|
+
* **\u270F\uFE0F Column Modifications**: If columns are added, renamed, or deleted in Google Sheets, users MUST click **"Refetch columns from Google Sheet"** in the ZeroWork dashboard to update building block references. Column matching is case-insensitive.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### \u{1F9EE} Data Manipulation Blocks
|
|
181
|
+
|
|
182
|
+
* **\u{1F504} Update Data**: Used to write scraped text, timestamps, or variables into specific table columns. Can also transfer data between tables by referencing a source table column.
|
|
183
|
+
* **\u{1F9F9} Remove Duplicates**: Automatically cleans tables by deleting duplicate rows based on a specified unique column (e.g., \`profile_url\`).
|
|
184
|
+
* **\u{1F5D1}\uFE0F Delete Data / Clear Table**: Clears specific rows or entire tables at the start or end of a run.
|
|
185
|
+
`,selectors:"\n# \u{1F4D4} ZeroWork Selectors Master Class (Robust Element Targeting)\n\nWeb element selectors are critical for reliable browser automation. Brittle selectors cause bot failures when dynamic websites update their layout or class names.\n\n---\n\n### \u{1F3AF} Supported Selector Types\n* **CSS Selectors** (Primary & Recommended)\n* **XPath Selectors** (Advanced fallback)\n\n---\n\n### \u{1F3C6} Master Class Strategies & Syntax Rules\n\n#### 1. Exact Text Matching (ZeroWork Custom Syntax)\n* **Syntax**: `text=\"Exact String\"`\n* **Usage**: Targets buttons, tabs, or links with static labels.\n* **Example**: `button[text=\"Connect\"]` or `a[text=\"See more\"]`\n\n#### 2. Loose Text Matching (Partial/Dynamic Text)\n* **Syntax**: `text=Keyword` (WITHOUT quotes)\n* **Usage**: Targets elements where the text contains dynamic counts or changing phrasing.\n* **Example**: If a button says *\"Associated members (42)\"*, use `button[text=Associated members]`.\n\n#### 3. Loose Attribute Matching (Substring matching)\n* **Syntax**: `[attribute*='value']`\n* **Usage**: Targets elements with dynamic, auto-generated framework classes or complex URLs.\n* **Example**: `a[href*='friends_mutual']` or `div[class*='artdec-card']`\n* **Combining Attributes**: Target highly specific elements by chaining: `a[href*='/about'][role='tab']`\n\n#### 4. Structural Hierarchy & Lists\n* **Child Combinator (`>`)**: Selects direct children. *Example*: `ul.list-container > li`\n* **Descendant Combinator (` `)**: Selects any nested descendant. *Example*: `div.card-body span.title`\n* **List Indexing**: Use `:nth-child(n)` to target specific list items. Inside a **Start Repeat** loop, dynamically target the current item using ZeroWork system tokens: `:nth-child(loop_index, 0)` (0-indexed) or `:nth-child(loop_index, 1)` (1-indexed).\n\n#### 5. Advanced Strategies for Dynamic Sites (LinkedIn & Facebook)\n* **Text Filtering Operator (`>>`)**: Filters a broad structural selector by its inner text.\n * *Example*: To find an email address inside a generic contact modal containing multiple identical layout rows, use: `div.contact-info-row >> text=@`\n* **Complex Overlay Cards**: On sites like LinkedIn, an outer `<a>` tag or overlay often covers an entire card, trapping inner text and preventing direct text selection. \n * *Solution*: Use two separate building blocks/selectors. First, target the interactive link wrapper (e.g., `a[role=\"link\"]`), then use a separate **Save Web Element** block drilling down to the specific text node (e.g., `span[dir='auto'] > span > span`).\n* **Reliable Anchors**: Avoid relying on generic wrapper divs with dynamic IDs (e.g., `ember123`). Instead, anchor to stable semantic attributes like `aria-label` or `role` (e.g., `div[aria-label=\"Suggestions\"]`), then use child combinators to reach the target element.\n\n#### 6. Advanced Sibling Navigation (Solving Dynamic Section Order)\n* **Problem**: On LinkedIn or Facebook profiles, section order is dynamic (e.g., Profile A has About, Activity, Experience; Profile B lacks Activity, making Experience move from `nth-child(4)` to `nth-child(3)`). Relying on `section:nth-child(4)` will fail.\n* **Solution**: Anchor to the unique header ID inside the section, then navigate to its sibling content container using sibling combinators.\n * **Adjacent Sibling (`+`)**: Targets the element immediately following. *Example*: `h2#experience-header + div.content`\n * **General Sibling (`~`)**: Targets any following sibling on the same hierarchy level. *Example*: `div#experience ~ div.pvs-list` (finds the experience list container regardless of intermediate structural headers).\n",building_blocks:`
|
|
186
|
+
# \u{1F3D7}\uFE0F ZeroWork Building Blocks Reference (Comprehensive Catalog)
|
|
187
|
+
|
|
188
|
+
Building blocks are the operational units of a TaskBot. They are categorized by function into Browser, Web Interaction, Logic, Data, External, Files, and Tools.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
### \u{1F310} 1. Browser Operations
|
|
193
|
+
|
|
194
|
+
* **\u{1F517} Open Link**: Navigates the active browser tab to a specified URL. Supports dynamic input (e.g., table columns \`{profile_url}\`).
|
|
195
|
+
* **\u{1F4BE} Save Page URL**: Captures the current browser tab's URL and stores it in a variable or table column.
|
|
196
|
+
* **\u{1F500} Switch or Close Tab**: Manages multi-tab workflows. Can switch to newly opened tabs or close active ones to free memory.
|
|
197
|
+
* **\u25C0\uFE0F Go Back or Forward**: Simulates browser navigation history buttons.
|
|
198
|
+
* **\u{1F680} Launch / Quit Browser**: Explicitly starts or terminates the browser instance.
|
|
199
|
+
* **\u{1F5BC}\uFE0F Switch Frame**: Essential for interacting with iframes (e.g., embedded forms, payment gateways, third-party widgets). Must be executed before targeting elements inside an iframe.
|
|
200
|
+
* **\u26A0\uFE0F Browser Alert**: Handles native javascript alerts, prompts, and confirmation dialogs.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### \u{1F5B1}\uFE0F 2. Web Interaction
|
|
205
|
+
|
|
206
|
+
* **\u{1F446} Click Web Element**: Simulates a human click on a target CSS/XPath selector. Includes built-in auto-retry mechanisms.
|
|
207
|
+
* **\u{1F50D} Check Web Element**: Non-blocking diagnostic block. Scans the DOM for a selector and sets a boolean flag (\`true\`/\`false\`) in a variable. Crucial for conditional branching (e.g., checking if a "Premium Required" modal or "Private Account" banner is visible). *Note: Check Web Element does NOT wait for elements or interact with them.*
|
|
208
|
+
* **\u{1F4E5} Save Web Element**: Extracts text, HTML attributes (e.g., \`href\`, \`src\`), or counts from a web element and writes to variables/tables.
|
|
209
|
+
* **\u270D\uFE0F Insert Text or Data**: Types text into input fields, textareas, or WYSIWYG editors. Supports simulated human typing delays.
|
|
210
|
+
* **\u2728 Hover Web Element**: Simulates mouse hover to trigger dropdowns, tooltips, or dynamic mega-menus.
|
|
211
|
+
* **\u{1F53D} Select Web Dropdown**: Interacts with standard HTML \`<select>\` dropdowns by value, index, or visible text.
|
|
212
|
+
* **\u2328\uFE0F Keyboard Action**: Simulates pressing specific keys (\`Enter\`, \`Tab\`, \`Escape\`, \`Arrows\`) or key combinations (\`Ctrl+C\`, \`Ctrl+V\`).
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### \u{1F500} 3. Logic & Flow Control
|
|
217
|
+
|
|
218
|
+
* **\u2753 Start Condition & Set Condition**: Evaluates \`IF\`/\`ELSE\` logic based on variables, table data, or Check Web Element flags.
|
|
219
|
+
* **\u{1F501} Start Repeat**: Initiates a loop. Can loop over Data Table rows (*Dynamic Loop*) or repeat a set number of times (*Standard Loop*). Supports *'Auto-detect number of elements'* using a CSS selector to loop exactly as many times as matching elements exist on the page.
|
|
220
|
+
* **\u{1F517} After Repeat**: Executes actions immediately after a loop completes successfully. Used for chaining workflows.
|
|
221
|
+
* **\u{1F6D1} Break Repeat**: Instantly terminates the current loop and jumps to the After Repeat block.
|
|
222
|
+
* **\u{1F6E1}\uFE0F Try-Catch**: Error handling wrapper. If blocks inside the 'Try' branch fail (e.g., element not found), execution switches gracefully to the 'Catch' branch rather than aborting the bot.
|
|
223
|
+
* **\u274C Raise Error / Abort Run**: Explicitly stops the TaskBot and logs a custom error message to the Run Report.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### \u{1F9EE} 4. Data Operations
|
|
228
|
+
|
|
229
|
+
* **\u{1F4DD} Update Data**: Writes or transfers data across variables and table columns.
|
|
230
|
+
* **\u2795 Number Operations**: Performs mathematical functions (add, subtract, multiply, divide) on numeric variables.
|
|
231
|
+
* **\u2728 Format Data**: Trims whitespace, changes case (upper/lower), or formats date/number strings.
|
|
232
|
+
* **\u2702\uFE0F Split Data**: Splits a string by a delimiter (e.g., splitting "John Doe" by space into \`first_name\` and \`last_name\`).
|
|
233
|
+
* **\u{1F50D} Apply Regex**: Executes regular expressions to extract specific patterns (e.g., extracting phone numbers or tracking IDs from raw text).
|
|
234
|
+
* **\u{1F9F9} Remove Duplicates**: Cleans data tables by purging duplicate rows.
|
|
235
|
+
* **\u{1F5D1}\uFE0F Delete Data**: Clears specified table rows or variables.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### \u{1F50C} 5. External Integrations & Scripting
|
|
240
|
+
|
|
241
|
+
* **\u{1F916} Ask ChatGPT**: Sends prompts to OpenAI's API. Supports injecting variables into prompts and saving AI responses to tables. Requires configuring OpenAI API keys in ZeroWork settings.
|
|
242
|
+
* **\u{1F514} Send Notification**: Sends automated email or webhook alerts upon specific bot events.
|
|
243
|
+
* **\u{1F310} APIs: Send HTTP Request**: Fully functional REST client block for making \`GET\`/\`POST\`/\`PUT\`/\`DELETE\` requests to external APIs.
|
|
244
|
+
* **\u26A1 Write JavaScript**: Executes custom client-side vanilla JavaScript directly within the context of the active browser page.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
### \u{1F4C1} 6. Files & OS Tools
|
|
249
|
+
|
|
250
|
+
* **\u{1F4BE} Save File / Upload File**: Manages local OS file downloading and uploading via browser dialogs.
|
|
251
|
+
* **\u23F3 Delay**: Pauses bot execution for a fixed or randomized duration (e.g., 5-10 seconds). Essential for anti-bot evasion.
|
|
252
|
+
* **\u{1F4C5} Record Date**: Captures the current system timestamp.
|
|
253
|
+
* **\u{1F4F8} Take Screenshot**: Captures a full or partial viewport screenshot and saves it locally or attaches to the run report.
|
|
254
|
+
* **\u{1F4CB} Save from Clipboard / Log**: Reads OS clipboard or writes debug messages to the ZeroWork console.
|
|
117
255
|
`,anti_bot:`
|
|
118
|
-
Anti-Bot
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
256
|
+
# \u{1F6E1}\uFE0F ZeroWork Anti-Bot Evasion & Reliability Best Practices
|
|
257
|
+
|
|
258
|
+
Modern web applications (LinkedIn, Facebook, Google, Instagram) employ sophisticated bot detection mechanisms. Implementing human-like behavior is mandatory to prevent account restrictions.
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
### \u{1F31F} Core Evasion Strategies
|
|
263
|
+
|
|
264
|
+
1. **\u{1F3B2} Randomized Delays**: Never use fixed, predictable delays. Always use randomized delay ranges (e.g., \`8\` to \`14\` seconds) between major page navigations and interactions.
|
|
265
|
+
2. **\u{1F4CA} Quota Management & Repetition Limits**: Configure strict daily and per-run limits in **Start Repeat** blocks (e.g., maximum 25-30 profile views per run) to stay well below platform rate limits.
|
|
266
|
+
3. **\u{1F4A4} Snooze / Pause Strategy**: Use conditional logic to pause the bot after a burst of actions.
|
|
267
|
+
* *Example*: \`IF actions_count >= 10 -> Delay for 15 minutes\`
|
|
268
|
+
4. **\u{1F441}\uFE0F Pre-Action DOM Verification**: Use **Check Web Element** before attempting interactions to verify page state (e.g., check for *"Account Restricted"*, *"Page Not Found"*, or *"Security Check"* banners). If detected, use **Break Repeat** or **Abort Run** immediately.
|
|
269
|
+
5. **\u{1F50F} Idempotent Execution (Preventing Duplicate Outreach)**: Always record processed profiles (e.g., saving profile URLs to a \`contacted_users\` table) and use **Remove Duplicates** or pre-check conditions to guarantee the bot never messages the same recipient twice.
|
|
124
270
|
`,troubleshooting:`
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
271
|
+
# \u{1F6E0}\uFE0F ZeroWork Deep Troubleshooting & Diagnostic Guide
|
|
272
|
+
|
|
273
|
+
When a TaskBot fails, systematically diagnose the issue using the Run Reports and local environment checks.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
### \u274C 1. TaskBot Does Not Start Run (Startup Failures)
|
|
278
|
+
|
|
279
|
+
* **Symptom**: Clicking 'Run' results in an immediate failure or indefinite spinning without launching the browser.
|
|
280
|
+
* **\u{1F50D} Cause A (Local Agent Offline/Blocked)**: The ZeroWork Agent is offline, disconnected, or blocked by OS security.
|
|
281
|
+
* **\u{1F4A1} Solution**: Verify the agent icon in the system tray is green. Check Windows SmartScreen, Windows Defender, or third-party Antivirus/Firewalls which frequently flag local websocket agents. Add an explicit exclusion for the ZeroWork Agent installation directory.
|
|
282
|
+
* **\u{1F50D} Cause B (Browser Shields / Ad Blockers)**: If triggering via a web dashboard, aggressive browser shields (specifically Brave Browser Shields or UBlock Origin) block background localhost websocket connections (\`ws://127.0.0.1\`) required to signal the local agent.
|
|
283
|
+
* **\u{1F4A1} Solution**: Disable Brave Shields or ad-blockers for \`creator.zerowork.io\`.
|
|
284
|
+
* **\u{1F50D} Cause C (VPN / Network Adapters)**: Enterprise VPNs or virtual network adapters (e.g., VMware/VirtualBox adapters) can route localhost traffic incorrectly.
|
|
285
|
+
* **\u{1F4A1} Solution**: Temporarily disable VPNs or secondary network adapters and restart the agent.
|
|
286
|
+
* **\u{1F50D} Cause D (Stay on Page Setting)**: The bot actually ran successfully but finished in 1 second and closed the window instantly.
|
|
287
|
+
* **\u{1F4A1} Solution**: Enable **Run Settings -> Stay on Page after Run** to keep the browser window open for inspection.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
### \u23F3 2. "No Selector Found" / Element Timeout Errors
|
|
292
|
+
|
|
293
|
+
* **Symptom**: TaskBot stops execution with a red error stating a CSS/XPath selector could not be found.
|
|
294
|
+
* **\u{1F50D} Cause A (Dynamic Page Loading)**: The website is a Single Page Application (SPA) like LinkedIn/React that takes longer to render DOM nodes than the default block timeout.
|
|
295
|
+
* **\u{1F4A1} Solution**: Insert an explicit **Delay** block (e.g., 3-5 seconds) before the interaction, or use **Check Web Element** in a retry loop.
|
|
296
|
+
* **\u{1F50D} Cause B (Brittle/Auto-Generated Selectors)**: The selector relies on dynamic class strings (e.g., \`.button-primary-abc12\`) that changed upon page reload.
|
|
297
|
+
* **\u{1F4A1} Solution**: Replace with robust semantic attributes (e.g., \`button[text="Submit"]\` or \`[aria-label="Submit"]\`).
|
|
298
|
+
* **\u{1F50D} Cause C (IFrame Encapsulation)**: The target element is rendered inside an iframe (e.g., a Stripe payment popup or embedded chat widget).
|
|
299
|
+
* **\u{1F4A1} Solution**: Add a **Switch Frame** building block targeting the iframe wrapper before attempting to select the inner element.
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
### \u{1F4ED} 3. Table Data Pulling Failures ("No Data is Being Pulled")
|
|
304
|
+
|
|
305
|
+
* **Symptom**: A repeat loop fails to execute, or dynamic inputs like \`{profile_url}\` resolve to blank strings.
|
|
306
|
+
* **\u{1F50D} Cause A (Column Name Mismatch)**: The column name in the building block contains leading/trailing spaces or typos compared to the physical table.
|
|
307
|
+
* **\u{1F4A1} Solution**: Re-verify exact column headers. Use **"Refetch columns from Google Sheet"** if using Sheets.
|
|
308
|
+
* **\u{1F50D} Cause B (Google Sheets Auth/Session Expiry)**: The background OAuth token connecting ZeroWork to Google Drive expired or was revoked.
|
|
309
|
+
* **\u{1F4A1} Solution**: Perform the full Google Account Data & Privacy connection reset workflow, then re-authenticate.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
### \u26A0\uFE0F 4. Check Web Element Finds Element but Subsequent Click Fails
|
|
314
|
+
|
|
315
|
+
* **Symptom**: **Check Web Element** successfully evaluates to \`true\`, but the next **Click Web Element** block targeting the same element fails.
|
|
316
|
+
* **\u{1F50D} Cause**: **Check Web Element** is purely diagnostic; it confirms the DOM node exists in the background HTML but does NOT ensure the element is visibly rendered, un-obscured, or clickable on screen.
|
|
317
|
+
* **\u{1F4A1} Solution**: Add a **Hover Web Element** or **Delay** block between the check and the click to ensure any overlapping animation/modal finishes rendering.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
### \u{1F36A} 5. Handling Expired Session Cookies
|
|
322
|
+
|
|
323
|
+
* **Symptom**: TaskBot unexpectedly redirects to a login page or fails to find authenticated UI elements.
|
|
324
|
+
* **\u{1F4A1} Solution**: Configure a **Check Web Element** at the very start of the run to verify the presence of a known logged-in element (e.g., a user profile avatar). If missing, trigger a **Send Notification** block alerting the user to re-login and update session cookies in Run Settings.
|
|
325
|
+
`};var Ax=()=>{let t=process.env.ZEROWORK_BOTS;if(!t)return{};try{return JSON.parse(t)}catch{return console.error("Failed to parse ZEROWORK_BOTS environment variable. Must be valid JSON."),{}}},lo=new On({name:"nagoc-zerowork",version:"1.0.9"},{capabilities:{tools:{},resources:{}}});lo.setRequestHandler(js,async()=>({resources:[{uri:"resource://zerowork/general",name:"ZeroWork General Knowledge",mimeType:"text/plain",description:"General concepts about ZeroWork RPA, TaskBots, and Architecture"},{uri:"resource://zerowork/webhooks",name:"ZeroWork Webhooks Guide",mimeType:"text/plain",description:"How to trigger ZeroWork bots and pass dynamic data via webhooks"},{uri:"resource://zerowork/variables",name:"ZeroWork Variables Guide",mimeType:"text/plain",description:"How variables work in ZeroWork"},{uri:"resource://zerowork/tables",name:"ZeroWork Tables Guide",mimeType:"text/plain",description:"How data tables work in ZeroWork"},{uri:"resource://zerowork/selectors",name:"ZeroWork Selectors Guide",mimeType:"text/plain",description:"How CSS and XPath selectors work in ZeroWork"},{uri:"resource://zerowork/loops",name:"ZeroWork Loops Guide",mimeType:"text/plain",description:"How loops and repeats work in ZeroWork"},{uri:"resource://zerowork/chatgpt",name:"ZeroWork ChatGPT Guide",mimeType:"text/plain",description:"How to integrate ChatGPT via Ask ChatGPT block"},{uri:"resource://zerowork/anti_bot",name:"ZeroWork Anti-Bot Guide",mimeType:"text/plain",description:"Best practices to avoid bot detection and handle dynamic states"},{uri:"resource://zerowork/troubleshooting",name:"ZeroWork Troubleshooting Guide",mimeType:"text/plain",description:"Common problems and troubleshooting steps"},{uri:"resource://zerowork/building_blocks",name:"ZeroWork Building Blocks Guide",mimeType:"text/plain",description:"Comprehensive catalog of all ZeroWork building blocks and their options"}]}));lo.setRequestHandler(qs,async t=>{let e=t.params.uri,r="";if(e==="resource://zerowork/general")r=Ue.general;else if(e==="resource://zerowork/webhooks")r=Ue.webhooks;else if(e==="resource://zerowork/variables")r=Ue.variables;else if(e==="resource://zerowork/tables")r=Ue.tables;else if(e==="resource://zerowork/selectors")r=Ue.selectors;else if(e==="resource://zerowork/loops")r=Ue.loops;else if(e==="resource://zerowork/chatgpt")r=Ue.chatgpt;else if(e==="resource://zerowork/anti_bot")r=Ue.anti_bot;else if(e==="resource://zerowork/troubleshooting")r=Ue.troubleshooting;else if(e==="resource://zerowork/building_blocks")r=Ue.building_blocks;else throw new Error(`Resource not found: ${e}`);return{contents:[{uri:e,mimeType:"text/plain",text:r}]}});lo.setRequestHandler(Vs,async()=>({tools:[{name:"list_taskbots",description:"Lists all configured TaskBots and their names that are available to trigger.",inputSchema:{type:"object",properties:{}}},{name:"trigger_taskbot",description:"Triggers a specific ZeroWork TaskBot by its configured name. Does not send data.",inputSchema:{type:"object",properties:{botName:{type:"string",description:"The name of the TaskBot to trigger (must be one from list_taskbots)"}},required:["botName"]}},{name:"trigger_taskbot_with_data",description:"Triggers a specific ZeroWork TaskBot and sends dynamic JSON data to its zw_webhook_data variable.",inputSchema:{type:"object",properties:{botName:{type:"string",description:"The name of the TaskBot to trigger"},payload:{type:"object",description:"The JSON object payload to send to the bot"}},required:["botName","payload"]}},{name:"trigger_webhook_url",description:"Triggers an arbitrary ZeroWork webhook URL directly.",inputSchema:{type:"object",properties:{url:{type:"string",description:"The full ZeroWork webhook URL"},payload:{type:"object",description:"Optional JSON object payload to send to the bot"}},required:["url"]}},{name:"generate_robust_selector",description:"Analyzes an HTML snippet and target requirements to generate robust, non-brittle CSS and XPath selectors tailored for ZeroWork TaskBots.",inputSchema:{type:"object",properties:{htmlSnippet:{type:"string",description:"The raw HTML snippet containing the target element and its surrounding container hierarchy."},targetText:{type:"string",description:"Optional exact or partial visible text of the target element (e.g., 'Connect', 'Follow')."},description:{type:"string",description:"Optional description of what the element is or its context (e.g., 'The experience list container on LinkedIn', 'Submit button on a dynamic form')."}},required:["htmlSnippet"]}},{name:"get_mcp_version",description:"Returns the version of this MCP server package currently running.",inputSchema:{type:"object",properties:{}}}]}));lo.setRequestHandler(Or,async t=>{let{name:e,arguments:r}=t.params,o=Ax();try{if(e==="list_taskbots"){let n=Object.keys(o);return n.length===0?{content:[{type:"text",text:'No TaskBots are configured. Please set the ZEROWORK_BOTS environment variable in your Claude config (e.g., {"myBot": "https://hook.zerowork.io/..."}).'}]}:{content:[{type:"text",text:`Configured TaskBots:
|
|
133
326
|
${n.map(s=>`- ${s}`).join(`
|
|
134
327
|
`)}`}]}}if(e==="trigger_taskbot"||e==="trigger_taskbot_with_data"){let n=String(r?.botName),s=o[n];if(!s)throw new Error(`Bot '${n}' not found in configuration. Use list_taskbots to see available bots.`);let i=e==="trigger_taskbot_with_data",a=i?r?.payload:null,c={method:i?"POST":"GET",headers:i?{"Content-Type":"application/json"}:void 0,body:i?JSON.stringify(a):void 0},u=await fetch(s,c),l=await u.text();return{content:[{type:"text",text:`Successfully triggered ${n}.
|
|
135
328
|
Status: ${u.status}
|
|
136
329
|
Response: ${l}`}]}}if(e==="trigger_webhook_url"){let n=String(r?.url),s=r?.payload,i={method:s?"POST":"GET",headers:s?{"Content-Type":"application/json"}:void 0,body:s?JSON.stringify(s):void 0},a=await fetch(n,i),c=await a.text();return{content:[{type:"text",text:`Successfully triggered webhook.
|
|
137
330
|
Status: ${a.status}
|
|
138
|
-
Response: ${c}`}]}}if(e==="
|
|
331
|
+
Response: ${c}`}]}}if(e==="generate_robust_selector"){let n=String(r?.htmlSnippet||""),s=r?.targetText?String(r.targetText):null,i=r?.description?String(r.description):null,a=`### ZeroWork Robust Selector Analysis
|
|
332
|
+
|
|
333
|
+
`;return i&&(a+=`**Target Context**: ${i}
|
|
334
|
+
|
|
335
|
+
`),s&&(a+=`**Target Visible Text**: "${s}"
|
|
336
|
+
|
|
337
|
+
`),a+=`#### \u{1F6E0}\uFE0F Recommended Selector Strategies for ZeroWork
|
|
338
|
+
|
|
339
|
+
`,s&&(a+=`**1. Exact Text Match (ZeroWork Custom Syntax)**:
|
|
340
|
+
`,a+=`If the element is a button, link, or tab with stable text, use exact text matching:
|
|
341
|
+
`,a+=`\`\`\`css
|
|
342
|
+
[text="${s}"]
|
|
343
|
+
\`\`\`
|
|
344
|
+
`,a+=`*Example*: \`button[text="${s}"]\` or \`a[text="${s}"]\`
|
|
345
|
+
|
|
346
|
+
`,a+=`**2. Loose Text Match (Dynamic/Partial Text)**:
|
|
347
|
+
`,a+=`If the text contains dynamic numbers (e.g., counts) or changing phrasing, use loose matching (without quotes):
|
|
348
|
+
`,a+=`\`\`\`css
|
|
349
|
+
text=${s.split(" ")[0]}
|
|
350
|
+
\`\`\`
|
|
351
|
+
`,a+=`*Example*: \`button[text=${s.split(" ")[0]}]\`
|
|
352
|
+
|
|
353
|
+
`),a+=`**3. Semantic Attribute Anchoring**:
|
|
354
|
+
`,a+="Scan the HTML snippet for stable, non-brittle attributes like `aria-label`, `role`, `name`, or `data-test-id`.\n",a+="Avoid auto-generated utility classes (e.g., `.css-1abc`, `.ember123`).\n",a+="*Loose Attribute Syntax*: `[attribute*='value']` (matches substrings).\n",a+=`*Example*: \`div[aria-label*='${s||"Submit"}']\` or \`input[name*='email']\`
|
|
355
|
+
|
|
356
|
+
`,a+=`**4. Handling Complex Overlay Cards (LinkedIn/Facebook)**:
|
|
357
|
+
`,a+="If an outer `<a>` wrapper covers an entire card and traps inner text, do NOT attempt a single selector. Instead, use two building blocks:\n",a+='- Block 1 (Action): Target the clickable wrapper (e.g., `a[role="link"]`).\n',a+="- Block 2 (Extraction): Drill down to the inner text node (e.g., `span[dir='auto'] > span > span`).\n\n",a+=`**5. Dynamic Section Order (Sibling Navigation)**:
|
|
358
|
+
`,a+="If targeting a section where order changes between profiles (e.g., Experience section moving from 3rd to 4th position), avoid `:nth-child()`. Anchor to the unique header ID and use the general sibling combinator (`~`):\n",a+="```css\ndiv#experience ~ div.pvs-list\n```\n\n",a+=`#### \u{1F50D} Provided HTML Snippet Reference
|
|
359
|
+
\`\`\`html
|
|
360
|
+
${n.slice(0,500)}${n.length>500?`
|
|
361
|
+
... (truncated)`:""}
|
|
362
|
+
\`\`\`
|
|
363
|
+
|
|
364
|
+
`,a+="*Guidance*: Use the strategies above to construct your selector in ZeroWork. Test the selector in your browser console using `document.querySelectorAll('your-selector')` to verify uniqueness before adding it to your TaskBot.",{content:[{type:"text",text:a}]}}if(e==="get_mcp_version")return{content:[{type:"text",text:"nagoc-zerowork version 1.0.9"}]};throw new Error(`Unknown tool: ${e}`)}catch(n){return{content:[{type:"text",text:`Error executing tool ${e}: ${n.message}`}],isError:!0}}});async function Zx(){let t=new Nn;await lo.connect(t),console.error("ZeroWork MCP Server running on stdio")}Zx().catch(t=>{console.error("Fatal error in main():",t),process.exit(1)});
|