zion-mcp 2.8.6 → 2.8.7

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.
@@ -1,16 +1,16 @@
1
1
  import { createRequire as __nodeCreateRequire } from 'node:module';
2
2
  const require = __nodeCreateRequire(import.meta.url);
3
- import{d as ko,e as Un,h as Au,i as Su}from"./chunk-ZGX656ZG.js";import{c as N,d as Rs,e as Iu,g as u}from"./chunk-WRU7YLUO.js";var to=N(te=>{"use strict";u();Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Qr=class{};te._CodeOrName=Qr;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var In=class extends Qr{constructor(e){if(super(),!te.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}}};te.Name=In;var tt=class extends Qr{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((n,r)=>`${n}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((n,r)=>(r instanceof In&&(n[r.str]=(n[r.str]||0)+1),n),{})}};te._Code=tt;te.nil=new tt("");function Sm(t,...e){let n=[t[0]],r=0;for(;r<e.length;)El(n,e[r]),n.push(t[++r]);return new tt(n)}te._=Sm;var yl=new tt("+");function Om(t,...e){let n=[eo(t[0])],r=0;for(;r<e.length;)n.push(yl),El(n,e[r]),n.push(yl,eo(t[++r]));return Ev(n),new tt(n)}te.str=Om;function El(t,e){e instanceof tt?t.push(...e._items):e instanceof In?t.push(e):t.push(wv(e))}te.addCodeArg=El;function Ev(t){let e=1;for(;e<t.length-1;){if(t[e]===yl){let n=Tv(t[e-1],t[e+1]);if(n!==void 0){t.splice(e-1,3,n);continue}t[e++]="+"}e++}}function Tv(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof In||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 In))return`"${t}${e.slice(1)}`}function bv(t,e){return e.emptyStr()?t:t.emptyStr()?e:Om`${t}${e}`}te.strConcat=bv;function wv(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:eo(Array.isArray(t)?t.join(","):t)}function vv(t){return new tt(eo(t))}te.stringify=vv;function eo(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}te.safeStringify=eo;function Iv(t){return typeof t=="string"&&te.IDENTIFIER.test(t)?new tt(`.${t}`):Sm`[${t}]`}te.getProperty=Iv;function Av(t){if(typeof t=="string"&&te.IDENTIFIER.test(t))return new tt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}te.getEsmExportName=Av;function Sv(t){return new tt(t.toString())}te.regexpCode=Sv});var wl=N(Ze=>{"use strict";u();Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ValueScope=Ze.ValueScopeName=Ze.Scope=Ze.varKinds=Ze.UsedValueState=void 0;var Ge=to(),Tl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Ma;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Ma||(Ze.UsedValueState=Ma={}));Ze.varKinds={const:new Ge.Name("const"),let:new Ge.Name("let"),var:new Ge.Name("var")};var za=class{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof Ge.Name?e:this.name(e)}name(e){return new Ge.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,r;if(!((r=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||r===void 0)&&r.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}}};Ze.Scope=za;var Ua=class extends Ge.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,Ge._)`.${new Ge.Name(n)}[${r}]`}};Ze.ValueScopeName=Ua;var Ov=(0,Ge._)`\n`,bl=class extends za{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Ov:Ge.nil}}get(){return this._scope}name(e){return new Ua(e,this._newName(e))}value(e,n){var r;if(n.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:a}=o,s=(r=n.key)!==null&&r!==void 0?r:n.ref,i=this._values[a];if(i){let h=i.get(s);if(h)return h}else i=this._values[a]=new Map;i.set(s,o);let l=this._scope[a]||(this._scope[a]=[]),d=l.length;return l[d]=n.ref,o.setValue(n,{property:a,itemIndex:d}),o}getValue(e,n){let r=this._values[e];if(r)return r.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,r=>{if(r.scopePath===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return(0,Ge._)`${e}${r.scopePath}`})}scopeCode(e=this._values,n,r){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},n,r)}_reduceValues(e,n,r={},o){let a=Ge.nil;for(let s in e){let i=e[s];if(!i)continue;let l=r[s]=r[s]||new Map;i.forEach(d=>{if(l.has(d))return;l.set(d,Ma.Started);let h=n(d);if(h){let p=this.opts.es5?Ze.varKinds.var:Ze.varKinds.const;a=(0,Ge._)`${a}${p} ${d} = ${h};${this.opts._n}`}else if(h=o?.(d))a=(0,Ge._)`${a}${h}${this.opts._n}`;else throw new Tl(d);l.set(d,Ma.Completed)})}return a}};Ze.ValueScope=bl});var q=N(V=>{"use strict";u();Object.defineProperty(V,"__esModule",{value:!0});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var X=to(),lt=wl(),Bt=to();Object.defineProperty(V,"_",{enumerable:!0,get:function(){return Bt._}});Object.defineProperty(V,"str",{enumerable:!0,get:function(){return Bt.str}});Object.defineProperty(V,"strConcat",{enumerable:!0,get:function(){return Bt.strConcat}});Object.defineProperty(V,"nil",{enumerable:!0,get:function(){return Bt.nil}});Object.defineProperty(V,"getProperty",{enumerable:!0,get:function(){return Bt.getProperty}});Object.defineProperty(V,"stringify",{enumerable:!0,get:function(){return Bt.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:!0,get:function(){return Bt.regexpCode}});Object.defineProperty(V,"Name",{enumerable:!0,get:function(){return Bt.Name}});var Za=wl();Object.defineProperty(V,"Scope",{enumerable:!0,get:function(){return Za.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:!0,get:function(){return Za.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:!0,get:function(){return Za.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:!0,get:function(){return Za.varKinds}});V.operators={GT:new X._Code(">"),GTE:new X._Code(">="),LT:new X._Code("<"),LTE:new X._Code("<="),EQ:new X._Code("==="),NEQ:new X._Code("!=="),NOT:new X._Code("!"),OR:new X._Code("||"),AND:new X._Code("&&"),ADD:new X._Code("+")};var Nt=class{optimizeNodes(){return this}optimizeNames(e,n){return this}},vl=class extends Nt{constructor(e,n,r){super(),this.varKind=e,this.name=n,this.rhs=r}render({es5:e,_n:n}){let r=e?lt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=ar(this.rhs,e,n)),this}get names(){return this.rhs instanceof X._CodeOrName?this.rhs.names:{}}},Fa=class extends Nt{constructor(e,n,r){super(),this.lhs=e,this.rhs=n,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof X.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ar(this.rhs,e,n),this}get names(){let e=this.lhs instanceof X.Name?{}:{...this.lhs.names};return Ga(e,this.rhs)}},Il=class extends Fa{constructor(e,n,r,o){super(e,r,o),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Al=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Sl=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Ol=class extends Nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Nl=class extends Nt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=ar(this.code,e,n),this}get names(){return this.code instanceof X._CodeOrName?this.code.names:{}}},no=class extends Nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,r)=>n+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let r=e[n].optimizeNodes();Array.isArray(r)?e.splice(n,1,...r):r?e[n]=r:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:r}=this,o=r.length;for(;o--;){let a=r[o];a.optimizeNames(e,n)||(Nv(e,a.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>On(e,n.names),{})}},Pt=class extends no{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Pl=class extends no{},or=class extends Pt{};or.kind="else";var An=class t extends Pt{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new or(r):r}if(n)return e===!1?n instanceof t?n:n.nodes:this.nodes.length?this:new t(Nm(e),n instanceof t?[n]:n.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,n),!!(super.optimizeNames(e,n)||this.else))return this.condition=ar(this.condition,e,n),this}get names(){let e=super.names;return Ga(e,this.condition),this.else&&On(e,this.else.names),e}};An.kind="if";var Sn=class extends Pt{};Sn.kind="for";var Cl=class extends Sn{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=ar(this.iteration,e,n),this}get names(){return On(super.names,this.iteration.names)}},Dl=class extends Sn{constructor(e,n,r,o){super(),this.varKind=e,this.name=n,this.from=r,this.to=o}render(e){let n=e.es5?lt.varKinds.var:this.varKind,{name:r,from:o,to:a}=this;return`for(${n} ${r}=${o}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){let e=Ga(super.names,this.from);return Ga(e,this.to)}},ja=class extends Sn{constructor(e,n,r,o){super(),this.loop=e,this.varKind=n,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=ar(this.iterable,e,n),this}get names(){return On(super.names,this.iterable.names)}},ro=class extends Pt{constructor(e,n,r){super(),this.name=e,this.args=n,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};ro.kind="func";var oo=class extends no{render(e){return"return "+super.render(e)}};oo.kind="return";var Rl=class extends Pt{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(n=this.finally)===null||n===void 0||n.optimizeNodes(),this}optimizeNames(e,n){var r,o;return super.optimizeNames(e,n),(r=this.catch)===null||r===void 0||r.optimizeNames(e,n),(o=this.finally)===null||o===void 0||o.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&On(e,this.catch.names),this.finally&&On(e,this.finally.names),e}},ao=class extends Pt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};ao.kind="catch";var so=class extends Pt{render(e){return"finally"+super.render(e)}};so.kind="finally";var kl=class{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?`
4
- `:""},this._extScope=e,this._scope=new lt.Scope({parent:e}),this._nodes=[new Pl]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,n){let r=this._extScope.value(e,n);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,n){return this._extScope.getValue(e,n)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,n,r,o){let a=this._scope.toName(n);return r!==void 0&&o&&(this._constants[a.str]=r),this._leafNode(new vl(e,a,r)),a}const(e,n,r){return this._def(lt.varKinds.const,e,n,r)}let(e,n,r){return this._def(lt.varKinds.let,e,n,r)}var(e,n,r){return this._def(lt.varKinds.var,e,n,r)}assign(e,n,r){return this._leafNode(new Fa(e,n,r))}add(e,n){return this._leafNode(new Il(e,V.operators.ADD,n))}code(e){return typeof e=="function"?e():e!==X.nil&&this._leafNode(new Nl(e)),this}object(...e){let n=["{"];for(let[r,o]of e)n.length>1&&n.push(","),n.push(r),(r!==o||this.opts.es5)&&(n.push(":"),(0,X.addCodeArg)(n,o));return n.push("}"),new X._Code(n)}if(e,n,r){if(this._blockNode(new An(e)),n&&r)this.code(n).else().code(r).endIf();else if(n)this.code(n).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new An(e))}else(){return this._elseNode(new or)}endIf(){return this._endBlockNode(An,or)}_for(e,n){return this._blockNode(e),n&&this.code(n).endFor(),this}for(e,n){return this._for(new Cl(e),n)}forRange(e,n,r,o,a=this.opts.es5?lt.varKinds.var:lt.varKinds.let){let s=this._scope.toName(e);return this._for(new Dl(a,s,n,r),()=>o(s))}forOf(e,n,r,o=lt.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let s=n instanceof X.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,X._)`${s}.length`,i=>{this.var(a,(0,X._)`${s}[${i}]`),r(a)})}return this._for(new ja("of",o,a,n),()=>r(a))}forIn(e,n,r,o=this.opts.es5?lt.varKinds.var:lt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,X._)`Object.keys(${n})`,r);let a=this._scope.toName(e);return this._for(new ja("in",o,a,n),()=>r(a))}endFor(){return this._endBlockNode(Sn)}label(e){return this._leafNode(new Al(e))}break(e){return this._leafNode(new Sl(e))}return(e){let n=new oo;if(this._blockNode(n),this.code(e),n.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(oo)}try(e,n,r){if(!n&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Rl;if(this._blockNode(o),this.code(e),n){let a=this.name("e");this._currNode=o.catch=new ao(a),n(a)}return r&&(this._currNode=o.finally=new so,this.code(r)),this._endBlockNode(ao,so)}throw(e){return this._leafNode(new Ol(e))}block(e,n){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(n),this}endBlock(e){let n=this._blockStarts.pop();if(n===void 0)throw new Error("CodeGen: not in self-balancing block");let r=this._nodes.length-n;if(r<0||e!==void 0&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=X.nil,r,o){return this._blockNode(new ro(e,n,r)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ro)}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,n){let r=this._currNode;if(r instanceof e||n&&r instanceof n)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${n?`${e.kind}/${n.kind}`:e.kind}"`)}_elseNode(e){let n=this._currNode;if(!(n instanceof An))throw new Error('CodeGen: "else" without "if"');return this._currNode=n.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let n=this._nodes;n[n.length-1]=e}};V.CodeGen=kl;function On(t,e){for(let n in e)t[n]=(t[n]||0)+(e[n]||0);return t}function Ga(t,e){return e instanceof X._CodeOrName?On(t,e.names):t}function ar(t,e,n){if(t instanceof X.Name)return r(t);if(!o(t))return t;return new X._Code(t._items.reduce((a,s)=>(s instanceof X.Name&&(s=r(s)),s instanceof X._Code?a.push(...s._items):a.push(s),a),[]));function r(a){let s=n[a.str];return s===void 0||e[a.str]!==1?a:(delete e[a.str],s)}function o(a){return a instanceof X._Code&&a._items.some(s=>s instanceof X.Name&&e[s.str]===1&&n[s.str]!==void 0)}}function Nv(t,e){for(let n in e)t[n]=(t[n]||0)-(e[n]||0)}function Nm(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,X._)`!${xl(t)}`}V.not=Nm;var Pv=Pm(V.operators.AND);function Cv(...t){return t.reduce(Pv)}V.and=Cv;var Dv=Pm(V.operators.OR);function Rv(...t){return t.reduce(Dv)}V.or=Rv;function Pm(t){return(e,n)=>e===X.nil?n:n===X.nil?e:(0,X._)`${xl(e)} ${t} ${xl(n)}`}function xl(t){return t instanceof X.Name?t:(0,X._)`(${t})`}});var Q=N(W=>{"use strict";u();Object.defineProperty(W,"__esModule",{value:!0});W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;var ae=q(),kv=to();function xv(t){let e={};for(let n of t)e[n]=!0;return e}W.toHash=xv;function Lv(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Rm(t,e),!km(e,t.self.RULES.all))}W.alwaysValidSchema=Lv;function Rm(t,e=t.schema){let{opts:n,self:r}=t;if(!n.strictSchema||typeof e=="boolean")return;let o=r.RULES.keywords;for(let a in e)o[a]||$m(t,`unknown keyword: "${a}"`)}W.checkUnknownRules=Rm;function km(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(e[n])return!0;return!1}W.schemaHasRules=km;function $v(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(n!=="$ref"&&e.all[n])return!0;return!1}W.schemaHasRulesButRef=$v;function Mv({topSchemaRef:t,schemaPath:e},n,r,o){if(!o){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,ae._)`${n}`}return(0,ae._)`${t}${e}${(0,ae.getProperty)(r)}`}W.schemaRefOrVal=Mv;function zv(t){return xm(decodeURIComponent(t))}W.unescapeFragment=zv;function Uv(t){return encodeURIComponent($l(t))}W.escapeFragment=Uv;function $l(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=$l;function xm(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=xm;function Fv(t,e){if(Array.isArray(t))for(let n of t)e(n);else e(t)}W.eachItem=Fv;function Cm({mergeNames:t,mergeToName:e,mergeValues:n,resultToName:r}){return(o,a,s,i)=>{let l=s===void 0?a:s instanceof ae.Name?(a instanceof ae.Name?t(o,a,s):e(o,a,s),s):a instanceof ae.Name?(e(o,s,a),a):n(a,s);return i===ae.Name&&!(l instanceof ae.Name)?r(o,l):l}}W.mergeEvaluated={props:Cm({mergeNames:(t,e,n)=>t.if((0,ae._)`${n} !== true && ${e} !== undefined`,()=>{t.if((0,ae._)`${e} === true`,()=>t.assign(n,!0),()=>t.assign(n,(0,ae._)`${n} || {}`).code((0,ae._)`Object.assign(${n}, ${e})`))}),mergeToName:(t,e,n)=>t.if((0,ae._)`${n} !== true`,()=>{e===!0?t.assign(n,!0):(t.assign(n,(0,ae._)`${n} || {}`),Ml(t,n,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Lm}),items:Cm({mergeNames:(t,e,n)=>t.if((0,ae._)`${n} !== true && ${e} !== undefined`,()=>t.assign(n,(0,ae._)`${e} === true ? true : ${n} > ${e} ? ${n} : ${e}`)),mergeToName:(t,e,n)=>t.if((0,ae._)`${n} !== true`,()=>t.assign(n,e===!0?!0:(0,ae._)`${n} > ${e} ? ${n} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Lm(t,e){if(e===!0)return t.var("props",!0);let n=t.var("props",(0,ae._)`{}`);return e!==void 0&&Ml(t,n,e),n}W.evaluatedPropsToName=Lm;function Ml(t,e,n){Object.keys(n).forEach(r=>t.assign((0,ae._)`${e}${(0,ae.getProperty)(r)}`,!0))}W.setEvaluated=Ml;var Dm={};function jv(t,e){return t.scopeValue("func",{ref:e,code:Dm[e.code]||(Dm[e.code]=new kv._Code(e.code))})}W.useFunc=jv;var Ll;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ll||(W.Type=Ll={}));function Gv(t,e,n){if(t instanceof ae.Name){let r=e===Ll.Num;return n?r?(0,ae._)`"[" + ${t} + "]"`:(0,ae._)`"['" + ${t} + "']"`:r?(0,ae._)`"/" + ${t}`:(0,ae._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,ae.getProperty)(t).toString():"/"+$l(t)}W.getErrorPath=Gv;function $m(t,e,n=t.opts.strictSchema){if(n){if(e=`strict mode: ${e}`,n===!0)throw new Error(e);t.self.logger.warn(e)}}W.checkStrictMode=$m});var Ct=N(zl=>{"use strict";u();Object.defineProperty(zl,"__esModule",{value:!0});var Ce=q(),Zv={data:new Ce.Name("data"),valCxt:new Ce.Name("valCxt"),instancePath:new Ce.Name("instancePath"),parentData:new Ce.Name("parentData"),parentDataProperty:new Ce.Name("parentDataProperty"),rootData:new Ce.Name("rootData"),dynamicAnchors:new Ce.Name("dynamicAnchors"),vErrors:new Ce.Name("vErrors"),errors:new Ce.Name("errors"),this:new Ce.Name("this"),self:new Ce.Name("self"),scope:new Ce.Name("scope"),json:new Ce.Name("json"),jsonPos:new Ce.Name("jsonPos"),jsonLen:new Ce.Name("jsonLen"),jsonPart:new Ce.Name("jsonPart")};zl.default=Zv});var io=N(De=>{"use strict";u();Object.defineProperty(De,"__esModule",{value:!0});De.extendErrors=De.resetErrorsCount=De.reportExtraError=De.reportError=De.keyword$DataError=De.keywordError=void 0;var ee=q(),Ba=Q(),$e=Ct();De.keywordError={message:({keyword:t})=>(0,ee.str)`must pass "${t}" keyword validation`};De.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ee.str)`"${t}" keyword must be ${e} ($data)`:(0,ee.str)`"${t}" keyword is invalid ($data)`};function Bv(t,e=De.keywordError,n,r){let{it:o}=t,{gen:a,compositeRule:s,allErrors:i}=o,l=Um(t,e,n);r??(s||i)?Mm(a,l):zm(o,(0,ee._)`[${l}]`)}De.reportError=Bv;function qv(t,e=De.keywordError,n){let{it:r}=t,{gen:o,compositeRule:a,allErrors:s}=r,i=Um(t,e,n);Mm(o,i),a||s||zm(r,$e.default.vErrors)}De.reportExtraError=qv;function Vv(t,e){t.assign($e.default.errors,e),t.if((0,ee._)`${$e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ee._)`${$e.default.vErrors}.length`,e),()=>t.assign($e.default.vErrors,null)))}De.resetErrorsCount=Vv;function Wv({gen:t,keyword:e,schemaValue:n,data:r,errsCount:o,it:a}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,$e.default.errors,i=>{t.const(s,(0,ee._)`${$e.default.vErrors}[${i}]`),t.if((0,ee._)`${s}.instancePath === undefined`,()=>t.assign((0,ee._)`${s}.instancePath`,(0,ee.strConcat)($e.default.instancePath,a.errorPath))),t.assign((0,ee._)`${s}.schemaPath`,(0,ee.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,ee._)`${s}.schema`,n),t.assign((0,ee._)`${s}.data`,r))})}De.extendErrors=Wv;function Mm(t,e){let n=t.const("err",e);t.if((0,ee._)`${$e.default.vErrors} === null`,()=>t.assign($e.default.vErrors,(0,ee._)`[${n}]`),(0,ee._)`${$e.default.vErrors}.push(${n})`),t.code((0,ee._)`${$e.default.errors}++`)}function zm(t,e){let{gen:n,validateName:r,schemaEnv:o}=t;o.$async?n.throw((0,ee._)`new ${t.ValidationError}(${e})`):(n.assign((0,ee._)`${r}.errors`,e),n.return(!1))}var Nn={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function Um(t,e,n){let{createErrors:r}=t.it;return r===!1?(0,ee._)`{}`:Hv(t,e,n)}function Hv(t,e,n={}){let{gen:r,it:o}=t,a=[Yv(o,n),Kv(t,n)];return Jv(t,e,a),r.object(...a)}function Yv({errorPath:t},{instancePath:e}){let n=e?(0,ee.str)`${t}${(0,Ba.getErrorPath)(e,Ba.Type.Str)}`:t;return[$e.default.instancePath,(0,ee.strConcat)($e.default.instancePath,n)]}function Kv({keyword:t,it:{errSchemaPath:e}},{schemaPath:n,parentSchema:r}){let o=r?e:(0,ee.str)`${e}/${t}`;return n&&(o=(0,ee.str)`${o}${(0,Ba.getErrorPath)(n,Ba.Type.Str)}`),[Nn.schemaPath,o]}function Jv(t,{params:e,message:n},r){let{keyword:o,data:a,schemaValue:s,it:i}=t,{opts:l,propertyName:d,topSchemaRef:h,schemaPath:p}=i;r.push([Nn.keyword,o],[Nn.params,typeof e=="function"?e(t):e||(0,ee._)`{}`]),l.messages&&r.push([Nn.message,typeof n=="function"?n(t):n]),l.verbose&&r.push([Nn.schema,s],[Nn.parentSchema,(0,ee._)`${h}${p}`],[$e.default.data,a]),d&&r.push([Nn.propertyName,d])}});var jm=N(sr=>{"use strict";u();Object.defineProperty(sr,"__esModule",{value:!0});sr.boolOrEmptySchema=sr.topBoolOrEmptySchema=void 0;var Xv=io(),Qv=q(),eI=Ct(),tI={message:"boolean schema is false"};function nI(t){let{gen:e,schema:n,validateName:r}=t;n===!1?Fm(t,!1):typeof n=="object"&&n.$async===!0?e.return(eI.default.data):(e.assign((0,Qv._)`${r}.errors`,null),e.return(!0))}sr.topBoolOrEmptySchema=nI;function rI(t,e){let{gen:n,schema:r}=t;r===!1?(n.var(e,!1),Fm(t)):n.var(e,!0)}sr.boolOrEmptySchema=rI;function Fm(t,e){let{gen:n,data:r}=t,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Xv.reportError)(o,tI,void 0,e)}});var Ul=N(ir=>{"use strict";u();Object.defineProperty(ir,"__esModule",{value:!0});ir.getRules=ir.isJSONType=void 0;var oI=["string","number","integer","boolean","null","object","array"],aI=new Set(oI);function sI(t){return typeof t=="string"&&aI.has(t)}ir.isJSONType=sI;function iI(){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:{}}}ir.getRules=iI});var Fl=N(qt=>{"use strict";u();Object.defineProperty(qt,"__esModule",{value:!0});qt.shouldUseRule=qt.shouldUseGroup=qt.schemaHasRulesForType=void 0;function cI({schema:t,self:e},n){let r=e.RULES.types[n];return r&&r!==!0&&Gm(t,r)}qt.schemaHasRulesForType=cI;function Gm(t,e){return e.rules.some(n=>Zm(t,n))}qt.shouldUseGroup=Gm;function Zm(t,e){var n;return t[e.keyword]!==void 0||((n=e.definition.implements)===null||n===void 0?void 0:n.some(r=>t[r]!==void 0))}qt.shouldUseRule=Zm});var co=N(Re=>{"use strict";u();Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var lI=Ul(),dI=Fl(),uI=io(),Z=q(),Bm=Q(),cr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(cr||(Re.DataType=cr={}));function hI(t){let e=qm(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}Re.getSchemaTypes=hI;function qm(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(lI.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Re.getJSONTypes=qm;function pI(t,e){let{gen:n,data:r,opts:o}=t,a=mI(e,o.coerceTypes),s=e.length>0&&!(a.length===0&&e.length===1&&(0,dI.schemaHasRulesForType)(t,e[0]));if(s){let i=Gl(e,r,o.strictNumbers,cr.Wrong);n.if(i,()=>{a.length?fI(t,e,a):Zl(t)})}return s}Re.coerceAndCheckDataType=pI;var Vm=new Set(["string","number","integer","boolean","null"]);function mI(t,e){return e?t.filter(n=>Vm.has(n)||e==="array"&&n==="array"):[]}function fI(t,e,n){let{gen:r,data:o,opts:a}=t,s=r.let("dataType",(0,Z._)`typeof ${o}`),i=r.let("coerced",(0,Z._)`undefined`);a.coerceTypes==="array"&&r.if((0,Z._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>r.assign(o,(0,Z._)`${o}[0]`).assign(s,(0,Z._)`typeof ${o}`).if(Gl(e,o,a.strictNumbers),()=>r.assign(i,o))),r.if((0,Z._)`${i} !== undefined`);for(let d of n)(Vm.has(d)||d==="array"&&a.coerceTypes==="array")&&l(d);r.else(),Zl(t),r.endIf(),r.if((0,Z._)`${i} !== undefined`,()=>{r.assign(o,i),_I(t,i)});function l(d){switch(d){case"string":r.elseIf((0,Z._)`${s} == "number" || ${s} == "boolean"`).assign(i,(0,Z._)`"" + ${o}`).elseIf((0,Z._)`${o} === null`).assign(i,(0,Z._)`""`);return;case"number":r.elseIf((0,Z._)`${s} == "boolean" || ${o} === null
3
+ import{d as ko,e as Fn,h as Su,i as Ou}from"./chunk-KCRBZTSJ.js";import{c as N,d as ks,e as Au,g as u}from"./chunk-G6GTSUKC.js";var no=N(te=>{"use strict";u();Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var eo=class{};te._CodeOrName=eo;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var In=class extends eo{constructor(e){if(super(),!te.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}}};te.Name=In;var tt=class extends eo{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((n,r)=>`${n}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((n,r)=>(r instanceof In&&(n[r.str]=(n[r.str]||0)+1),n),{})}};te._Code=tt;te.nil=new tt("");function Om(t,...e){let n=[t[0]],r=0;for(;r<e.length;)bl(n,e[r]),n.push(t[++r]);return new tt(n)}te._=Om;var Tl=new tt("+");function Nm(t,...e){let n=[to(t[0])],r=0;for(;r<e.length;)n.push(Tl),bl(n,e[r]),n.push(Tl,to(t[++r]));return vv(n),new tt(n)}te.str=Nm;function bl(t,e){e instanceof tt?t.push(...e._items):e instanceof In?t.push(e):t.push(Sv(e))}te.addCodeArg=bl;function vv(t){let e=1;for(;e<t.length-1;){if(t[e]===Tl){let n=Iv(t[e-1],t[e+1]);if(n!==void 0){t.splice(e-1,3,n);continue}t[e++]="+"}e++}}function Iv(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof In||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 In))return`"${t}${e.slice(1)}`}function Av(t,e){return e.emptyStr()?t:t.emptyStr()?e:Nm`${t}${e}`}te.strConcat=Av;function Sv(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:to(Array.isArray(t)?t.join(","):t)}function Ov(t){return new tt(to(t))}te.stringify=Ov;function to(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}te.safeStringify=to;function Nv(t){return typeof t=="string"&&te.IDENTIFIER.test(t)?new tt(`.${t}`):Om`[${t}]`}te.getProperty=Nv;function Pv(t){if(typeof t=="string"&&te.IDENTIFIER.test(t))return new tt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}te.getEsmExportName=Pv;function Cv(t){return new tt(t.toString())}te.regexpCode=Cv});var Il=N(Ze=>{"use strict";u();Object.defineProperty(Ze,"__esModule",{value:!0});Ze.ValueScope=Ze.ValueScopeName=Ze.Scope=Ze.varKinds=Ze.UsedValueState=void 0;var Ge=no(),wl=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},za;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(za||(Ze.UsedValueState=za={}));Ze.varKinds={const:new Ge.Name("const"),let:new Ge.Name("let"),var:new Ge.Name("var")};var Ua=class{constructor({prefixes:e,parent:n}={}){this._names={},this._prefixes=e,this._parent=n}toName(e){return e instanceof Ge.Name?e:this.name(e)}name(e){return new Ge.Name(this._newName(e))}_newName(e){let n=this._names[e]||this._nameGroup(e);return`${e}${n.index++}`}_nameGroup(e){var n,r;if(!((r=(n=this._parent)===null||n===void 0?void 0:n._prefixes)===null||r===void 0)&&r.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}}};Ze.Scope=Ua;var Fa=class extends Ge.Name{constructor(e,n){super(n),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,Ge._)`.${new Ge.Name(n)}[${r}]`}};Ze.ValueScopeName=Fa;var Dv=(0,Ge._)`\n`,vl=class extends Ua{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Dv:Ge.nil}}get(){return this._scope}name(e){return new Fa(e,this._newName(e))}value(e,n){var r;if(n.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:a}=o,s=(r=n.key)!==null&&r!==void 0?r:n.ref,i=this._values[a];if(i){let h=i.get(s);if(h)return h}else i=this._values[a]=new Map;i.set(s,o);let l=this._scope[a]||(this._scope[a]=[]),d=l.length;return l[d]=n.ref,o.setValue(n,{property:a,itemIndex:d}),o}getValue(e,n){let r=this._values[e];if(r)return r.get(n)}scopeRefs(e,n=this._values){return this._reduceValues(n,r=>{if(r.scopePath===void 0)throw new Error(`CodeGen: name "${r}" has no value`);return(0,Ge._)`${e}${r.scopePath}`})}scopeCode(e=this._values,n,r){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},n,r)}_reduceValues(e,n,r={},o){let a=Ge.nil;for(let s in e){let i=e[s];if(!i)continue;let l=r[s]=r[s]||new Map;i.forEach(d=>{if(l.has(d))return;l.set(d,za.Started);let h=n(d);if(h){let p=this.opts.es5?Ze.varKinds.var:Ze.varKinds.const;a=(0,Ge._)`${a}${p} ${d} = ${h};${this.opts._n}`}else if(h=o?.(d))a=(0,Ge._)`${a}${h}${this.opts._n}`;else throw new wl(d);l.set(d,za.Completed)})}return a}};Ze.ValueScope=vl});var q=N(V=>{"use strict";u();Object.defineProperty(V,"__esModule",{value:!0});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var X=no(),lt=Il(),Bt=no();Object.defineProperty(V,"_",{enumerable:!0,get:function(){return Bt._}});Object.defineProperty(V,"str",{enumerable:!0,get:function(){return Bt.str}});Object.defineProperty(V,"strConcat",{enumerable:!0,get:function(){return Bt.strConcat}});Object.defineProperty(V,"nil",{enumerable:!0,get:function(){return Bt.nil}});Object.defineProperty(V,"getProperty",{enumerable:!0,get:function(){return Bt.getProperty}});Object.defineProperty(V,"stringify",{enumerable:!0,get:function(){return Bt.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:!0,get:function(){return Bt.regexpCode}});Object.defineProperty(V,"Name",{enumerable:!0,get:function(){return Bt.Name}});var Ba=Il();Object.defineProperty(V,"Scope",{enumerable:!0,get:function(){return Ba.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:!0,get:function(){return Ba.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:!0,get:function(){return Ba.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:!0,get:function(){return Ba.varKinds}});V.operators={GT:new X._Code(">"),GTE:new X._Code(">="),LT:new X._Code("<"),LTE:new X._Code("<="),EQ:new X._Code("==="),NEQ:new X._Code("!=="),NOT:new X._Code("!"),OR:new X._Code("||"),AND:new X._Code("&&"),ADD:new X._Code("+")};var Nt=class{optimizeNodes(){return this}optimizeNames(e,n){return this}},Al=class extends Nt{constructor(e,n,r){super(),this.varKind=e,this.name=n,this.rhs=r}render({es5:e,_n:n}){let r=e?lt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+n}optimizeNames(e,n){if(e[this.name.str])return this.rhs&&(this.rhs=sr(this.rhs,e,n)),this}get names(){return this.rhs instanceof X._CodeOrName?this.rhs.names:{}}},ja=class extends Nt{constructor(e,n,r){super(),this.lhs=e,this.rhs=n,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof X.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=sr(this.rhs,e,n),this}get names(){let e=this.lhs instanceof X.Name?{}:{...this.lhs.names};return Za(e,this.rhs)}},Sl=class extends ja{constructor(e,n,r,o){super(e,r,o),this.op=n}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Ol=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Nl=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Pl=class extends Nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Cl=class extends Nt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,n){return this.code=sr(this.code,e,n),this}get names(){return this.code instanceof X._CodeOrName?this.code.names:{}}},ro=class extends Nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((n,r)=>n+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,n=e.length;for(;n--;){let r=e[n].optimizeNodes();Array.isArray(r)?e.splice(n,1,...r):r?e[n]=r:e.splice(n,1)}return e.length>0?this:void 0}optimizeNames(e,n){let{nodes:r}=this,o=r.length;for(;o--;){let a=r[o];a.optimizeNames(e,n)||(Rv(e,a.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,n)=>On(e,n.names),{})}},Pt=class extends ro{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Dl=class extends ro{},ar=class extends Pt{};ar.kind="else";var An=class t extends Pt{constructor(e,n){super(n),this.condition=e}render(e){let n=`if(${this.condition})`+super.render(e);return this.else&&(n+="else "+this.else.render(e)),n}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let n=this.else;if(n){let r=n.optimizeNodes();n=this.else=Array.isArray(r)?new ar(r):r}if(n)return e===!1?n instanceof t?n:n.nodes:this.nodes.length?this:new t(Pm(e),n instanceof t?[n]:n.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,n){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,n),!!(super.optimizeNames(e,n)||this.else))return this.condition=sr(this.condition,e,n),this}get names(){let e=super.names;return Za(e,this.condition),this.else&&On(e,this.else.names),e}};An.kind="if";var Sn=class extends Pt{};Sn.kind="for";var Rl=class extends Sn{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iteration=sr(this.iteration,e,n),this}get names(){return On(super.names,this.iteration.names)}},xl=class extends Sn{constructor(e,n,r,o){super(),this.varKind=e,this.name=n,this.from=r,this.to=o}render(e){let n=e.es5?lt.varKinds.var:this.varKind,{name:r,from:o,to:a}=this;return`for(${n} ${r}=${o}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){let e=Za(super.names,this.from);return Za(e,this.to)}},Ga=class extends Sn{constructor(e,n,r,o){super(),this.loop=e,this.varKind=n,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,n){if(super.optimizeNames(e,n))return this.iterable=sr(this.iterable,e,n),this}get names(){return On(super.names,this.iterable.names)}},oo=class extends Pt{constructor(e,n,r){super(),this.name=e,this.args=n,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};oo.kind="func";var ao=class extends ro{render(e){return"return "+super.render(e)}};ao.kind="return";var kl=class extends Pt{render(e){let n="try"+super.render(e);return this.catch&&(n+=this.catch.render(e)),this.finally&&(n+=this.finally.render(e)),n}optimizeNodes(){var e,n;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(n=this.finally)===null||n===void 0||n.optimizeNodes(),this}optimizeNames(e,n){var r,o;return super.optimizeNames(e,n),(r=this.catch)===null||r===void 0||r.optimizeNames(e,n),(o=this.finally)===null||o===void 0||o.optimizeNames(e,n),this}get names(){let e=super.names;return this.catch&&On(e,this.catch.names),this.finally&&On(e,this.finally.names),e}},so=class extends Pt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};so.kind="catch";var io=class extends Pt{render(e){return"finally"+super.render(e)}};io.kind="finally";var Ll=class{constructor(e,n={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...n,_n:n.lines?`
4
+ `:""},this._extScope=e,this._scope=new lt.Scope({parent:e}),this._nodes=[new Dl]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,n){let r=this._extScope.value(e,n);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,n){return this._extScope.getValue(e,n)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,n,r,o){let a=this._scope.toName(n);return r!==void 0&&o&&(this._constants[a.str]=r),this._leafNode(new Al(e,a,r)),a}const(e,n,r){return this._def(lt.varKinds.const,e,n,r)}let(e,n,r){return this._def(lt.varKinds.let,e,n,r)}var(e,n,r){return this._def(lt.varKinds.var,e,n,r)}assign(e,n,r){return this._leafNode(new ja(e,n,r))}add(e,n){return this._leafNode(new Sl(e,V.operators.ADD,n))}code(e){return typeof e=="function"?e():e!==X.nil&&this._leafNode(new Cl(e)),this}object(...e){let n=["{"];for(let[r,o]of e)n.length>1&&n.push(","),n.push(r),(r!==o||this.opts.es5)&&(n.push(":"),(0,X.addCodeArg)(n,o));return n.push("}"),new X._Code(n)}if(e,n,r){if(this._blockNode(new An(e)),n&&r)this.code(n).else().code(r).endIf();else if(n)this.code(n).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new An(e))}else(){return this._elseNode(new ar)}endIf(){return this._endBlockNode(An,ar)}_for(e,n){return this._blockNode(e),n&&this.code(n).endFor(),this}for(e,n){return this._for(new Rl(e),n)}forRange(e,n,r,o,a=this.opts.es5?lt.varKinds.var:lt.varKinds.let){let s=this._scope.toName(e);return this._for(new xl(a,s,n,r),()=>o(s))}forOf(e,n,r,o=lt.varKinds.const){let a=this._scope.toName(e);if(this.opts.es5){let s=n instanceof X.Name?n:this.var("_arr",n);return this.forRange("_i",0,(0,X._)`${s}.length`,i=>{this.var(a,(0,X._)`${s}[${i}]`),r(a)})}return this._for(new Ga("of",o,a,n),()=>r(a))}forIn(e,n,r,o=this.opts.es5?lt.varKinds.var:lt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,X._)`Object.keys(${n})`,r);let a=this._scope.toName(e);return this._for(new Ga("in",o,a,n),()=>r(a))}endFor(){return this._endBlockNode(Sn)}label(e){return this._leafNode(new Ol(e))}break(e){return this._leafNode(new Nl(e))}return(e){let n=new ao;if(this._blockNode(n),this.code(e),n.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(ao)}try(e,n,r){if(!n&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new kl;if(this._blockNode(o),this.code(e),n){let a=this.name("e");this._currNode=o.catch=new so(a),n(a)}return r&&(this._currNode=o.finally=new io,this.code(r)),this._endBlockNode(so,io)}throw(e){return this._leafNode(new Pl(e))}block(e,n){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(n),this}endBlock(e){let n=this._blockStarts.pop();if(n===void 0)throw new Error("CodeGen: not in self-balancing block");let r=this._nodes.length-n;if(r<0||e!==void 0&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=n,this}func(e,n=X.nil,r,o){return this._blockNode(new oo(e,n,r)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(oo)}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,n){let r=this._currNode;if(r instanceof e||n&&r instanceof n)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${n?`${e.kind}/${n.kind}`:e.kind}"`)}_elseNode(e){let n=this._currNode;if(!(n instanceof An))throw new Error('CodeGen: "else" without "if"');return this._currNode=n.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let n=this._nodes;n[n.length-1]=e}};V.CodeGen=Ll;function On(t,e){for(let n in e)t[n]=(t[n]||0)+(e[n]||0);return t}function Za(t,e){return e instanceof X._CodeOrName?On(t,e.names):t}function sr(t,e,n){if(t instanceof X.Name)return r(t);if(!o(t))return t;return new X._Code(t._items.reduce((a,s)=>(s instanceof X.Name&&(s=r(s)),s instanceof X._Code?a.push(...s._items):a.push(s),a),[]));function r(a){let s=n[a.str];return s===void 0||e[a.str]!==1?a:(delete e[a.str],s)}function o(a){return a instanceof X._Code&&a._items.some(s=>s instanceof X.Name&&e[s.str]===1&&n[s.str]!==void 0)}}function Rv(t,e){for(let n in e)t[n]=(t[n]||0)-(e[n]||0)}function Pm(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,X._)`!${$l(t)}`}V.not=Pm;var xv=Cm(V.operators.AND);function kv(...t){return t.reduce(xv)}V.and=kv;var Lv=Cm(V.operators.OR);function $v(...t){return t.reduce(Lv)}V.or=$v;function Cm(t){return(e,n)=>e===X.nil?n:n===X.nil?e:(0,X._)`${$l(e)} ${t} ${$l(n)}`}function $l(t){return t instanceof X.Name?t:(0,X._)`(${t})`}});var Q=N(W=>{"use strict";u();Object.defineProperty(W,"__esModule",{value:!0});W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;var ae=q(),Mv=no();function zv(t){let e={};for(let n of t)e[n]=!0;return e}W.toHash=zv;function Uv(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(xm(t,e),!km(e,t.self.RULES.all))}W.alwaysValidSchema=Uv;function xm(t,e=t.schema){let{opts:n,self:r}=t;if(!n.strictSchema||typeof e=="boolean")return;let o=r.RULES.keywords;for(let a in e)o[a]||Mm(t,`unknown keyword: "${a}"`)}W.checkUnknownRules=xm;function km(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(e[n])return!0;return!1}W.schemaHasRules=km;function Fv(t,e){if(typeof t=="boolean")return!t;for(let n in t)if(n!=="$ref"&&e.all[n])return!0;return!1}W.schemaHasRulesButRef=Fv;function jv({topSchemaRef:t,schemaPath:e},n,r,o){if(!o){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return(0,ae._)`${n}`}return(0,ae._)`${t}${e}${(0,ae.getProperty)(r)}`}W.schemaRefOrVal=jv;function Gv(t){return Lm(decodeURIComponent(t))}W.unescapeFragment=Gv;function Zv(t){return encodeURIComponent(zl(t))}W.escapeFragment=Zv;function zl(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=zl;function Lm(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=Lm;function Bv(t,e){if(Array.isArray(t))for(let n of t)e(n);else e(t)}W.eachItem=Bv;function Dm({mergeNames:t,mergeToName:e,mergeValues:n,resultToName:r}){return(o,a,s,i)=>{let l=s===void 0?a:s instanceof ae.Name?(a instanceof ae.Name?t(o,a,s):e(o,a,s),s):a instanceof ae.Name?(e(o,s,a),a):n(a,s);return i===ae.Name&&!(l instanceof ae.Name)?r(o,l):l}}W.mergeEvaluated={props:Dm({mergeNames:(t,e,n)=>t.if((0,ae._)`${n} !== true && ${e} !== undefined`,()=>{t.if((0,ae._)`${e} === true`,()=>t.assign(n,!0),()=>t.assign(n,(0,ae._)`${n} || {}`).code((0,ae._)`Object.assign(${n}, ${e})`))}),mergeToName:(t,e,n)=>t.if((0,ae._)`${n} !== true`,()=>{e===!0?t.assign(n,!0):(t.assign(n,(0,ae._)`${n} || {}`),Ul(t,n,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:$m}),items:Dm({mergeNames:(t,e,n)=>t.if((0,ae._)`${n} !== true && ${e} !== undefined`,()=>t.assign(n,(0,ae._)`${e} === true ? true : ${n} > ${e} ? ${n} : ${e}`)),mergeToName:(t,e,n)=>t.if((0,ae._)`${n} !== true`,()=>t.assign(n,e===!0?!0:(0,ae._)`${n} > ${e} ? ${n} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function $m(t,e){if(e===!0)return t.var("props",!0);let n=t.var("props",(0,ae._)`{}`);return e!==void 0&&Ul(t,n,e),n}W.evaluatedPropsToName=$m;function Ul(t,e,n){Object.keys(n).forEach(r=>t.assign((0,ae._)`${e}${(0,ae.getProperty)(r)}`,!0))}W.setEvaluated=Ul;var Rm={};function qv(t,e){return t.scopeValue("func",{ref:e,code:Rm[e.code]||(Rm[e.code]=new Mv._Code(e.code))})}W.useFunc=qv;var Ml;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ml||(W.Type=Ml={}));function Vv(t,e,n){if(t instanceof ae.Name){let r=e===Ml.Num;return n?r?(0,ae._)`"[" + ${t} + "]"`:(0,ae._)`"['" + ${t} + "']"`:r?(0,ae._)`"/" + ${t}`:(0,ae._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,ae.getProperty)(t).toString():"/"+zl(t)}W.getErrorPath=Vv;function Mm(t,e,n=t.opts.strictSchema){if(n){if(e=`strict mode: ${e}`,n===!0)throw new Error(e);t.self.logger.warn(e)}}W.checkStrictMode=Mm});var Ct=N(Fl=>{"use strict";u();Object.defineProperty(Fl,"__esModule",{value:!0});var Ce=q(),Wv={data:new Ce.Name("data"),valCxt:new Ce.Name("valCxt"),instancePath:new Ce.Name("instancePath"),parentData:new Ce.Name("parentData"),parentDataProperty:new Ce.Name("parentDataProperty"),rootData:new Ce.Name("rootData"),dynamicAnchors:new Ce.Name("dynamicAnchors"),vErrors:new Ce.Name("vErrors"),errors:new Ce.Name("errors"),this:new Ce.Name("this"),self:new Ce.Name("self"),scope:new Ce.Name("scope"),json:new Ce.Name("json"),jsonPos:new Ce.Name("jsonPos"),jsonLen:new Ce.Name("jsonLen"),jsonPart:new Ce.Name("jsonPart")};Fl.default=Wv});var co=N(De=>{"use strict";u();Object.defineProperty(De,"__esModule",{value:!0});De.extendErrors=De.resetErrorsCount=De.reportExtraError=De.reportError=De.keyword$DataError=De.keywordError=void 0;var ee=q(),qa=Q(),$e=Ct();De.keywordError={message:({keyword:t})=>(0,ee.str)`must pass "${t}" keyword validation`};De.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ee.str)`"${t}" keyword must be ${e} ($data)`:(0,ee.str)`"${t}" keyword is invalid ($data)`};function Hv(t,e=De.keywordError,n,r){let{it:o}=t,{gen:a,compositeRule:s,allErrors:i}=o,l=Fm(t,e,n);r??(s||i)?zm(a,l):Um(o,(0,ee._)`[${l}]`)}De.reportError=Hv;function Yv(t,e=De.keywordError,n){let{it:r}=t,{gen:o,compositeRule:a,allErrors:s}=r,i=Fm(t,e,n);zm(o,i),a||s||Um(r,$e.default.vErrors)}De.reportExtraError=Yv;function Kv(t,e){t.assign($e.default.errors,e),t.if((0,ee._)`${$e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ee._)`${$e.default.vErrors}.length`,e),()=>t.assign($e.default.vErrors,null)))}De.resetErrorsCount=Kv;function Jv({gen:t,keyword:e,schemaValue:n,data:r,errsCount:o,it:a}){if(o===void 0)throw new Error("ajv implementation error");let s=t.name("err");t.forRange("i",o,$e.default.errors,i=>{t.const(s,(0,ee._)`${$e.default.vErrors}[${i}]`),t.if((0,ee._)`${s}.instancePath === undefined`,()=>t.assign((0,ee._)`${s}.instancePath`,(0,ee.strConcat)($e.default.instancePath,a.errorPath))),t.assign((0,ee._)`${s}.schemaPath`,(0,ee.str)`${a.errSchemaPath}/${e}`),a.opts.verbose&&(t.assign((0,ee._)`${s}.schema`,n),t.assign((0,ee._)`${s}.data`,r))})}De.extendErrors=Jv;function zm(t,e){let n=t.const("err",e);t.if((0,ee._)`${$e.default.vErrors} === null`,()=>t.assign($e.default.vErrors,(0,ee._)`[${n}]`),(0,ee._)`${$e.default.vErrors}.push(${n})`),t.code((0,ee._)`${$e.default.errors}++`)}function Um(t,e){let{gen:n,validateName:r,schemaEnv:o}=t;o.$async?n.throw((0,ee._)`new ${t.ValidationError}(${e})`):(n.assign((0,ee._)`${r}.errors`,e),n.return(!1))}var Nn={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function Fm(t,e,n){let{createErrors:r}=t.it;return r===!1?(0,ee._)`{}`:Xv(t,e,n)}function Xv(t,e,n={}){let{gen:r,it:o}=t,a=[Qv(o,n),eI(t,n)];return tI(t,e,a),r.object(...a)}function Qv({errorPath:t},{instancePath:e}){let n=e?(0,ee.str)`${t}${(0,qa.getErrorPath)(e,qa.Type.Str)}`:t;return[$e.default.instancePath,(0,ee.strConcat)($e.default.instancePath,n)]}function eI({keyword:t,it:{errSchemaPath:e}},{schemaPath:n,parentSchema:r}){let o=r?e:(0,ee.str)`${e}/${t}`;return n&&(o=(0,ee.str)`${o}${(0,qa.getErrorPath)(n,qa.Type.Str)}`),[Nn.schemaPath,o]}function tI(t,{params:e,message:n},r){let{keyword:o,data:a,schemaValue:s,it:i}=t,{opts:l,propertyName:d,topSchemaRef:h,schemaPath:p}=i;r.push([Nn.keyword,o],[Nn.params,typeof e=="function"?e(t):e||(0,ee._)`{}`]),l.messages&&r.push([Nn.message,typeof n=="function"?n(t):n]),l.verbose&&r.push([Nn.schema,s],[Nn.parentSchema,(0,ee._)`${h}${p}`],[$e.default.data,a]),d&&r.push([Nn.propertyName,d])}});var Gm=N(ir=>{"use strict";u();Object.defineProperty(ir,"__esModule",{value:!0});ir.boolOrEmptySchema=ir.topBoolOrEmptySchema=void 0;var nI=co(),rI=q(),oI=Ct(),aI={message:"boolean schema is false"};function sI(t){let{gen:e,schema:n,validateName:r}=t;n===!1?jm(t,!1):typeof n=="object"&&n.$async===!0?e.return(oI.default.data):(e.assign((0,rI._)`${r}.errors`,null),e.return(!0))}ir.topBoolOrEmptySchema=sI;function iI(t,e){let{gen:n,schema:r}=t;r===!1?(n.var(e,!1),jm(t)):n.var(e,!0)}ir.boolOrEmptySchema=iI;function jm(t,e){let{gen:n,data:r}=t,o={gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,nI.reportError)(o,aI,void 0,e)}});var jl=N(cr=>{"use strict";u();Object.defineProperty(cr,"__esModule",{value:!0});cr.getRules=cr.isJSONType=void 0;var cI=["string","number","integer","boolean","null","object","array"],lI=new Set(cI);function dI(t){return typeof t=="string"&&lI.has(t)}cr.isJSONType=dI;function uI(){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:{}}}cr.getRules=uI});var Gl=N(qt=>{"use strict";u();Object.defineProperty(qt,"__esModule",{value:!0});qt.shouldUseRule=qt.shouldUseGroup=qt.schemaHasRulesForType=void 0;function hI({schema:t,self:e},n){let r=e.RULES.types[n];return r&&r!==!0&&Zm(t,r)}qt.schemaHasRulesForType=hI;function Zm(t,e){return e.rules.some(n=>Bm(t,n))}qt.shouldUseGroup=Zm;function Bm(t,e){var n;return t[e.keyword]!==void 0||((n=e.definition.implements)===null||n===void 0?void 0:n.some(r=>t[r]!==void 0))}qt.shouldUseRule=Bm});var lo=N(Re=>{"use strict";u();Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var pI=jl(),mI=Gl(),fI=co(),Z=q(),qm=Q(),lr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(lr||(Re.DataType=lr={}));function _I(t){let e=Vm(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}Re.getSchemaTypes=_I;function Vm(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(pI.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Re.getJSONTypes=Vm;function gI(t,e){let{gen:n,data:r,opts:o}=t,a=yI(e,o.coerceTypes),s=e.length>0&&!(a.length===0&&e.length===1&&(0,mI.schemaHasRulesForType)(t,e[0]));if(s){let i=Bl(e,r,o.strictNumbers,lr.Wrong);n.if(i,()=>{a.length?EI(t,e,a):ql(t)})}return s}Re.coerceAndCheckDataType=gI;var Wm=new Set(["string","number","integer","boolean","null"]);function yI(t,e){return e?t.filter(n=>Wm.has(n)||e==="array"&&n==="array"):[]}function EI(t,e,n){let{gen:r,data:o,opts:a}=t,s=r.let("dataType",(0,Z._)`typeof ${o}`),i=r.let("coerced",(0,Z._)`undefined`);a.coerceTypes==="array"&&r.if((0,Z._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>r.assign(o,(0,Z._)`${o}[0]`).assign(s,(0,Z._)`typeof ${o}`).if(Bl(e,o,a.strictNumbers),()=>r.assign(i,o))),r.if((0,Z._)`${i} !== undefined`);for(let d of n)(Wm.has(d)||d==="array"&&a.coerceTypes==="array")&&l(d);r.else(),ql(t),r.endIf(),r.if((0,Z._)`${i} !== undefined`,()=>{r.assign(o,i),TI(t,i)});function l(d){switch(d){case"string":r.elseIf((0,Z._)`${s} == "number" || ${s} == "boolean"`).assign(i,(0,Z._)`"" + ${o}`).elseIf((0,Z._)`${o} === null`).assign(i,(0,Z._)`""`);return;case"number":r.elseIf((0,Z._)`${s} == "boolean" || ${o} === null
5
5
  || (${s} == "string" && ${o} && ${o} == +${o})`).assign(i,(0,Z._)`+${o}`);return;case"integer":r.elseIf((0,Z._)`${s} === "boolean" || ${o} === null
6
6
  || (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(i,(0,Z._)`+${o}`);return;case"boolean":r.elseIf((0,Z._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(i,!1).elseIf((0,Z._)`${o} === "true" || ${o} === 1`).assign(i,!0);return;case"null":r.elseIf((0,Z._)`${o} === "" || ${o} === 0 || ${o} === false`),r.assign(i,null);return;case"array":r.elseIf((0,Z._)`${s} === "string" || ${s} === "number"
7
- || ${s} === "boolean" || ${o} === null`).assign(i,(0,Z._)`[${o}]`)}}}function _I({gen:t,parentData:e,parentDataProperty:n},r){t.if((0,Z._)`${e} !== undefined`,()=>t.assign((0,Z._)`${e}[${n}]`,r))}function jl(t,e,n,r=cr.Correct){let o=r===cr.Correct?Z.operators.EQ:Z.operators.NEQ,a;switch(t){case"null":return(0,Z._)`${e} ${o} null`;case"array":a=(0,Z._)`Array.isArray(${e})`;break;case"object":a=(0,Z._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":a=s((0,Z._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":a=s();break;default:return(0,Z._)`typeof ${e} ${o} ${t}`}return r===cr.Correct?a:(0,Z.not)(a);function s(i=Z.nil){return(0,Z.and)((0,Z._)`typeof ${e} == "number"`,i,n?(0,Z._)`isFinite(${e})`:Z.nil)}}Re.checkDataType=jl;function Gl(t,e,n,r){if(t.length===1)return jl(t[0],e,n,r);let o,a=(0,Bm.toHash)(t);if(a.array&&a.object){let s=(0,Z._)`typeof ${e} != "object"`;o=a.null?s:(0,Z._)`!${e} || ${s}`,delete a.null,delete a.array,delete a.object}else o=Z.nil;a.number&&delete a.integer;for(let s in a)o=(0,Z.and)(o,jl(s,e,n,r));return o}Re.checkDataTypes=Gl;var gI={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Z._)`{type: ${t}}`:(0,Z._)`{type: ${e}}`};function Zl(t){let e=yI(t);(0,uI.reportError)(e,gI)}Re.reportTypeError=Zl;function yI(t){let{gen:e,data:n,schema:r}=t,o=(0,Bm.schemaRefOrVal)(t,r,"type");return{gen:e,keyword:"type",data:n,schema:r.type,schemaCode:o,schemaValue:o,parentSchema:r,params:{},it:t}}});var Hm=N(qa=>{"use strict";u();Object.defineProperty(qa,"__esModule",{value:!0});qa.assignDefaults=void 0;var lr=q(),EI=Q();function TI(t,e){let{properties:n,items:r}=t.schema;if(e==="object"&&n)for(let o in n)Wm(t,o,n[o].default);else e==="array"&&Array.isArray(r)&&r.forEach((o,a)=>Wm(t,a,o.default))}qa.assignDefaults=TI;function Wm(t,e,n){let{gen:r,compositeRule:o,data:a,opts:s}=t;if(n===void 0)return;let i=(0,lr._)`${a}${(0,lr.getProperty)(e)}`;if(o){(0,EI.checkStrictMode)(t,`default is ignored for: ${i}`);return}let l=(0,lr._)`${i} === undefined`;s.useDefaults==="empty"&&(l=(0,lr._)`${l} || ${i} === null || ${i} === ""`),r.if(l,(0,lr._)`${i} = ${(0,lr.stringify)(n)}`)}});var nt=N(oe=>{"use strict";u();Object.defineProperty(oe,"__esModule",{value:!0});oe.validateUnion=oe.validateArray=oe.usePattern=oe.callValidateCode=oe.schemaProperties=oe.allSchemaProperties=oe.noPropertyInData=oe.propertyInData=oe.isOwnProperty=oe.hasPropFunc=oe.reportMissingProp=oe.checkMissingProp=oe.checkReportMissingProp=void 0;var de=q(),Bl=Q(),Vt=Ct(),bI=Q();function wI(t,e){let{gen:n,data:r,it:o}=t;n.if(Vl(n,r,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,de._)`${e}`},!0),t.error()})}oe.checkReportMissingProp=wI;function vI({gen:t,data:e,it:{opts:n}},r,o){return(0,de.or)(...r.map(a=>(0,de.and)(Vl(t,e,a,n.ownProperties),(0,de._)`${o} = ${a}`)))}oe.checkMissingProp=vI;function II(t,e){t.setParams({missingProperty:e},!0),t.error()}oe.reportMissingProp=II;function Ym(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,de._)`Object.prototype.hasOwnProperty`})}oe.hasPropFunc=Ym;function ql(t,e,n){return(0,de._)`${Ym(t)}.call(${e}, ${n})`}oe.isOwnProperty=ql;function AI(t,e,n,r){let o=(0,de._)`${e}${(0,de.getProperty)(n)} !== undefined`;return r?(0,de._)`${o} && ${ql(t,e,n)}`:o}oe.propertyInData=AI;function Vl(t,e,n,r){let o=(0,de._)`${e}${(0,de.getProperty)(n)} === undefined`;return r?(0,de.or)(o,(0,de.not)(ql(t,e,n))):o}oe.noPropertyInData=Vl;function Km(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}oe.allSchemaProperties=Km;function SI(t,e){return Km(e).filter(n=>!(0,Bl.alwaysValidSchema)(t,e[n]))}oe.schemaProperties=SI;function OI({schemaCode:t,data:e,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:a},it:s},i,l,d){let h=d?(0,de._)`${t}, ${e}, ${r}${o}`:e,p=[[Vt.default.instancePath,(0,de.strConcat)(Vt.default.instancePath,a)],[Vt.default.parentData,s.parentData],[Vt.default.parentDataProperty,s.parentDataProperty],[Vt.default.rootData,Vt.default.rootData]];s.opts.dynamicRef&&p.push([Vt.default.dynamicAnchors,Vt.default.dynamicAnchors]);let g=(0,de._)`${h}, ${n.object(...p)}`;return l!==de.nil?(0,de._)`${i}.call(${l}, ${g})`:(0,de._)`${i}(${g})`}oe.callValidateCode=OI;var NI=(0,de._)`new RegExp`;function PI({gen:t,it:{opts:e}},n){let r=e.unicodeRegExp?"u":"",{regExp:o}=e.code,a=o(n,r);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,de._)`${o.code==="new RegExp"?NI:(0,bI.useFunc)(t,o)}(${n}, ${r})`})}oe.usePattern=PI;function CI(t){let{gen:e,data:n,keyword:r,it:o}=t,a=e.name("valid");if(o.allErrors){let i=e.let("valid",!0);return s(()=>e.assign(i,!1)),i}return e.var(a,!0),s(()=>e.break()),a;function s(i){let l=e.const("len",(0,de._)`${n}.length`);e.forRange("i",0,l,d=>{t.subschema({keyword:r,dataProp:d,dataPropType:Bl.Type.Num},a),e.if((0,de.not)(a),i)})}}oe.validateArray=CI;function DI(t){let{gen:e,schema:n,keyword:r,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(l=>(0,Bl.alwaysValidSchema)(o,l))&&!o.opts.unevaluated)return;let s=e.let("valid",!1),i=e.name("_valid");e.block(()=>n.forEach((l,d)=>{let h=t.subschema({keyword:r,schemaProp:d,compositeRule:!0},i);e.assign(s,(0,de._)`${s} || ${i}`),t.mergeValidEvaluated(h,i)||e.if((0,de.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}oe.validateUnion=DI});var Qm=N(yt=>{"use strict";u();Object.defineProperty(yt,"__esModule",{value:!0});yt.validateKeywordUsage=yt.validSchemaType=yt.funcKeywordCode=yt.macroKeywordCode=void 0;var Me=q(),Pn=Ct(),RI=nt(),kI=io();function xI(t,e){let{gen:n,keyword:r,schema:o,parentSchema:a,it:s}=t,i=e.macro.call(s.self,o,a,s),l=Xm(n,r,i);s.opts.validateSchema!==!1&&s.self.validateSchema(i,!0);let d=n.name("valid");t.subschema({schema:i,schemaPath:Me.nil,errSchemaPath:`${s.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},d),t.pass(d,()=>t.error(!0))}yt.macroKeywordCode=xI;function LI(t,e){var n;let{gen:r,keyword:o,schema:a,parentSchema:s,$data:i,it:l}=t;MI(l,e);let d=!i&&e.compile?e.compile.call(l.self,a,s,l):e.validate,h=Xm(r,o,d),p=r.let("valid");t.block$data(p,g),t.ok((n=e.valid)!==null&&n!==void 0?n:p);function g(){if(e.errors===!1)y(),e.modifying&&Jm(t),T(()=>t.error());else{let w=e.async?f():m();e.modifying&&Jm(t),T(()=>$I(t,w))}}function f(){let w=r.let("ruleErrs",null);return r.try(()=>y((0,Me._)`await `),I=>r.assign(p,!1).if((0,Me._)`${I} instanceof ${l.ValidationError}`,()=>r.assign(w,(0,Me._)`${I}.errors`),()=>r.throw(I))),w}function m(){let w=(0,Me._)`${h}.errors`;return r.assign(w,null),y(Me.nil),w}function y(w=e.async?(0,Me._)`await `:Me.nil){let I=l.opts.passContext?Pn.default.this:Pn.default.self,S=!("compile"in e&&!i||e.schema===!1);r.assign(p,(0,Me._)`${w}${(0,RI.callValidateCode)(t,h,I,S)}`,e.modifying)}function T(w){var I;r.if((0,Me.not)((I=e.valid)!==null&&I!==void 0?I:p),w)}}yt.funcKeywordCode=LI;function Jm(t){let{gen:e,data:n,it:r}=t;e.if(r.parentData,()=>e.assign(n,(0,Me._)`${r.parentData}[${r.parentDataProperty}]`))}function $I(t,e){let{gen:n}=t;n.if((0,Me._)`Array.isArray(${e})`,()=>{n.assign(Pn.default.vErrors,(0,Me._)`${Pn.default.vErrors} === null ? ${e} : ${Pn.default.vErrors}.concat(${e})`).assign(Pn.default.errors,(0,Me._)`${Pn.default.vErrors}.length`),(0,kI.extendErrors)(t)},()=>t.error())}function MI({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Xm(t,e,n){if(n===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Me.stringify)(n)})}function zI(t,e,n=!1){return!e.length||e.some(r=>r==="array"?Array.isArray(t):r==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==r||n&&typeof t>"u")}yt.validSchemaType=zI;function UI({schema:t,opts:e,self:n,errSchemaPath:r},o,a){if(Array.isArray(o.keyword)?!o.keyword.includes(a):o.keyword!==a)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(i=>!Object.prototype.hasOwnProperty.call(t,i)))throw new Error(`parent schema must have dependencies of ${a}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[a])){let l=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")n.logger.error(l);else throw new Error(l)}}yt.validateKeywordUsage=UI});var tf=N(Wt=>{"use strict";u();Object.defineProperty(Wt,"__esModule",{value:!0});Wt.extendSubschemaMode=Wt.extendSubschemaData=Wt.getSubschema=void 0;var Et=q(),ef=Q();function FI(t,{keyword:e,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:a,topSchemaRef:s}){if(e!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let i=t.schema[e];return n===void 0?{schema:i,schemaPath:(0,Et._)`${t.schemaPath}${(0,Et.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:i[n],schemaPath:(0,Et._)`${t.schemaPath}${(0,Et.getProperty)(e)}${(0,Et.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,ef.escapeFragment)(n)}`}}if(r!==void 0){if(o===void 0||a===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:s,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Wt.getSubschema=FI;function jI(t,e,{dataProp:n,dataPropType:r,data:o,dataTypes:a,propertyName:s}){if(o!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:i}=e;if(n!==void 0){let{errorPath:d,dataPathArr:h,opts:p}=e,g=i.let("data",(0,Et._)`${e.data}${(0,Et.getProperty)(n)}`,!0);l(g),t.errorPath=(0,Et.str)`${d}${(0,ef.getErrorPath)(n,r,p.jsPropertySyntax)}`,t.parentDataProperty=(0,Et._)`${n}`,t.dataPathArr=[...h,t.parentDataProperty]}if(o!==void 0){let d=o instanceof Et.Name?o:i.let("data",o,!0);l(d),s!==void 0&&(t.propertyName=s)}a&&(t.dataTypes=a);function l(d){t.data=d,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,d]}}Wt.extendSubschemaData=jI;function GI(t,{jtdDiscriminator:e,jtdMetadata:n,compositeRule:r,createErrors:o,allErrors:a}){r!==void 0&&(t.compositeRule=r),o!==void 0&&(t.createErrors=o),a!==void 0&&(t.allErrors=a),t.jtdDiscriminator=e,t.jtdMetadata=n}Wt.extendSubschemaMode=GI});var Wl=N((d$,nf)=>{"use strict";u();nf.exports=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,a;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(a=Object.keys(e),r=a.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=r;o--!==0;){var s=a[o];if(!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}});var of=N((h$,rf)=>{"use strict";u();var Ht=rf.exports=function(t,e,n){typeof e=="function"&&(n=e,e={}),n=e.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};Va(e,r,o,t,"",t)};Ht.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ht.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ht.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ht.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Va(t,e,n,r,o,a,s,i,l,d){if(r&&typeof r=="object"&&!Array.isArray(r)){e(r,o,a,s,i,l,d);for(var h in r){var p=r[h];if(Array.isArray(p)){if(h in Ht.arrayKeywords)for(var g=0;g<p.length;g++)Va(t,e,n,p[g],o+"/"+h+"/"+g,a,o,h,r,g)}else if(h in Ht.propsKeywords){if(p&&typeof p=="object")for(var f in p)Va(t,e,n,p[f],o+"/"+h+"/"+ZI(f),a,o,h,r,f)}else(h in Ht.keywords||t.allKeys&&!(h in Ht.skipKeywords))&&Va(t,e,n,p,o+"/"+h,a,o,h,r)}n(r,o,a,s,i,l,d)}}function ZI(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var lo=N(Be=>{"use strict";u();Object.defineProperty(Be,"__esModule",{value:!0});Be.getSchemaRefs=Be.resolveUrl=Be.normalizeId=Be._getFullPath=Be.getFullPath=Be.inlineRef=void 0;var BI=Q(),qI=Wl(),VI=of(),WI=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function HI(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Hl(t):e?af(t)<=e:!1}Be.inlineRef=HI;var YI=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Hl(t){for(let e in t){if(YI.has(e))return!0;let n=t[e];if(Array.isArray(n)&&n.some(Hl)||typeof n=="object"&&Hl(n))return!0}return!1}function af(t){let e=0;for(let n in t){if(n==="$ref")return 1/0;if(e++,!WI.has(n)&&(typeof t[n]=="object"&&(0,BI.eachItem)(t[n],r=>e+=af(r)),e===1/0))return 1/0}return e}function sf(t,e="",n){n!==!1&&(e=dr(e));let r=t.parse(e);return cf(t,r)}Be.getFullPath=sf;function cf(t,e){return t.serialize(e).split("#")[0]+"#"}Be._getFullPath=cf;var KI=/#\/?$/;function dr(t){return t?t.replace(KI,""):""}Be.normalizeId=dr;function JI(t,e,n){return n=dr(n),t.resolve(e,n)}Be.resolveUrl=JI;var XI=/^[a-z_][-a-z0-9._]*$/i;function QI(t,e){if(typeof t=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,o=dr(t[n]||e),a={"":o},s=sf(r,o,!1),i={},l=new Set;return VI(t,{allKeys:!0},(p,g,f,m)=>{if(m===void 0)return;let y=s+g,T=a[m];typeof p[n]=="string"&&(T=w.call(this,p[n])),I.call(this,p.$anchor),I.call(this,p.$dynamicAnchor),a[g]=T;function w(S){let D=this.opts.uriResolver.resolve;if(S=dr(T?D(T,S):S),l.has(S))throw h(S);l.add(S);let M=this.refs[S];return typeof M=="string"&&(M=this.refs[M]),typeof M=="object"?d(p,M.schema,S):S!==dr(y)&&(S[0]==="#"?(d(p,i[S],S),i[S]=p):this.refs[S]=y),S}function I(S){if(typeof S=="string"){if(!XI.test(S))throw new Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),i;function d(p,g,f){if(g!==void 0&&!qI(p,g))throw h(f)}function h(p){return new Error(`reference "${p}" resolves to more than one schema`)}}Be.getSchemaRefs=QI});var po=N(Yt=>{"use strict";u();Object.defineProperty(Yt,"__esModule",{value:!0});Yt.getData=Yt.KeywordCxt=Yt.validateFunctionCode=void 0;var pf=jm(),lf=co(),Kl=Fl(),Wa=co(),eA=Hm(),ho=Qm(),Yl=tf(),L=q(),j=Ct(),tA=lo(),Dt=Q(),uo=io();function nA(t){if(_f(t)&&(gf(t),ff(t))){aA(t);return}mf(t,()=>(0,pf.topBoolOrEmptySchema)(t))}Yt.validateFunctionCode=nA;function mf({gen:t,validateName:e,schema:n,schemaEnv:r,opts:o},a){o.code.es5?t.func(e,(0,L._)`${j.default.data}, ${j.default.valCxt}`,r.$async,()=>{t.code((0,L._)`"use strict"; ${df(n,o)}`),oA(t,o),t.code(a)}):t.func(e,(0,L._)`${j.default.data}, ${rA(o)}`,r.$async,()=>t.code(df(n,o)).code(a))}function rA(t){return(0,L._)`{${j.default.instancePath}="", ${j.default.parentData}, ${j.default.parentDataProperty}, ${j.default.rootData}=${j.default.data}${t.dynamicRef?(0,L._)`, ${j.default.dynamicAnchors}={}`:L.nil}}={}`}function oA(t,e){t.if(j.default.valCxt,()=>{t.var(j.default.instancePath,(0,L._)`${j.default.valCxt}.${j.default.instancePath}`),t.var(j.default.parentData,(0,L._)`${j.default.valCxt}.${j.default.parentData}`),t.var(j.default.parentDataProperty,(0,L._)`${j.default.valCxt}.${j.default.parentDataProperty}`),t.var(j.default.rootData,(0,L._)`${j.default.valCxt}.${j.default.rootData}`),e.dynamicRef&&t.var(j.default.dynamicAnchors,(0,L._)`${j.default.valCxt}.${j.default.dynamicAnchors}`)},()=>{t.var(j.default.instancePath,(0,L._)`""`),t.var(j.default.parentData,(0,L._)`undefined`),t.var(j.default.parentDataProperty,(0,L._)`undefined`),t.var(j.default.rootData,j.default.data),e.dynamicRef&&t.var(j.default.dynamicAnchors,(0,L._)`{}`)})}function aA(t){let{schema:e,opts:n,gen:r}=t;mf(t,()=>{n.$comment&&e.$comment&&Ef(t),dA(t),r.let(j.default.vErrors,null),r.let(j.default.errors,0),n.unevaluated&&sA(t),yf(t),pA(t)})}function sA(t){let{gen:e,validateName:n}=t;t.evaluated=e.const("evaluated",(0,L._)`${n}.evaluated`),e.if((0,L._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,L._)`${t.evaluated}.props`,(0,L._)`undefined`)),e.if((0,L._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,L._)`${t.evaluated}.items`,(0,L._)`undefined`))}function df(t,e){let n=typeof t=="object"&&t[e.schemaId];return n&&(e.code.source||e.code.process)?(0,L._)`/*# sourceURL=${n} */`:L.nil}function iA(t,e){if(_f(t)&&(gf(t),ff(t))){cA(t,e);return}(0,pf.boolOrEmptySchema)(t,e)}function ff({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let n in t)if(e.RULES.all[n])return!0;return!1}function _f(t){return typeof t.schema!="boolean"}function cA(t,e){let{schema:n,gen:r,opts:o}=t;o.$comment&&n.$comment&&Ef(t),uA(t),hA(t);let a=r.const("_errs",j.default.errors);yf(t,a),r.var(e,(0,L._)`${a} === ${j.default.errors}`)}function gf(t){(0,Dt.checkUnknownRules)(t),lA(t)}function yf(t,e){if(t.opts.jtd)return uf(t,[],!1,e);let n=(0,lf.getSchemaTypes)(t.schema),r=(0,lf.coerceAndCheckDataType)(t,n);uf(t,n,!r,e)}function lA(t){let{schema:e,errSchemaPath:n,opts:r,self:o}=t;e.$ref&&r.ignoreKeywordsWithRef&&(0,Dt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function dA(t){let{schema:e,opts:n}=t;e.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,Dt.checkStrictMode)(t,"default is ignored in the schema root")}function uA(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,tA.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function hA(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Ef({gen:t,schemaEnv:e,schema:n,errSchemaPath:r,opts:o}){let a=n.$comment;if(o.$comment===!0)t.code((0,L._)`${j.default.self}.logger.log(${a})`);else if(typeof o.$comment=="function"){let s=(0,L.str)`${r}/$comment`,i=t.scopeValue("root",{ref:e.root});t.code((0,L._)`${j.default.self}.opts.$comment(${a}, ${s}, ${i}.schema)`)}}function pA(t){let{gen:e,schemaEnv:n,validateName:r,ValidationError:o,opts:a}=t;n.$async?e.if((0,L._)`${j.default.errors} === 0`,()=>e.return(j.default.data),()=>e.throw((0,L._)`new ${o}(${j.default.vErrors})`)):(e.assign((0,L._)`${r}.errors`,j.default.vErrors),a.unevaluated&&mA(t),e.return((0,L._)`${j.default.errors} === 0`))}function mA({gen:t,evaluated:e,props:n,items:r}){n instanceof L.Name&&t.assign((0,L._)`${e}.props`,n),r instanceof L.Name&&t.assign((0,L._)`${e}.items`,r)}function uf(t,e,n,r){let{gen:o,schema:a,data:s,allErrors:i,opts:l,self:d}=t,{RULES:h}=d;if(a.$ref&&(l.ignoreKeywordsWithRef||!(0,Dt.schemaHasRulesButRef)(a,h))){o.block(()=>bf(t,"$ref",h.all.$ref.definition));return}l.jtd||fA(t,e),o.block(()=>{for(let g of h.rules)p(g);p(h.post)});function p(g){(0,Kl.shouldUseGroup)(a,g)&&(g.type?(o.if((0,Wa.checkDataType)(g.type,s,l.strictNumbers)),hf(t,g),e.length===1&&e[0]===g.type&&n&&(o.else(),(0,Wa.reportTypeError)(t)),o.endIf()):hf(t,g),i||o.if((0,L._)`${j.default.errors} === ${r||0}`))}}function hf(t,e){let{gen:n,schema:r,opts:{useDefaults:o}}=t;o&&(0,eA.assignDefaults)(t,e.type),n.block(()=>{for(let a of e.rules)(0,Kl.shouldUseRule)(r,a)&&bf(t,a.keyword,a.definition,e.type)})}function fA(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(_A(t,e),t.opts.allowUnionTypes||gA(t,e),yA(t,t.dataTypes))}function _A(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(n=>{Tf(t.dataTypes,n)||Jl(t,`type "${n}" not allowed by context "${t.dataTypes.join(",")}"`)}),TA(t,e)}}function gA(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Jl(t,"use allowUnionTypes to allow union type keyword")}function yA(t,e){let n=t.self.RULES.all;for(let r in n){let o=n[r];if(typeof o=="object"&&(0,Kl.shouldUseRule)(t.schema,o)){let{type:a}=o.definition;a.length&&!a.some(s=>EA(e,s))&&Jl(t,`missing type "${a.join(",")}" for keyword "${r}"`)}}}function EA(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 TA(t,e){let n=[];for(let r of t.dataTypes)Tf(e,r)?n.push(r):e.includes("integer")&&r==="number"&&n.push("integer");t.dataTypes=n}function Jl(t,e){let n=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${n}" (strictTypes)`,(0,Dt.checkStrictMode)(t,e,t.opts.strictTypes)}var Ha=class{constructor(e,n,r){if((0,ho.validateKeywordUsage)(e,n,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=n.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Dt.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=n,this.$data)this.schemaCode=e.gen.const("vSchema",wf(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,ho.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=e.gen.const("_errs",j.default.errors))}result(e,n,r){this.failResult((0,L.not)(e),n,r)}failResult(e,n,r){this.gen.if(e),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,n){this.failResult((0,L.not)(e),void 0,n)}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:n}=this;this.fail((0,L._)`${n} !== undefined && (${(0,L.or)(this.invalid$data(),e)})`)}error(e,n,r){if(n){this.setParams(n),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,n){(e?uo.reportExtraError:uo.reportError)(this,this.def.error,n)}$dataError(){(0,uo.reportError)(this,this.def.$dataError||uo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,uo.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,n){n?Object.assign(this.params,e):this.params=e}block$data(e,n,r=L.nil){this.gen.block(()=>{this.check$data(e,r),n()})}check$data(e=L.nil,n=L.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:a,def:s}=this;r.if((0,L.or)((0,L._)`${o} === undefined`,n)),e!==L.nil&&r.assign(e,!0),(a.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==L.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:n,schemaType:r,def:o,it:a}=this;return(0,L.or)(s(),i());function s(){if(r.length){if(!(n instanceof L.Name))throw new Error("ajv implementation error");let l=Array.isArray(r)?r:[r];return(0,L._)`${(0,Wa.checkDataTypes)(l,n,a.opts.strictNumbers,Wa.DataType.Wrong)}`}return L.nil}function i(){if(o.validateSchema){let l=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,L._)`!${l}(${n})`}return L.nil}}subschema(e,n){let r=(0,Yl.getSubschema)(this.it,e);(0,Yl.extendSubschemaData)(r,this.it,e),(0,Yl.extendSubschemaMode)(r,e);let o={...this.it,...r,items:void 0,props:void 0};return iA(o,n),o}mergeEvaluated(e,n){let{it:r,gen:o}=this;r.opts.unevaluated&&(r.props!==!0&&e.props!==void 0&&(r.props=Dt.mergeEvaluated.props(o,e.props,r.props,n)),r.items!==!0&&e.items!==void 0&&(r.items=Dt.mergeEvaluated.items(o,e.items,r.items,n)))}mergeValidEvaluated(e,n){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(n,()=>this.mergeEvaluated(e,L.Name)),!0}};Yt.KeywordCxt=Ha;function bf(t,e,n,r){let o=new Ha(t,n,e);"code"in n?n.code(o,r):o.$data&&n.validate?(0,ho.funcKeywordCode)(o,n):"macro"in n?(0,ho.macroKeywordCode)(o,n):(n.compile||n.validate)&&(0,ho.funcKeywordCode)(o,n)}var bA=/^\/(?:[^~]|~0|~1)*$/,wA=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function wf(t,{dataLevel:e,dataNames:n,dataPathArr:r}){let o,a;if(t==="")return j.default.rootData;if(t[0]==="/"){if(!bA.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,a=j.default.rootData}else{let d=wA.exec(t);if(!d)throw new Error(`Invalid JSON-pointer: ${t}`);let h=+d[1];if(o=d[2],o==="#"){if(h>=e)throw new Error(l("property/index",h));return r[e-h]}if(h>e)throw new Error(l("data",h));if(a=n[e-h],!o)return a}let s=a,i=o.split("/");for(let d of i)d&&(a=(0,L._)`${a}${(0,L.getProperty)((0,Dt.unescapeJsonPointer)(d))}`,s=(0,L._)`${s} && ${a}`);return s;function l(d,h){return`Cannot access ${d} ${h} levels up, current level is ${e}`}}Yt.getData=wf});var Ya=N(Ql=>{"use strict";u();Object.defineProperty(Ql,"__esModule",{value:!0});var Xl=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Ql.default=Xl});var mo=N(nd=>{"use strict";u();Object.defineProperty(nd,"__esModule",{value:!0});var ed=lo(),td=class extends Error{constructor(e,n,r,o){super(o||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,ed.resolveUrl)(e,n,r),this.missingSchema=(0,ed.normalizeId)((0,ed.getFullPath)(e,this.missingRef))}};nd.default=td});var Ja=N(rt=>{"use strict";u();Object.defineProperty(rt,"__esModule",{value:!0});rt.resolveSchema=rt.getCompilingSchema=rt.resolveRef=rt.compileSchema=rt.SchemaEnv=void 0;var dt=q(),vA=Ya(),Cn=Ct(),ut=lo(),vf=Q(),IA=po(),ur=class{constructor(e){var n;this.refs={},this.dynamicAnchors={};let r;typeof e.schema=="object"&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(n=e.baseId)!==null&&n!==void 0?n:(0,ut.normalizeId)(r?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r?.$async,this.refs={}}};rt.SchemaEnv=ur;function od(t){let e=If.call(this,t);if(e)return e;let n=(0,ut.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:a}=this.opts,s=new dt.CodeGen(this.scope,{es5:r,lines:o,ownProperties:a}),i;t.$async&&(i=s.scopeValue("Error",{ref:vA.default,code:(0,dt._)`require("ajv/dist/runtime/validation_error").default`}));let l=s.scopeName("validate");t.validateName=l;let d={gen:s,allErrors:this.opts.allErrors,data:Cn.default.data,parentData:Cn.default.parentData,parentDataProperty:Cn.default.parentDataProperty,dataNames:[Cn.default.data],dataPathArr:[dt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,dt.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:i,schema:t.schema,schemaEnv:t,rootId:n,baseId:t.baseId||n,schemaPath:dt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,dt._)`""`,opts:this.opts,self:this},h;try{this._compilations.add(t),(0,IA.validateFunctionCode)(d),s.optimize(this.opts.code.optimize);let p=s.toString();h=`${s.scopeRefs(Cn.default.scope)}return ${p}`,this.opts.code.process&&(h=this.opts.code.process(h,t));let f=new Function(`${Cn.default.self}`,`${Cn.default.scope}`,h)(this,this.scope.get());if(this.scope.value(l,{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:l,validateCode:p,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:y}=d;f.evaluated={props:m instanceof dt.Name?void 0:m,items:y instanceof dt.Name?void 0:y,dynamicProps:m instanceof dt.Name,dynamicItems:y instanceof dt.Name},f.source&&(f.source.evaluated=(0,dt.stringify)(f.evaluated))}return t.validate=f,t}catch(p){throw delete t.validate,delete t.validateName,h&&this.logger.error("Error compiling schema, function code:",h),p}finally{this._compilations.delete(t)}}rt.compileSchema=od;function AA(t,e,n){var r;n=(0,ut.resolveUrl)(this.opts.uriResolver,e,n);let o=t.refs[n];if(o)return o;let a=NA.call(this,t,n);if(a===void 0){let s=(r=t.localRefs)===null||r===void 0?void 0:r[n],{schemaId:i}=this.opts;s&&(a=new ur({schema:s,schemaId:i,root:t,baseId:e}))}if(a!==void 0)return t.refs[n]=SA.call(this,a)}rt.resolveRef=AA;function SA(t){return(0,ut.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:od.call(this,t)}function If(t){for(let e of this._compilations)if(OA(e,t))return e}rt.getCompilingSchema=If;function OA(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function NA(t,e){let n;for(;typeof(n=this.refs[e])=="string";)e=n;return n||this.schemas[e]||Ka.call(this,t,e)}function Ka(t,e){let n=this.opts.uriResolver.parse(e),r=(0,ut._getFullPath)(this.opts.uriResolver,n),o=(0,ut.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&r===o)return rd.call(this,n,t);let a=(0,ut.normalizeId)(r),s=this.refs[a]||this.schemas[a];if(typeof s=="string"){let i=Ka.call(this,t,s);return typeof i?.schema!="object"?void 0:rd.call(this,n,i)}if(typeof s?.schema=="object"){if(s.validate||od.call(this,s),a===(0,ut.normalizeId)(e)){let{schema:i}=s,{schemaId:l}=this.opts,d=i[l];return d&&(o=(0,ut.resolveUrl)(this.opts.uriResolver,o,d)),new ur({schema:i,schemaId:l,root:t,baseId:o})}return rd.call(this,n,s)}}rt.resolveSchema=Ka;var PA=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function rd(t,{baseId:e,schema:n,root:r}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let i of t.fragment.slice(1).split("/")){if(typeof n=="boolean")return;let l=n[(0,vf.unescapeFragment)(i)];if(l===void 0)return;n=l;let d=typeof n=="object"&&n[this.opts.schemaId];!PA.has(i)&&d&&(e=(0,ut.resolveUrl)(this.opts.uriResolver,e,d))}let a;if(typeof n!="boolean"&&n.$ref&&!(0,vf.schemaHasRulesButRef)(n,this.RULES)){let i=(0,ut.resolveUrl)(this.opts.uriResolver,e,n.$ref);a=Ka.call(this,r,i)}let{schemaId:s}=this.opts;if(a=a||new ur({schema:n,schemaId:s,root:r,baseId:e}),a.schema!==a.root.schema)return a}});var Af=N((I$,CA)=>{CA.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 id=N((A$,Df)=>{"use strict";u();var DA=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Of=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),ad=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Nf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),RA=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function sd(t){let e="",n=0,r=0;for(r=0;r<t.length;r++)if(n=t[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";e+=t[r];break}for(r+=1;r<t.length;r++){if(n=t[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";e+=t[r]}return e}var kA=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Sf(t){return t.length=0,!0}function xA(t,e,n){if(t.length){let r=sd(t);if(r!=="")e.push(r);else return n.error=!0,!1;t.length=0}return!0}function LA(t){let e=0,n={error:!1,address:"",zone:""},r=[],o=[],a=!1,s=!1,i=xA;for(let l=0;l<t.length;l++){let d=t[l];if(!(d==="["||d==="]"))if(d===":"){if(a===!0&&(s=!0),!i(o,r,n))break;if(++e>7){n.error=!0;break}l>0&&t[l-1]===":"&&(a=!0),r.push(":");continue}else if(d==="%"){if(!i(o,r,n))break;i=Sf}else{o.push(d);continue}}return o.length&&(i===Sf?n.zone=o.join(""):s?r.push(o.join("")):r.push(sd(o))),n.address=r.join(""),n}function Pf(t){if($A(t,":")<2)return{host:t,isIPV6:!1};let e=LA(t);if(e.error)return{host:t,isIPV6:!1};{let n=e.address,r=e.address;return e.zone&&(n+="%"+e.zone,r+="%25"+e.zone),{host:n,isIPV6:!0,escapedHost:r}}}function $A(t,e){let n=0;for(let r=0;r<t.length;r++)t[r]===e&&n++;return n}function MA(t){let e=t,n=[],r=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){n.push("/");break}else{n.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){n.push("/");break}}else if(o===3&&e==="/.."){n.length!==0&&n.pop(),n.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),n.length!==0&&n.pop();continue}}if((r=e.indexOf("/",1))===-1){n.push(e);break}else n.push(e.slice(0,r)),e=e.slice(r)}return n.join("")}var zA={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},UA=/[@/?#:]/g,FA=/[@/?#]/g;function Cf(t,e){let n=e?FA:UA;return n.lastIndex=0,t.replace(n,r=>zA[r])}function jA(t,e=!1){if(t.indexOf("%")===-1)return t;let n="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(ad(o)){let a=o.toUpperCase(),s=String.fromCharCode(parseInt(a,16));e&&Nf(s)?n+=s:n+="%"+a,r+=2;continue}}n+=t[r]}return n}function GA(t){let e="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let r=t.slice(n+1,n+3);if(ad(r)){let o=r.toUpperCase(),a=String.fromCharCode(parseInt(o,16));a!=="."&&Nf(a)?e+=a:e+="%"+o,n+=2;continue}}RA(t[n])?e+=t[n]:e+=escape(t[n])}return e}function ZA(t){let e="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let r=t.slice(n+1,n+3);if(ad(r)){e+="%"+r.toUpperCase(),n+=2;continue}}e+=escape(t[n])}return e}function BA(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let n=unescape(t.host);if(!Of(n)){let r=Pf(n);r.isIPV6===!0?n=`[${r.escapedHost}]`:n=Cf(n,!1)}e.push(n)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Df.exports={nonSimpleDomain:kA,recomposeAuthority:BA,reescapeHostDelimiters:Cf,normalizePercentEncoding:jA,normalizePathEncoding:GA,escapePreservingEscapes:ZA,removeDotSegments:MA,isIPv4:Of,isUUID:DA,normalizeIPv6:Pf,stringArrayToHexStripped:sd}});var $f=N((O$,Lf)=>{"use strict";u();var{isUUID:qA}=id(),VA=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,WA=["http","https","ws","wss","urn","urn:uuid"];function HA(t){return WA.indexOf(t)!==-1}function cd(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 Rf(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function kf(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 YA(t){return t.secure=cd(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function KA(t){if((t.port===(cd(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,n]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=n,t.resourceName=void 0}return t.fragment=void 0,t}function JA(t,e){if(!t.path)return t.error="URN can not be parsed",t;let n=t.path.match(VA);if(n){let r=e.scheme||t.scheme||"urn";t.nid=n[1].toLowerCase(),t.nss=n[2];let o=`${r}:${e.nid||t.nid}`,a=ld(o);t.path=void 0,a&&(t=a.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function XA(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let n=e.scheme||t.scheme||"urn",r=t.nid.toLowerCase(),o=`${n}:${e.nid||r}`,a=ld(o);a&&(t=a.serialize(t,e));let s=t,i=t.nss;return s.path=`${r||e.nid}:${i}`,e.skipEscape=!0,s}function QA(t,e){let n=t;return n.uuid=n.nss,n.nss=void 0,!e.tolerant&&(!n.uuid||!qA(n.uuid))&&(n.error=n.error||"UUID is not valid."),n}function eS(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var xf={scheme:"http",domainHost:!0,parse:Rf,serialize:kf},tS={scheme:"https",domainHost:xf.domainHost,parse:Rf,serialize:kf},Xa={scheme:"ws",domainHost:!0,parse:YA,serialize:KA},nS={scheme:"wss",domainHost:Xa.domainHost,parse:Xa.parse,serialize:Xa.serialize},rS={scheme:"urn",parse:JA,serialize:XA,skipNormalize:!0},oS={scheme:"urn:uuid",parse:QA,serialize:eS,skipNormalize:!0},Qa={http:xf,https:tS,ws:Xa,wss:nS,urn:rS,"urn:uuid":oS};Object.setPrototypeOf(Qa,null);function ld(t){return t&&(Qa[t]||Qa[t.toLowerCase()])||void 0}Lf.exports={wsIsSecure:cd,SCHEMES:Qa,isValidSchemeName:HA,getSchemeHandler:ld}});var Gf=N((P$,es)=>{"use strict";u();var{normalizeIPv6:aS,removeDotSegments:fo,recomposeAuthority:sS,normalizePercentEncoding:iS,normalizePathEncoding:cS,escapePreservingEscapes:lS,reescapeHostDelimiters:dS,isIPv4:uS,nonSimpleDomain:hS}=id(),{SCHEMES:pS,getSchemeHandler:zf}=$f();function mS(t,e){return typeof t=="string"?t=ES(t,e):typeof t=="object"&&(t=hr(Dn(t,e),e)),t}function fS(t,e,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},o=Uf(hr(t,r),hr(e,r),r,!0);return r.skipEscape=!0,Dn(o,r)}function Uf(t,e,n,r){let o={};return r||(t=hr(Dn(t,n),n),e=hr(Dn(e,n),n)),n=n||{},!n.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=fo(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=fo(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=fo(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=fo(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function _S(t,e,n){let r=Mf(t,n),o=Mf(e,n);return r!==void 0&&o!==void 0&&r.toLowerCase()===o.toLowerCase()}function Dn(t,e){let n={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:""},r=Object.assign({},e),o=[],a=zf(r.scheme||n.scheme);a&&a.serialize&&a.serialize(n,r),n.path!==void 0&&(r.skipEscape?n.path=iS(n.path):(n.path=lS(n.path),n.scheme!==void 0&&(n.path=n.path.split("%3A").join(":")))),r.reference!=="suffix"&&n.scheme&&o.push(n.scheme,":");let s=sS(n);if(s!==void 0&&(r.reference!=="suffix"&&o.push("//"),o.push(s),n.path&&n.path[0]!=="/"&&o.push("/")),n.path!==void 0){let i=n.path;!r.absolutePath&&(!a||!a.absolutePath)&&(i=fo(i)),s===void 0&&i[0]==="/"&&i[1]==="/"&&(i="/%2F"+i.slice(2)),o.push(i)}return n.query!==void 0&&o.push("?",n.query),n.fragment!==void 0&&o.push("#",n.fragment),o.join("")}var gS=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function yS(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 Ff(t,e){let n=Object.assign({},e),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,a=!1;n.reference==="suffix"&&(n.scheme?t=n.scheme+":"+t:t="//"+t);let s=t.match(gS);if(s){r.scheme=s[1],r.userinfo=s[3],r.host=s[4],r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=s[7],r.fragment=s[8],isNaN(r.port)&&(r.port=s[5]);let i=yS(r,s);if(i!==void 0&&(r.error=r.error||i,o=!0),r.host)if(uS(r.host)===!1){let h=aS(r.host);r.host=h.host.toLowerCase(),a=h.isIPV6}else a=!0;r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path?r.reference="same-document":r.scheme===void 0?r.reference="relative":r.fragment===void 0?r.reference="absolute":r.reference="uri",n.reference&&n.reference!=="suffix"&&n.reference!==r.reference&&(r.error=r.error||"URI is not a "+n.reference+" reference.");let l=zf(n.scheme||r.scheme);if(!n.unicodeSupport&&(!l||!l.unicodeSupport)&&r.host&&(n.domainHost||l&&l.domainHost)&&a===!1&&hS(r.host))try{r.host=URL.domainToASCII(r.host.toLowerCase())}catch(d){r.error=r.error||"Host's domain name can not be converted to ASCII: "+d}if((!l||l&&!l.skipNormalize)&&(t.indexOf("%")!==-1&&(r.scheme!==void 0&&(r.scheme=unescape(r.scheme)),r.host!==void 0&&(r.host=dS(unescape(r.host),a))),r.path&&(r.path=cS(r.path)),r.fragment))try{r.fragment=encodeURI(decodeURIComponent(r.fragment))}catch{r.error=r.error||"URI malformed"}l&&l.parse&&l.parse(r,n)}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:o}}function hr(t,e){return Ff(t,e).parsed}function ES(t,e){return jf(t,e).normalized}function jf(t,e){let{parsed:n,malformedAuthorityOrPort:r}=Ff(t,e);return{normalized:r?t:Dn(n,e),malformedAuthorityOrPort:r}}function Mf(t,e){if(typeof t=="string"){let{normalized:n,malformedAuthorityOrPort:r}=jf(t,e);return r?void 0:n}if(typeof t=="object")return Dn(t,e)}var dd={SCHEMES:pS,normalize:mS,resolve:fS,resolveComponent:Uf,equal:_S,serialize:Dn,parse:hr};es.exports=dd;es.exports.default=dd;es.exports.fastUri=dd});var Bf=N(ud=>{"use strict";u();Object.defineProperty(ud,"__esModule",{value:!0});var Zf=Gf();Zf.code='require("ajv/dist/runtime/uri").default';ud.default=Zf});var Xf=N(Oe=>{"use strict";u();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.CodeGen=Oe.Name=Oe.nil=Oe.stringify=Oe.str=Oe._=Oe.KeywordCxt=void 0;var TS=po();Object.defineProperty(Oe,"KeywordCxt",{enumerable:!0,get:function(){return TS.KeywordCxt}});var pr=q();Object.defineProperty(Oe,"_",{enumerable:!0,get:function(){return pr._}});Object.defineProperty(Oe,"str",{enumerable:!0,get:function(){return pr.str}});Object.defineProperty(Oe,"stringify",{enumerable:!0,get:function(){return pr.stringify}});Object.defineProperty(Oe,"nil",{enumerable:!0,get:function(){return pr.nil}});Object.defineProperty(Oe,"Name",{enumerable:!0,get:function(){return pr.Name}});Object.defineProperty(Oe,"CodeGen",{enumerable:!0,get:function(){return pr.CodeGen}});var bS=Ya(),Yf=mo(),wS=Ul(),_o=Ja(),vS=q(),go=lo(),ts=co(),pd=Q(),qf=Af(),IS=Bf(),Kf=(t,e)=>new RegExp(t,e);Kf.code="new RegExp";var AS=["removeAdditional","useDefaults","coerceTypes"],SS=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),OS={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."},NS={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Vf=200;function PS(t){var e,n,r,o,a,s,i,l,d,h,p,g,f,m,y,T,w,I,S,D,M,ke,Ye,zn,Cs;let vr=t.strict,Ds=(e=t.code)===null||e===void 0?void 0:e.optimize,wu=Ds===!0||Ds===void 0?1:Ds||0,vu=(r=(n=t.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:Kf,ry=(o=t.uriResolver)!==null&&o!==void 0?o:IS.default;return{strictSchema:(s=(a=t.strictSchema)!==null&&a!==void 0?a:vr)!==null&&s!==void 0?s:!0,strictNumbers:(l=(i=t.strictNumbers)!==null&&i!==void 0?i:vr)!==null&&l!==void 0?l:!0,strictTypes:(h=(d=t.strictTypes)!==null&&d!==void 0?d:vr)!==null&&h!==void 0?h:"log",strictTuples:(g=(p=t.strictTuples)!==null&&p!==void 0?p:vr)!==null&&g!==void 0?g:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:vr)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:wu,regExp:vu}:{optimize:wu,regExp:vu},loopRequired:(y=t.loopRequired)!==null&&y!==void 0?y:Vf,loopEnum:(T=t.loopEnum)!==null&&T!==void 0?T:Vf,meta:(w=t.meta)!==null&&w!==void 0?w:!0,messages:(I=t.messages)!==null&&I!==void 0?I:!0,inlineRefs:(S=t.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(D=t.schemaId)!==null&&D!==void 0?D:"$id",addUsedSchema:(M=t.addUsedSchema)!==null&&M!==void 0?M:!0,validateSchema:(ke=t.validateSchema)!==null&&ke!==void 0?ke:!0,validateFormats:(Ye=t.validateFormats)!==null&&Ye!==void 0?Ye:!0,unicodeRegExp:(zn=t.unicodeRegExp)!==null&&zn!==void 0?zn:!0,int32range:(Cs=t.int32range)!==null&&Cs!==void 0?Cs:!0,uriResolver:ry}}var yo=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,...PS(e)};let{es5:n,lines:r}=this.opts.code;this.scope=new vS.ValueScope({scope:{},prefixes:SS,es5:n,lines:r}),this.logger=LS(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,wS.getRules)(),Wf.call(this,OS,e,"NOT SUPPORTED"),Wf.call(this,NS,e,"DEPRECATED","warn"),this._metaOpts=kS.call(this),e.formats&&DS.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&RS.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),CS.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:n,schemaId:r}=this.opts,o=qf;r==="id"&&(o={...qf},o.id=o.$id,delete o.$id),n&&e&&this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:n}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[n]||e:void 0}validate(e,n){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(n);return"$async"in r||(this.errors=r.errors),o}compile(e,n){let r=this._addSchema(e,n);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,n){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,n);async function o(h,p){await a.call(this,h.$schema);let g=this._addSchema(h,p);return g.validate||s.call(this,g)}async function a(h){h&&!this.getSchema(h)&&await o.call(this,{$ref:h},!0)}async function s(h){try{return this._compileSchemaEnv(h)}catch(p){if(!(p instanceof Yf.default))throw p;return i.call(this,p),await l.call(this,p.missingSchema),s.call(this,h)}}function i({missingSchema:h,missingRef:p}){if(this.refs[h])throw new Error(`AnySchema ${h} is loaded but ${p} cannot be resolved`)}async function l(h){let p=await d.call(this,h);this.refs[h]||await a.call(this,p.$schema),this.refs[h]||this.addSchema(p,h,n)}async function d(h){let p=this._loading[h];if(p)return p;try{return await(this._loading[h]=r(h))}finally{delete this._loading[h]}}}addSchema(e,n,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,o);return this}let a;if(typeof e=="object"){let{schemaId:s}=this.opts;if(a=e[s],a!==void 0&&typeof a!="string")throw new Error(`schema ${s} must be string`)}return n=(0,go.normalizeId)(n||a),this._checkUnique(n),this.schemas[n]=this._addSchema(e,r,n,o,!0),this}addMetaSchema(e,n,r=this.opts.validateSchema){return this.addSchema(e,n,!0,r),this}validateSchema(e,n){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&n){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return o}getSchema(e){let n;for(;typeof(n=Hf.call(this,e))=="string";)e=n;if(n===void 0){let{schemaId:r}=this.opts,o=new _o.SchemaEnv({schema:{},schemaId:r});if(n=_o.resolveSchema.call(this,o,e),!n)return;this.refs[e]=n}return n.validate||this._compileSchemaEnv(n)}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 n=Hf.call(this,e);return typeof n=="object"&&this._cache.delete(n.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let n=e;this._cache.delete(n);let r=e[this.opts.schemaId];return r&&(r=(0,go.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let n of e)this.addKeyword(n);return this}addKeyword(e,n){let r;if(typeof e=="string")r=e,typeof n=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),n.keyword=r);else if(typeof e=="object"&&n===void 0){if(n=e,r=n.keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(MS.call(this,r,n),!n)return(0,pd.eachItem)(r,a=>hd.call(this,a)),this;US.call(this,n);let o={...n,type:(0,ts.getJSONTypes)(n.type),schemaType:(0,ts.getJSONTypes)(n.schemaType)};return(0,pd.eachItem)(r,o.type.length===0?a=>hd.call(this,a,o):a=>o.type.forEach(s=>hd.call(this,a,o,s))),this}getKeyword(e){let n=this.RULES.all[e];return typeof n=="object"?n.definition:!!n}removeKeyword(e){let{RULES:n}=this;delete n.keywords[e],delete n.all[e];for(let r of n.rules){let o=r.rules.findIndex(a=>a.keyword===e);o>=0&&r.rules.splice(o,1)}return this}addFormat(e,n){return typeof n=="string"&&(n=new RegExp(n)),this.formats[e]=n,this}errorsText(e=this.errors,{separator:n=", ",dataVar:r="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${r}${o.instancePath} ${o.message}`).reduce((o,a)=>o+n+a)}$dataMetaSchema(e,n){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of n){let a=o.split("/").slice(1),s=e;for(let i of a)s=s[i];for(let i in r){let l=r[i];if(typeof l!="object")continue;let{$data:d}=l.definition,h=s[i];d&&h&&(s[i]=Jf(h))}}return e}_removeAllSchemas(e,n){for(let r in e){let o=e[r];(!n||n.test(r))&&(typeof o=="string"?delete e[r]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[r]))}}_addSchema(e,n,r,o=this.opts.validateSchema,a=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];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 l=this._cache.get(e);if(l!==void 0)return l;r=(0,go.normalizeId)(s||r);let d=go.getSchemaRefs.call(this,e,r);return l=new _o.SchemaEnv({schema:e,schemaId:i,meta:n,baseId:r,localRefs:d}),this._cache.set(l.schema,l),a&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),o&&this.validateSchema(e,!0),l}_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):_o.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let n=this.opts;this.opts=this._metaOpts;try{_o.compileSchema.call(this,e)}finally{this.opts=n}}};yo.ValidationError=bS.default;yo.MissingRefError=Yf.default;Oe.default=yo;function Wf(t,e,n,r="error"){for(let o in t){let a=o;a in e&&this.logger[r](`${n}: option ${o}. ${t[a]}`)}}function Hf(t){return t=(0,go.normalizeId)(t),this.schemas[t]||this.refs[t]}function CS(){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 DS(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function RS(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 n=t[e];n.keyword||(n.keyword=e),this.addKeyword(n)}}function kS(){let t={...this.opts};for(let e of AS)delete t[e];return t}var xS={log(){},warn(){},error(){}};function LS(t){if(t===!1)return xS;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 $S=/^[a-z_$][a-z0-9_$:-]*$/i;function MS(t,e){let{RULES:n}=this;if((0,pd.eachItem)(t,r=>{if(n.keywords[r])throw new Error(`Keyword ${r} is already defined`);if(!$S.test(r))throw new Error(`Keyword ${r} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function hd(t,e,n){var r;let o=e?.post;if(n&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,s=o?a.post:a.rules.find(({type:l})=>l===n);if(s||(s={type:n,rules:[]},a.rules.push(s)),a.keywords[t]=!0,!e)return;let i={keyword:t,definition:{...e,type:(0,ts.getJSONTypes)(e.type),schemaType:(0,ts.getJSONTypes)(e.schemaType)}};e.before?zS.call(this,s,i,e.before):s.rules.push(i),a.all[t]=i,(r=e.implements)===null||r===void 0||r.forEach(l=>this.addKeyword(l))}function zS(t,e,n){let r=t.rules.findIndex(o=>o.keyword===n);r>=0?t.rules.splice(r,0,e):(t.rules.push(e),this.logger.warn(`rule ${n} is not defined`))}function US(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Jf(e)),t.validateSchema=this.compile(e,!0))}var FS={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Jf(t){return{anyOf:[t,FS]}}});var Qf=N(md=>{"use strict";u();Object.defineProperty(md,"__esModule",{value:!0});var jS={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};md.default=jS});var r_=N(Rn=>{"use strict";u();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.callRef=Rn.getValidate=void 0;var GS=mo(),e_=nt(),qe=q(),mr=Ct(),t_=Ja(),ns=Q(),ZS={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:n,it:r}=t,{baseId:o,schemaEnv:a,validateName:s,opts:i,self:l}=r,{root:d}=a;if((n==="#"||n==="#/")&&o===d.baseId)return p();let h=t_.resolveRef.call(l,d,o,n);if(h===void 0)throw new GS.default(r.opts.uriResolver,o,n);if(h instanceof t_.SchemaEnv)return g(h);return f(h);function p(){if(a===d)return rs(t,s,a,a.$async);let m=e.scopeValue("root",{ref:d});return rs(t,(0,qe._)`${m}.validate`,d,d.$async)}function g(m){let y=n_(t,m);rs(t,y,m,m.$async)}function f(m){let y=e.scopeValue("schema",i.code.source===!0?{ref:m,code:(0,qe.stringify)(m)}:{ref:m}),T=e.name("valid"),w=t.subschema({schema:m,dataTypes:[],schemaPath:qe.nil,topSchemaRef:y,errSchemaPath:n},T);t.mergeEvaluated(w),t.ok(T)}}};function n_(t,e){let{gen:n}=t;return e.validate?n.scopeValue("validate",{ref:e.validate}):(0,qe._)`${n.scopeValue("wrapper",{ref:e})}.validate`}Rn.getValidate=n_;function rs(t,e,n,r){let{gen:o,it:a}=t,{allErrors:s,schemaEnv:i,opts:l}=a,d=l.passContext?mr.default.this:qe.nil;r?h():p();function h(){if(!i.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,qe._)`await ${(0,e_.callValidateCode)(t,e,d)}`),f(e),s||o.assign(m,!0)},y=>{o.if((0,qe._)`!(${y} instanceof ${a.ValidationError})`,()=>o.throw(y)),g(y),s||o.assign(m,!1)}),t.ok(m)}function p(){t.result((0,e_.callValidateCode)(t,e,d),()=>f(e),()=>g(e))}function g(m){let y=(0,qe._)`${m}.errors`;o.assign(mr.default.vErrors,(0,qe._)`${mr.default.vErrors} === null ? ${y} : ${mr.default.vErrors}.concat(${y})`),o.assign(mr.default.errors,(0,qe._)`${mr.default.vErrors}.length`)}function f(m){var y;if(!a.opts.unevaluated)return;let T=(y=n?.validate)===null||y===void 0?void 0:y.evaluated;if(a.props!==!0)if(T&&!T.dynamicProps)T.props!==void 0&&(a.props=ns.mergeEvaluated.props(o,T.props,a.props));else{let w=o.var("props",(0,qe._)`${m}.evaluated.props`);a.props=ns.mergeEvaluated.props(o,w,a.props,qe.Name)}if(a.items!==!0)if(T&&!T.dynamicItems)T.items!==void 0&&(a.items=ns.mergeEvaluated.items(o,T.items,a.items));else{let w=o.var("items",(0,qe._)`${m}.evaluated.items`);a.items=ns.mergeEvaluated.items(o,w,a.items,qe.Name)}}}Rn.callRef=rs;Rn.default=ZS});var o_=N(fd=>{"use strict";u();Object.defineProperty(fd,"__esModule",{value:!0});var BS=Qf(),qS=r_(),VS=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",BS.default,qS.default];fd.default=VS});var a_=N(_d=>{"use strict";u();Object.defineProperty(_d,"__esModule",{value:!0});var os=q(),Kt=os.operators,as={maximum:{okStr:"<=",ok:Kt.LTE,fail:Kt.GT},minimum:{okStr:">=",ok:Kt.GTE,fail:Kt.LT},exclusiveMaximum:{okStr:"<",ok:Kt.LT,fail:Kt.GTE},exclusiveMinimum:{okStr:">",ok:Kt.GT,fail:Kt.LTE}},WS={message:({keyword:t,schemaCode:e})=>(0,os.str)`must be ${as[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,os._)`{comparison: ${as[t].okStr}, limit: ${e}}`},HS={keyword:Object.keys(as),type:"number",schemaType:"number",$data:!0,error:WS,code(t){let{keyword:e,data:n,schemaCode:r}=t;t.fail$data((0,os._)`${n} ${as[e].fail} ${r} || isNaN(${n})`)}};_d.default=HS});var s_=N(gd=>{"use strict";u();Object.defineProperty(gd,"__esModule",{value:!0});var Eo=q(),YS={message:({schemaCode:t})=>(0,Eo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Eo._)`{multipleOf: ${t}}`},KS={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:YS,code(t){let{gen:e,data:n,schemaCode:r,it:o}=t,a=o.opts.multipleOfPrecision,s=e.let("res"),i=a?(0,Eo._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${a}`:(0,Eo._)`${s} !== parseInt(${s})`;t.fail$data((0,Eo._)`(${r} === 0 || (${s} = ${n}/${r}, ${i}))`)}};gd.default=KS});var c_=N(yd=>{"use strict";u();Object.defineProperty(yd,"__esModule",{value:!0});function i_(t){let e=t.length,n=0,r=0,o;for(;r<e;)n++,o=t.charCodeAt(r++),o>=55296&&o<=56319&&r<e&&(o=t.charCodeAt(r),(o&64512)===56320&&r++);return n}yd.default=i_;i_.code='require("ajv/dist/runtime/ucs2length").default'});var l_=N(Ed=>{"use strict";u();Object.defineProperty(Ed,"__esModule",{value:!0});var kn=q(),JS=Q(),XS=c_(),QS={message({keyword:t,schemaCode:e}){let n=t==="maxLength"?"more":"fewer";return(0,kn.str)`must NOT have ${n} than ${e} characters`},params:({schemaCode:t})=>(0,kn._)`{limit: ${t}}`},eO={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:QS,code(t){let{keyword:e,data:n,schemaCode:r,it:o}=t,a=e==="maxLength"?kn.operators.GT:kn.operators.LT,s=o.opts.unicode===!1?(0,kn._)`${n}.length`:(0,kn._)`${(0,JS.useFunc)(t.gen,XS.default)}(${n})`;t.fail$data((0,kn._)`${s} ${a} ${r}`)}};Ed.default=eO});var d_=N(Td=>{"use strict";u();Object.defineProperty(Td,"__esModule",{value:!0});var tO=nt(),nO=Q(),fr=q(),rO={message:({schemaCode:t})=>(0,fr.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,fr._)`{pattern: ${t}}`},oO={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:rO,code(t){let{gen:e,data:n,$data:r,schema:o,schemaCode:a,it:s}=t,i=s.opts.unicodeRegExp?"u":"";if(r){let{regExp:l}=s.opts.code,d=l.code==="new RegExp"?(0,fr._)`new RegExp`:(0,nO.useFunc)(e,l),h=e.let("valid");e.try(()=>e.assign(h,(0,fr._)`${d}(${a}, ${i}).test(${n})`),()=>e.assign(h,!1)),t.fail$data((0,fr._)`!${h}`)}else{let l=(0,tO.usePattern)(t,o);t.fail$data((0,fr._)`!${l}.test(${n})`)}}};Td.default=oO});var u_=N(bd=>{"use strict";u();Object.defineProperty(bd,"__esModule",{value:!0});var To=q(),aO={message({keyword:t,schemaCode:e}){let n=t==="maxProperties"?"more":"fewer";return(0,To.str)`must NOT have ${n} than ${e} properties`},params:({schemaCode:t})=>(0,To._)`{limit: ${t}}`},sO={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:aO,code(t){let{keyword:e,data:n,schemaCode:r}=t,o=e==="maxProperties"?To.operators.GT:To.operators.LT;t.fail$data((0,To._)`Object.keys(${n}).length ${o} ${r}`)}};bd.default=sO});var h_=N(wd=>{"use strict";u();Object.defineProperty(wd,"__esModule",{value:!0});var bo=nt(),wo=q(),iO=Q(),cO={message:({params:{missingProperty:t}})=>(0,wo.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,wo._)`{missingProperty: ${t}}`},lO={keyword:"required",type:"object",schemaType:"array",$data:!0,error:cO,code(t){let{gen:e,schema:n,schemaCode:r,data:o,$data:a,it:s}=t,{opts:i}=s;if(!a&&n.length===0)return;let l=n.length>=i.loopRequired;if(s.allErrors?d():h(),i.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let y of n)if(f?.[y]===void 0&&!m.has(y)){let T=s.schemaEnv.baseId+s.errSchemaPath,w=`required property "${y}" is not defined at "${T}" (strictRequired)`;(0,iO.checkStrictMode)(s,w,s.opts.strictRequired)}}function d(){if(l||a)t.block$data(wo.nil,p);else for(let f of n)(0,bo.checkReportMissingProp)(t,f)}function h(){let f=e.let("missing");if(l||a){let m=e.let("valid",!0);t.block$data(m,()=>g(f,m)),t.ok(m)}else e.if((0,bo.checkMissingProp)(t,n,f)),(0,bo.reportMissingProp)(t,f),e.else()}function p(){e.forOf("prop",r,f=>{t.setParams({missingProperty:f}),e.if((0,bo.noPropertyInData)(e,o,f,i.ownProperties),()=>t.error())})}function g(f,m){t.setParams({missingProperty:f}),e.forOf(f,r,()=>{e.assign(m,(0,bo.propertyInData)(e,o,f,i.ownProperties)),e.if((0,wo.not)(m),()=>{t.error(),e.break()})},wo.nil)}}};wd.default=lO});var p_=N(vd=>{"use strict";u();Object.defineProperty(vd,"__esModule",{value:!0});var vo=q(),dO={message({keyword:t,schemaCode:e}){let n=t==="maxItems"?"more":"fewer";return(0,vo.str)`must NOT have ${n} than ${e} items`},params:({schemaCode:t})=>(0,vo._)`{limit: ${t}}`},uO={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:dO,code(t){let{keyword:e,data:n,schemaCode:r}=t,o=e==="maxItems"?vo.operators.GT:vo.operators.LT;t.fail$data((0,vo._)`${n}.length ${o} ${r}`)}};vd.default=uO});var ss=N(Id=>{"use strict";u();Object.defineProperty(Id,"__esModule",{value:!0});var m_=Wl();m_.code='require("ajv/dist/runtime/equal").default';Id.default=m_});var f_=N(Sd=>{"use strict";u();Object.defineProperty(Sd,"__esModule",{value:!0});var Ad=co(),Ne=q(),hO=Q(),pO=ss(),mO={message:({params:{i:t,j:e}})=>(0,Ne.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ne._)`{i: ${t}, j: ${e}}`},fO={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:mO,code(t){let{gen:e,data:n,$data:r,schema:o,parentSchema:a,schemaCode:s,it:i}=t;if(!r&&!o)return;let l=e.let("valid"),d=a.items?(0,Ad.getSchemaTypes)(a.items):[];t.block$data(l,h,(0,Ne._)`${s} === false`),t.ok(l);function h(){let m=e.let("i",(0,Ne._)`${n}.length`),y=e.let("j");t.setParams({i:m,j:y}),e.assign(l,!0),e.if((0,Ne._)`${m} > 1`,()=>(p()?g:f)(m,y))}function p(){return d.length>0&&!d.some(m=>m==="object"||m==="array")}function g(m,y){let T=e.name("item"),w=(0,Ad.checkDataTypes)(d,T,i.opts.strictNumbers,Ad.DataType.Wrong),I=e.const("indices",(0,Ne._)`{}`);e.for((0,Ne._)`;${m}--;`,()=>{e.let(T,(0,Ne._)`${n}[${m}]`),e.if(w,(0,Ne._)`continue`),d.length>1&&e.if((0,Ne._)`typeof ${T} == "string"`,(0,Ne._)`${T} += "_"`),e.if((0,Ne._)`typeof ${I}[${T}] == "number"`,()=>{e.assign(y,(0,Ne._)`${I}[${T}]`),t.error(),e.assign(l,!1).break()}).code((0,Ne._)`${I}[${T}] = ${m}`)})}function f(m,y){let T=(0,hO.useFunc)(e,pO.default),w=e.name("outer");e.label(w).for((0,Ne._)`;${m}--;`,()=>e.for((0,Ne._)`${y} = ${m}; ${y}--;`,()=>e.if((0,Ne._)`${T}(${n}[${m}], ${n}[${y}])`,()=>{t.error(),e.assign(l,!1).break(w)})))}}};Sd.default=fO});var __=N(Nd=>{"use strict";u();Object.defineProperty(Nd,"__esModule",{value:!0});var Od=q(),_O=Q(),gO=ss(),yO={message:"must be equal to constant",params:({schemaCode:t})=>(0,Od._)`{allowedValue: ${t}}`},EO={keyword:"const",$data:!0,error:yO,code(t){let{gen:e,data:n,$data:r,schemaCode:o,schema:a}=t;r||a&&typeof a=="object"?t.fail$data((0,Od._)`!${(0,_O.useFunc)(e,gO.default)}(${n}, ${o})`):t.fail((0,Od._)`${a} !== ${n}`)}};Nd.default=EO});var g_=N(Pd=>{"use strict";u();Object.defineProperty(Pd,"__esModule",{value:!0});var Io=q(),TO=Q(),bO=ss(),wO={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Io._)`{allowedValues: ${t}}`},vO={keyword:"enum",schemaType:"array",$data:!0,error:wO,code(t){let{gen:e,data:n,$data:r,schema:o,schemaCode:a,it:s}=t;if(!r&&o.length===0)throw new Error("enum must have non-empty array");let i=o.length>=s.opts.loopEnum,l,d=()=>l??(l=(0,TO.useFunc)(e,bO.default)),h;if(i||r)h=e.let("valid"),t.block$data(h,p);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",a);h=(0,Io.or)(...o.map((m,y)=>g(f,y)))}t.pass(h);function p(){e.assign(h,!1),e.forOf("v",a,f=>e.if((0,Io._)`${d()}(${n}, ${f})`,()=>e.assign(h,!0).break()))}function g(f,m){let y=o[m];return typeof y=="object"&&y!==null?(0,Io._)`${d()}(${n}, ${f}[${m}])`:(0,Io._)`${n} === ${y}`}}};Pd.default=vO});var y_=N(Cd=>{"use strict";u();Object.defineProperty(Cd,"__esModule",{value:!0});var IO=a_(),AO=s_(),SO=l_(),OO=d_(),NO=u_(),PO=h_(),CO=p_(),DO=f_(),RO=__(),kO=g_(),xO=[IO.default,AO.default,SO.default,OO.default,NO.default,PO.default,CO.default,DO.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},RO.default,kO.default];Cd.default=xO});var Rd=N(Ao=>{"use strict";u();Object.defineProperty(Ao,"__esModule",{value:!0});Ao.validateAdditionalItems=void 0;var xn=q(),Dd=Q(),LO={message:({params:{len:t}})=>(0,xn.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,xn._)`{limit: ${t}}`},$O={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:LO,code(t){let{parentSchema:e,it:n}=t,{items:r}=e;if(!Array.isArray(r)){(0,Dd.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}E_(t,r)}};function E_(t,e){let{gen:n,schema:r,data:o,keyword:a,it:s}=t;s.items=!0;let i=n.const("len",(0,xn._)`${o}.length`);if(r===!1)t.setParams({len:e.length}),t.pass((0,xn._)`${i} <= ${e.length}`);else if(typeof r=="object"&&!(0,Dd.alwaysValidSchema)(s,r)){let d=n.var("valid",(0,xn._)`${i} <= ${e.length}`);n.if((0,xn.not)(d),()=>l(d)),t.ok(d)}function l(d){n.forRange("i",e.length,i,h=>{t.subschema({keyword:a,dataProp:h,dataPropType:Dd.Type.Num},d),s.allErrors||n.if((0,xn.not)(d),()=>n.break())})}}Ao.validateAdditionalItems=E_;Ao.default=$O});var kd=N(So=>{"use strict";u();Object.defineProperty(So,"__esModule",{value:!0});So.validateTuple=void 0;var T_=q(),is=Q(),MO=nt(),zO={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:n}=t;if(Array.isArray(e))return b_(t,"additionalItems",e);n.items=!0,!(0,is.alwaysValidSchema)(n,e)&&t.ok((0,MO.validateArray)(t))}};function b_(t,e,n=t.schema){let{gen:r,parentSchema:o,data:a,keyword:s,it:i}=t;h(o),i.opts.unevaluated&&n.length&&i.items!==!0&&(i.items=is.mergeEvaluated.items(r,n.length,i.items));let l=r.name("valid"),d=r.const("len",(0,T_._)`${a}.length`);n.forEach((p,g)=>{(0,is.alwaysValidSchema)(i,p)||(r.if((0,T_._)`${d} > ${g}`,()=>t.subschema({keyword:s,schemaProp:g,dataProp:g},l)),t.ok(l))});function h(p){let{opts:g,errSchemaPath:f}=i,m=n.length,y=m===p.minItems&&(m===p.maxItems||p[e]===!1);if(g.strictTuples&&!y){let T=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,is.checkStrictMode)(i,T,g.strictTuples)}}}So.validateTuple=b_;So.default=zO});var w_=N(xd=>{"use strict";u();Object.defineProperty(xd,"__esModule",{value:!0});var UO=kd(),FO={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,UO.validateTuple)(t,"items")};xd.default=FO});var I_=N(Ld=>{"use strict";u();Object.defineProperty(Ld,"__esModule",{value:!0});var v_=q(),jO=Q(),GO=nt(),ZO=Rd(),BO={message:({params:{len:t}})=>(0,v_.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,v_._)`{limit: ${t}}`},qO={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:BO,code(t){let{schema:e,parentSchema:n,it:r}=t,{prefixItems:o}=n;r.items=!0,!(0,jO.alwaysValidSchema)(r,e)&&(o?(0,ZO.validateAdditionalItems)(t,o):t.ok((0,GO.validateArray)(t)))}};Ld.default=qO});var A_=N($d=>{"use strict";u();Object.defineProperty($d,"__esModule",{value:!0});var ot=q(),cs=Q(),VO={message:({params:{min:t,max:e}})=>e===void 0?(0,ot.str)`must contain at least ${t} valid item(s)`:(0,ot.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ot._)`{minContains: ${t}}`:(0,ot._)`{minContains: ${t}, maxContains: ${e}}`},WO={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:VO,code(t){let{gen:e,schema:n,parentSchema:r,data:o,it:a}=t,s,i,{minContains:l,maxContains:d}=r;a.opts.next?(s=l===void 0?1:l,i=d):s=1;let h=e.const("len",(0,ot._)`${o}.length`);if(t.setParams({min:s,max:i}),i===void 0&&s===0){(0,cs.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&s>i){(0,cs.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,cs.alwaysValidSchema)(a,n)){let y=(0,ot._)`${h} >= ${s}`;i!==void 0&&(y=(0,ot._)`${y} && ${h} <= ${i}`),t.pass(y);return}a.items=!0;let p=e.name("valid");i===void 0&&s===1?f(p,()=>e.if(p,()=>e.break())):s===0?(e.let(p,!0),i!==void 0&&e.if((0,ot._)`${o}.length > 0`,g)):(e.let(p,!1),g()),t.result(p,()=>t.reset());function g(){let y=e.name("_valid"),T=e.let("count",0);f(y,()=>e.if(y,()=>m(T)))}function f(y,T){e.forRange("i",0,h,w=>{t.subschema({keyword:"contains",dataProp:w,dataPropType:cs.Type.Num,compositeRule:!0},y),T()})}function m(y){e.code((0,ot._)`${y}++`),i===void 0?e.if((0,ot._)`${y} >= ${s}`,()=>e.assign(p,!0).break()):(e.if((0,ot._)`${y} > ${i}`,()=>e.assign(p,!1).break()),s===1?e.assign(p,!0):e.if((0,ot._)`${y} >= ${s}`,()=>e.assign(p,!0)))}}};$d.default=WO});var N_=N(Tt=>{"use strict";u();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.validateSchemaDeps=Tt.validatePropertyDeps=Tt.error=void 0;var Md=q(),HO=Q(),Oo=nt();Tt.error={message:({params:{property:t,depsCount:e,deps:n}})=>{let r=e===1?"property":"properties";return(0,Md.str)`must have ${r} ${n} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:n,missingProperty:r}})=>(0,Md._)`{property: ${t},
7
+ || ${s} === "boolean" || ${o} === null`).assign(i,(0,Z._)`[${o}]`)}}}function TI({gen:t,parentData:e,parentDataProperty:n},r){t.if((0,Z._)`${e} !== undefined`,()=>t.assign((0,Z._)`${e}[${n}]`,r))}function Zl(t,e,n,r=lr.Correct){let o=r===lr.Correct?Z.operators.EQ:Z.operators.NEQ,a;switch(t){case"null":return(0,Z._)`${e} ${o} null`;case"array":a=(0,Z._)`Array.isArray(${e})`;break;case"object":a=(0,Z._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":a=s((0,Z._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":a=s();break;default:return(0,Z._)`typeof ${e} ${o} ${t}`}return r===lr.Correct?a:(0,Z.not)(a);function s(i=Z.nil){return(0,Z.and)((0,Z._)`typeof ${e} == "number"`,i,n?(0,Z._)`isFinite(${e})`:Z.nil)}}Re.checkDataType=Zl;function Bl(t,e,n,r){if(t.length===1)return Zl(t[0],e,n,r);let o,a=(0,qm.toHash)(t);if(a.array&&a.object){let s=(0,Z._)`typeof ${e} != "object"`;o=a.null?s:(0,Z._)`!${e} || ${s}`,delete a.null,delete a.array,delete a.object}else o=Z.nil;a.number&&delete a.integer;for(let s in a)o=(0,Z.and)(o,Zl(s,e,n,r));return o}Re.checkDataTypes=Bl;var bI={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,Z._)`{type: ${t}}`:(0,Z._)`{type: ${e}}`};function ql(t){let e=wI(t);(0,fI.reportError)(e,bI)}Re.reportTypeError=ql;function wI(t){let{gen:e,data:n,schema:r}=t,o=(0,qm.schemaRefOrVal)(t,r,"type");return{gen:e,keyword:"type",data:n,schema:r.type,schemaCode:o,schemaValue:o,parentSchema:r,params:{},it:t}}});var Ym=N(Va=>{"use strict";u();Object.defineProperty(Va,"__esModule",{value:!0});Va.assignDefaults=void 0;var dr=q(),vI=Q();function II(t,e){let{properties:n,items:r}=t.schema;if(e==="object"&&n)for(let o in n)Hm(t,o,n[o].default);else e==="array"&&Array.isArray(r)&&r.forEach((o,a)=>Hm(t,a,o.default))}Va.assignDefaults=II;function Hm(t,e,n){let{gen:r,compositeRule:o,data:a,opts:s}=t;if(n===void 0)return;let i=(0,dr._)`${a}${(0,dr.getProperty)(e)}`;if(o){(0,vI.checkStrictMode)(t,`default is ignored for: ${i}`);return}let l=(0,dr._)`${i} === undefined`;s.useDefaults==="empty"&&(l=(0,dr._)`${l} || ${i} === null || ${i} === ""`),r.if(l,(0,dr._)`${i} = ${(0,dr.stringify)(n)}`)}});var nt=N(oe=>{"use strict";u();Object.defineProperty(oe,"__esModule",{value:!0});oe.validateUnion=oe.validateArray=oe.usePattern=oe.callValidateCode=oe.schemaProperties=oe.allSchemaProperties=oe.noPropertyInData=oe.propertyInData=oe.isOwnProperty=oe.hasPropFunc=oe.reportMissingProp=oe.checkMissingProp=oe.checkReportMissingProp=void 0;var de=q(),Vl=Q(),Vt=Ct(),AI=Q();function SI(t,e){let{gen:n,data:r,it:o}=t;n.if(Hl(n,r,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,de._)`${e}`},!0),t.error()})}oe.checkReportMissingProp=SI;function OI({gen:t,data:e,it:{opts:n}},r,o){return(0,de.or)(...r.map(a=>(0,de.and)(Hl(t,e,a,n.ownProperties),(0,de._)`${o} = ${a}`)))}oe.checkMissingProp=OI;function NI(t,e){t.setParams({missingProperty:e},!0),t.error()}oe.reportMissingProp=NI;function Km(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,de._)`Object.prototype.hasOwnProperty`})}oe.hasPropFunc=Km;function Wl(t,e,n){return(0,de._)`${Km(t)}.call(${e}, ${n})`}oe.isOwnProperty=Wl;function PI(t,e,n,r){let o=(0,de._)`${e}${(0,de.getProperty)(n)} !== undefined`;return r?(0,de._)`${o} && ${Wl(t,e,n)}`:o}oe.propertyInData=PI;function Hl(t,e,n,r){let o=(0,de._)`${e}${(0,de.getProperty)(n)} === undefined`;return r?(0,de.or)(o,(0,de.not)(Wl(t,e,n))):o}oe.noPropertyInData=Hl;function Jm(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}oe.allSchemaProperties=Jm;function CI(t,e){return Jm(e).filter(n=>!(0,Vl.alwaysValidSchema)(t,e[n]))}oe.schemaProperties=CI;function DI({schemaCode:t,data:e,it:{gen:n,topSchemaRef:r,schemaPath:o,errorPath:a},it:s},i,l,d){let h=d?(0,de._)`${t}, ${e}, ${r}${o}`:e,p=[[Vt.default.instancePath,(0,de.strConcat)(Vt.default.instancePath,a)],[Vt.default.parentData,s.parentData],[Vt.default.parentDataProperty,s.parentDataProperty],[Vt.default.rootData,Vt.default.rootData]];s.opts.dynamicRef&&p.push([Vt.default.dynamicAnchors,Vt.default.dynamicAnchors]);let g=(0,de._)`${h}, ${n.object(...p)}`;return l!==de.nil?(0,de._)`${i}.call(${l}, ${g})`:(0,de._)`${i}(${g})`}oe.callValidateCode=DI;var RI=(0,de._)`new RegExp`;function xI({gen:t,it:{opts:e}},n){let r=e.unicodeRegExp?"u":"",{regExp:o}=e.code,a=o(n,r);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:(0,de._)`${o.code==="new RegExp"?RI:(0,AI.useFunc)(t,o)}(${n}, ${r})`})}oe.usePattern=xI;function kI(t){let{gen:e,data:n,keyword:r,it:o}=t,a=e.name("valid");if(o.allErrors){let i=e.let("valid",!0);return s(()=>e.assign(i,!1)),i}return e.var(a,!0),s(()=>e.break()),a;function s(i){let l=e.const("len",(0,de._)`${n}.length`);e.forRange("i",0,l,d=>{t.subschema({keyword:r,dataProp:d,dataPropType:Vl.Type.Num},a),e.if((0,de.not)(a),i)})}}oe.validateArray=kI;function LI(t){let{gen:e,schema:n,keyword:r,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(l=>(0,Vl.alwaysValidSchema)(o,l))&&!o.opts.unevaluated)return;let s=e.let("valid",!1),i=e.name("_valid");e.block(()=>n.forEach((l,d)=>{let h=t.subschema({keyword:r,schemaProp:d,compositeRule:!0},i);e.assign(s,(0,de._)`${s} || ${i}`),t.mergeValidEvaluated(h,i)||e.if((0,de.not)(s))})),t.result(s,()=>t.reset(),()=>t.error(!0))}oe.validateUnion=LI});var ef=N(yt=>{"use strict";u();Object.defineProperty(yt,"__esModule",{value:!0});yt.validateKeywordUsage=yt.validSchemaType=yt.funcKeywordCode=yt.macroKeywordCode=void 0;var Me=q(),Pn=Ct(),$I=nt(),MI=co();function zI(t,e){let{gen:n,keyword:r,schema:o,parentSchema:a,it:s}=t,i=e.macro.call(s.self,o,a,s),l=Qm(n,r,i);s.opts.validateSchema!==!1&&s.self.validateSchema(i,!0);let d=n.name("valid");t.subschema({schema:i,schemaPath:Me.nil,errSchemaPath:`${s.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},d),t.pass(d,()=>t.error(!0))}yt.macroKeywordCode=zI;function UI(t,e){var n;let{gen:r,keyword:o,schema:a,parentSchema:s,$data:i,it:l}=t;jI(l,e);let d=!i&&e.compile?e.compile.call(l.self,a,s,l):e.validate,h=Qm(r,o,d),p=r.let("valid");t.block$data(p,g),t.ok((n=e.valid)!==null&&n!==void 0?n:p);function g(){if(e.errors===!1)y(),e.modifying&&Xm(t),T(()=>t.error());else{let w=e.async?f():m();e.modifying&&Xm(t),T(()=>FI(t,w))}}function f(){let w=r.let("ruleErrs",null);return r.try(()=>y((0,Me._)`await `),I=>r.assign(p,!1).if((0,Me._)`${I} instanceof ${l.ValidationError}`,()=>r.assign(w,(0,Me._)`${I}.errors`),()=>r.throw(I))),w}function m(){let w=(0,Me._)`${h}.errors`;return r.assign(w,null),y(Me.nil),w}function y(w=e.async?(0,Me._)`await `:Me.nil){let I=l.opts.passContext?Pn.default.this:Pn.default.self,S=!("compile"in e&&!i||e.schema===!1);r.assign(p,(0,Me._)`${w}${(0,$I.callValidateCode)(t,h,I,S)}`,e.modifying)}function T(w){var I;r.if((0,Me.not)((I=e.valid)!==null&&I!==void 0?I:p),w)}}yt.funcKeywordCode=UI;function Xm(t){let{gen:e,data:n,it:r}=t;e.if(r.parentData,()=>e.assign(n,(0,Me._)`${r.parentData}[${r.parentDataProperty}]`))}function FI(t,e){let{gen:n}=t;n.if((0,Me._)`Array.isArray(${e})`,()=>{n.assign(Pn.default.vErrors,(0,Me._)`${Pn.default.vErrors} === null ? ${e} : ${Pn.default.vErrors}.concat(${e})`).assign(Pn.default.errors,(0,Me._)`${Pn.default.vErrors}.length`),(0,MI.extendErrors)(t)},()=>t.error())}function jI({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Qm(t,e,n){if(n===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:(0,Me.stringify)(n)})}function GI(t,e,n=!1){return!e.length||e.some(r=>r==="array"?Array.isArray(t):r==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==r||n&&typeof t>"u")}yt.validSchemaType=GI;function ZI({schema:t,opts:e,self:n,errSchemaPath:r},o,a){if(Array.isArray(o.keyword)?!o.keyword.includes(a):o.keyword!==a)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(i=>!Object.prototype.hasOwnProperty.call(t,i)))throw new Error(`parent schema must have dependencies of ${a}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[a])){let l=`keyword "${a}" value is invalid at path "${r}": `+n.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")n.logger.error(l);else throw new Error(l)}}yt.validateKeywordUsage=ZI});var nf=N(Wt=>{"use strict";u();Object.defineProperty(Wt,"__esModule",{value:!0});Wt.extendSubschemaMode=Wt.extendSubschemaData=Wt.getSubschema=void 0;var Et=q(),tf=Q();function BI(t,{keyword:e,schemaProp:n,schema:r,schemaPath:o,errSchemaPath:a,topSchemaRef:s}){if(e!==void 0&&r!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let i=t.schema[e];return n===void 0?{schema:i,schemaPath:(0,Et._)`${t.schemaPath}${(0,Et.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:i[n],schemaPath:(0,Et._)`${t.schemaPath}${(0,Et.getProperty)(e)}${(0,Et.getProperty)(n)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,tf.escapeFragment)(n)}`}}if(r!==void 0){if(o===void 0||a===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:o,topSchemaRef:s,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')}Wt.getSubschema=BI;function qI(t,e,{dataProp:n,dataPropType:r,data:o,dataTypes:a,propertyName:s}){if(o!==void 0&&n!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:i}=e;if(n!==void 0){let{errorPath:d,dataPathArr:h,opts:p}=e,g=i.let("data",(0,Et._)`${e.data}${(0,Et.getProperty)(n)}`,!0);l(g),t.errorPath=(0,Et.str)`${d}${(0,tf.getErrorPath)(n,r,p.jsPropertySyntax)}`,t.parentDataProperty=(0,Et._)`${n}`,t.dataPathArr=[...h,t.parentDataProperty]}if(o!==void 0){let d=o instanceof Et.Name?o:i.let("data",o,!0);l(d),s!==void 0&&(t.propertyName=s)}a&&(t.dataTypes=a);function l(d){t.data=d,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,d]}}Wt.extendSubschemaData=qI;function VI(t,{jtdDiscriminator:e,jtdMetadata:n,compositeRule:r,createErrors:o,allErrors:a}){r!==void 0&&(t.compositeRule=r),o!==void 0&&(t.createErrors=o),a!==void 0&&(t.allErrors=a),t.jtdDiscriminator=e,t.jtdMetadata=n}Wt.extendSubschemaMode=VI});var Yl=N((g$,rf)=>{"use strict";u();rf.exports=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,o,a;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!t(e[o],n[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(a=Object.keys(e),r=a.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=r;o--!==0;){var s=a[o];if(!t(e[s],n[s]))return!1}return!0}return e!==e&&n!==n}});var af=N((E$,of)=>{"use strict";u();var Ht=of.exports=function(t,e,n){typeof e=="function"&&(n=e,e={}),n=e.cb||n;var r=typeof n=="function"?n:n.pre||function(){},o=n.post||function(){};Wa(e,r,o,t,"",t)};Ht.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ht.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ht.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ht.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Wa(t,e,n,r,o,a,s,i,l,d){if(r&&typeof r=="object"&&!Array.isArray(r)){e(r,o,a,s,i,l,d);for(var h in r){var p=r[h];if(Array.isArray(p)){if(h in Ht.arrayKeywords)for(var g=0;g<p.length;g++)Wa(t,e,n,p[g],o+"/"+h+"/"+g,a,o,h,r,g)}else if(h in Ht.propsKeywords){if(p&&typeof p=="object")for(var f in p)Wa(t,e,n,p[f],o+"/"+h+"/"+WI(f),a,o,h,r,f)}else(h in Ht.keywords||t.allKeys&&!(h in Ht.skipKeywords))&&Wa(t,e,n,p,o+"/"+h,a,o,h,r)}n(r,o,a,s,i,l,d)}}function WI(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var uo=N(Be=>{"use strict";u();Object.defineProperty(Be,"__esModule",{value:!0});Be.getSchemaRefs=Be.resolveUrl=Be.normalizeId=Be._getFullPath=Be.getFullPath=Be.inlineRef=void 0;var HI=Q(),YI=Yl(),KI=af(),JI=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function XI(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Kl(t):e?sf(t)<=e:!1}Be.inlineRef=XI;var QI=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Kl(t){for(let e in t){if(QI.has(e))return!0;let n=t[e];if(Array.isArray(n)&&n.some(Kl)||typeof n=="object"&&Kl(n))return!0}return!1}function sf(t){let e=0;for(let n in t){if(n==="$ref")return 1/0;if(e++,!JI.has(n)&&(typeof t[n]=="object"&&(0,HI.eachItem)(t[n],r=>e+=sf(r)),e===1/0))return 1/0}return e}function cf(t,e="",n){n!==!1&&(e=ur(e));let r=t.parse(e);return lf(t,r)}Be.getFullPath=cf;function lf(t,e){return t.serialize(e).split("#")[0]+"#"}Be._getFullPath=lf;var eA=/#\/?$/;function ur(t){return t?t.replace(eA,""):""}Be.normalizeId=ur;function tA(t,e,n){return n=ur(n),t.resolve(e,n)}Be.resolveUrl=tA;var nA=/^[a-z_][-a-z0-9._]*$/i;function rA(t,e){if(typeof t=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,o=ur(t[n]||e),a={"":o},s=cf(r,o,!1),i={},l=new Set;return KI(t,{allKeys:!0},(p,g,f,m)=>{if(m===void 0)return;let y=s+g,T=a[m];typeof p[n]=="string"&&(T=w.call(this,p[n])),I.call(this,p.$anchor),I.call(this,p.$dynamicAnchor),a[g]=T;function w(S){let D=this.opts.uriResolver.resolve;if(S=ur(T?D(T,S):S),l.has(S))throw h(S);l.add(S);let M=this.refs[S];return typeof M=="string"&&(M=this.refs[M]),typeof M=="object"?d(p,M.schema,S):S!==ur(y)&&(S[0]==="#"?(d(p,i[S],S),i[S]=p):this.refs[S]=y),S}function I(S){if(typeof S=="string"){if(!nA.test(S))throw new Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),i;function d(p,g,f){if(g!==void 0&&!YI(p,g))throw h(f)}function h(p){return new Error(`reference "${p}" resolves to more than one schema`)}}Be.getSchemaRefs=rA});var mo=N(Yt=>{"use strict";u();Object.defineProperty(Yt,"__esModule",{value:!0});Yt.getData=Yt.KeywordCxt=Yt.validateFunctionCode=void 0;var mf=Gm(),df=lo(),Xl=Gl(),Ha=lo(),oA=Ym(),po=ef(),Jl=nf(),L=q(),j=Ct(),aA=uo(),Dt=Q(),ho=co();function sA(t){if(gf(t)&&(yf(t),_f(t))){lA(t);return}ff(t,()=>(0,mf.topBoolOrEmptySchema)(t))}Yt.validateFunctionCode=sA;function ff({gen:t,validateName:e,schema:n,schemaEnv:r,opts:o},a){o.code.es5?t.func(e,(0,L._)`${j.default.data}, ${j.default.valCxt}`,r.$async,()=>{t.code((0,L._)`"use strict"; ${uf(n,o)}`),cA(t,o),t.code(a)}):t.func(e,(0,L._)`${j.default.data}, ${iA(o)}`,r.$async,()=>t.code(uf(n,o)).code(a))}function iA(t){return(0,L._)`{${j.default.instancePath}="", ${j.default.parentData}, ${j.default.parentDataProperty}, ${j.default.rootData}=${j.default.data}${t.dynamicRef?(0,L._)`, ${j.default.dynamicAnchors}={}`:L.nil}}={}`}function cA(t,e){t.if(j.default.valCxt,()=>{t.var(j.default.instancePath,(0,L._)`${j.default.valCxt}.${j.default.instancePath}`),t.var(j.default.parentData,(0,L._)`${j.default.valCxt}.${j.default.parentData}`),t.var(j.default.parentDataProperty,(0,L._)`${j.default.valCxt}.${j.default.parentDataProperty}`),t.var(j.default.rootData,(0,L._)`${j.default.valCxt}.${j.default.rootData}`),e.dynamicRef&&t.var(j.default.dynamicAnchors,(0,L._)`${j.default.valCxt}.${j.default.dynamicAnchors}`)},()=>{t.var(j.default.instancePath,(0,L._)`""`),t.var(j.default.parentData,(0,L._)`undefined`),t.var(j.default.parentDataProperty,(0,L._)`undefined`),t.var(j.default.rootData,j.default.data),e.dynamicRef&&t.var(j.default.dynamicAnchors,(0,L._)`{}`)})}function lA(t){let{schema:e,opts:n,gen:r}=t;ff(t,()=>{n.$comment&&e.$comment&&Tf(t),mA(t),r.let(j.default.vErrors,null),r.let(j.default.errors,0),n.unevaluated&&dA(t),Ef(t),gA(t)})}function dA(t){let{gen:e,validateName:n}=t;t.evaluated=e.const("evaluated",(0,L._)`${n}.evaluated`),e.if((0,L._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,L._)`${t.evaluated}.props`,(0,L._)`undefined`)),e.if((0,L._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,L._)`${t.evaluated}.items`,(0,L._)`undefined`))}function uf(t,e){let n=typeof t=="object"&&t[e.schemaId];return n&&(e.code.source||e.code.process)?(0,L._)`/*# sourceURL=${n} */`:L.nil}function uA(t,e){if(gf(t)&&(yf(t),_f(t))){hA(t,e);return}(0,mf.boolOrEmptySchema)(t,e)}function _f({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let n in t)if(e.RULES.all[n])return!0;return!1}function gf(t){return typeof t.schema!="boolean"}function hA(t,e){let{schema:n,gen:r,opts:o}=t;o.$comment&&n.$comment&&Tf(t),fA(t),_A(t);let a=r.const("_errs",j.default.errors);Ef(t,a),r.var(e,(0,L._)`${a} === ${j.default.errors}`)}function yf(t){(0,Dt.checkUnknownRules)(t),pA(t)}function Ef(t,e){if(t.opts.jtd)return hf(t,[],!1,e);let n=(0,df.getSchemaTypes)(t.schema),r=(0,df.coerceAndCheckDataType)(t,n);hf(t,n,!r,e)}function pA(t){let{schema:e,errSchemaPath:n,opts:r,self:o}=t;e.$ref&&r.ignoreKeywordsWithRef&&(0,Dt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function mA(t){let{schema:e,opts:n}=t;e.default!==void 0&&n.useDefaults&&n.strictSchema&&(0,Dt.checkStrictMode)(t,"default is ignored in the schema root")}function fA(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,aA.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function _A(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Tf({gen:t,schemaEnv:e,schema:n,errSchemaPath:r,opts:o}){let a=n.$comment;if(o.$comment===!0)t.code((0,L._)`${j.default.self}.logger.log(${a})`);else if(typeof o.$comment=="function"){let s=(0,L.str)`${r}/$comment`,i=t.scopeValue("root",{ref:e.root});t.code((0,L._)`${j.default.self}.opts.$comment(${a}, ${s}, ${i}.schema)`)}}function gA(t){let{gen:e,schemaEnv:n,validateName:r,ValidationError:o,opts:a}=t;n.$async?e.if((0,L._)`${j.default.errors} === 0`,()=>e.return(j.default.data),()=>e.throw((0,L._)`new ${o}(${j.default.vErrors})`)):(e.assign((0,L._)`${r}.errors`,j.default.vErrors),a.unevaluated&&yA(t),e.return((0,L._)`${j.default.errors} === 0`))}function yA({gen:t,evaluated:e,props:n,items:r}){n instanceof L.Name&&t.assign((0,L._)`${e}.props`,n),r instanceof L.Name&&t.assign((0,L._)`${e}.items`,r)}function hf(t,e,n,r){let{gen:o,schema:a,data:s,allErrors:i,opts:l,self:d}=t,{RULES:h}=d;if(a.$ref&&(l.ignoreKeywordsWithRef||!(0,Dt.schemaHasRulesButRef)(a,h))){o.block(()=>wf(t,"$ref",h.all.$ref.definition));return}l.jtd||EA(t,e),o.block(()=>{for(let g of h.rules)p(g);p(h.post)});function p(g){(0,Xl.shouldUseGroup)(a,g)&&(g.type?(o.if((0,Ha.checkDataType)(g.type,s,l.strictNumbers)),pf(t,g),e.length===1&&e[0]===g.type&&n&&(o.else(),(0,Ha.reportTypeError)(t)),o.endIf()):pf(t,g),i||o.if((0,L._)`${j.default.errors} === ${r||0}`))}}function pf(t,e){let{gen:n,schema:r,opts:{useDefaults:o}}=t;o&&(0,oA.assignDefaults)(t,e.type),n.block(()=>{for(let a of e.rules)(0,Xl.shouldUseRule)(r,a)&&wf(t,a.keyword,a.definition,e.type)})}function EA(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(TA(t,e),t.opts.allowUnionTypes||bA(t,e),wA(t,t.dataTypes))}function TA(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(n=>{bf(t.dataTypes,n)||Ql(t,`type "${n}" not allowed by context "${t.dataTypes.join(",")}"`)}),IA(t,e)}}function bA(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ql(t,"use allowUnionTypes to allow union type keyword")}function wA(t,e){let n=t.self.RULES.all;for(let r in n){let o=n[r];if(typeof o=="object"&&(0,Xl.shouldUseRule)(t.schema,o)){let{type:a}=o.definition;a.length&&!a.some(s=>vA(e,s))&&Ql(t,`missing type "${a.join(",")}" for keyword "${r}"`)}}}function vA(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function bf(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function IA(t,e){let n=[];for(let r of t.dataTypes)bf(e,r)?n.push(r):e.includes("integer")&&r==="number"&&n.push("integer");t.dataTypes=n}function Ql(t,e){let n=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${n}" (strictTypes)`,(0,Dt.checkStrictMode)(t,e,t.opts.strictTypes)}var Ya=class{constructor(e,n,r){if((0,po.validateKeywordUsage)(e,n,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=n.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Dt.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=n.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=n,this.$data)this.schemaCode=e.gen.const("vSchema",vf(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,po.validSchemaType)(this.schema,n.schemaType,n.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(n.schemaType)}`);("code"in n?n.trackErrors:n.errors!==!1)&&(this.errsCount=e.gen.const("_errs",j.default.errors))}result(e,n,r){this.failResult((0,L.not)(e),n,r)}failResult(e,n,r){this.gen.if(e),r?r():this.error(),n?(this.gen.else(),n(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,n){this.failResult((0,L.not)(e),void 0,n)}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:n}=this;this.fail((0,L._)`${n} !== undefined && (${(0,L.or)(this.invalid$data(),e)})`)}error(e,n,r){if(n){this.setParams(n),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,n){(e?ho.reportExtraError:ho.reportError)(this,this.def.error,n)}$dataError(){(0,ho.reportError)(this,this.def.$dataError||ho.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ho.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,n){n?Object.assign(this.params,e):this.params=e}block$data(e,n,r=L.nil){this.gen.block(()=>{this.check$data(e,r),n()})}check$data(e=L.nil,n=L.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:a,def:s}=this;r.if((0,L.or)((0,L._)`${o} === undefined`,n)),e!==L.nil&&r.assign(e,!0),(a.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==L.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:n,schemaType:r,def:o,it:a}=this;return(0,L.or)(s(),i());function s(){if(r.length){if(!(n instanceof L.Name))throw new Error("ajv implementation error");let l=Array.isArray(r)?r:[r];return(0,L._)`${(0,Ha.checkDataTypes)(l,n,a.opts.strictNumbers,Ha.DataType.Wrong)}`}return L.nil}function i(){if(o.validateSchema){let l=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,L._)`!${l}(${n})`}return L.nil}}subschema(e,n){let r=(0,Jl.getSubschema)(this.it,e);(0,Jl.extendSubschemaData)(r,this.it,e),(0,Jl.extendSubschemaMode)(r,e);let o={...this.it,...r,items:void 0,props:void 0};return uA(o,n),o}mergeEvaluated(e,n){let{it:r,gen:o}=this;r.opts.unevaluated&&(r.props!==!0&&e.props!==void 0&&(r.props=Dt.mergeEvaluated.props(o,e.props,r.props,n)),r.items!==!0&&e.items!==void 0&&(r.items=Dt.mergeEvaluated.items(o,e.items,r.items,n)))}mergeValidEvaluated(e,n){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(n,()=>this.mergeEvaluated(e,L.Name)),!0}};Yt.KeywordCxt=Ya;function wf(t,e,n,r){let o=new Ya(t,n,e);"code"in n?n.code(o,r):o.$data&&n.validate?(0,po.funcKeywordCode)(o,n):"macro"in n?(0,po.macroKeywordCode)(o,n):(n.compile||n.validate)&&(0,po.funcKeywordCode)(o,n)}var AA=/^\/(?:[^~]|~0|~1)*$/,SA=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function vf(t,{dataLevel:e,dataNames:n,dataPathArr:r}){let o,a;if(t==="")return j.default.rootData;if(t[0]==="/"){if(!AA.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,a=j.default.rootData}else{let d=SA.exec(t);if(!d)throw new Error(`Invalid JSON-pointer: ${t}`);let h=+d[1];if(o=d[2],o==="#"){if(h>=e)throw new Error(l("property/index",h));return r[e-h]}if(h>e)throw new Error(l("data",h));if(a=n[e-h],!o)return a}let s=a,i=o.split("/");for(let d of i)d&&(a=(0,L._)`${a}${(0,L.getProperty)((0,Dt.unescapeJsonPointer)(d))}`,s=(0,L._)`${s} && ${a}`);return s;function l(d,h){return`Cannot access ${d} ${h} levels up, current level is ${e}`}}Yt.getData=vf});var Ka=N(td=>{"use strict";u();Object.defineProperty(td,"__esModule",{value:!0});var ed=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};td.default=ed});var fo=N(od=>{"use strict";u();Object.defineProperty(od,"__esModule",{value:!0});var nd=uo(),rd=class extends Error{constructor(e,n,r,o){super(o||`can't resolve reference ${r} from id ${n}`),this.missingRef=(0,nd.resolveUrl)(e,n,r),this.missingSchema=(0,nd.normalizeId)((0,nd.getFullPath)(e,this.missingRef))}};od.default=rd});var Xa=N(rt=>{"use strict";u();Object.defineProperty(rt,"__esModule",{value:!0});rt.resolveSchema=rt.getCompilingSchema=rt.resolveRef=rt.compileSchema=rt.SchemaEnv=void 0;var dt=q(),OA=Ka(),Cn=Ct(),ut=uo(),If=Q(),NA=mo(),hr=class{constructor(e){var n;this.refs={},this.dynamicAnchors={};let r;typeof e.schema=="object"&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(n=e.baseId)!==null&&n!==void 0?n:(0,ut.normalizeId)(r?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r?.$async,this.refs={}}};rt.SchemaEnv=hr;function sd(t){let e=Af.call(this,t);if(e)return e;let n=(0,ut.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:r,lines:o}=this.opts.code,{ownProperties:a}=this.opts,s=new dt.CodeGen(this.scope,{es5:r,lines:o,ownProperties:a}),i;t.$async&&(i=s.scopeValue("Error",{ref:OA.default,code:(0,dt._)`require("ajv/dist/runtime/validation_error").default`}));let l=s.scopeName("validate");t.validateName=l;let d={gen:s,allErrors:this.opts.allErrors,data:Cn.default.data,parentData:Cn.default.parentData,parentDataProperty:Cn.default.parentDataProperty,dataNames:[Cn.default.data],dataPathArr:[dt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,dt.stringify)(t.schema)}:{ref:t.schema}),validateName:l,ValidationError:i,schema:t.schema,schemaEnv:t,rootId:n,baseId:t.baseId||n,schemaPath:dt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,dt._)`""`,opts:this.opts,self:this},h;try{this._compilations.add(t),(0,NA.validateFunctionCode)(d),s.optimize(this.opts.code.optimize);let p=s.toString();h=`${s.scopeRefs(Cn.default.scope)}return ${p}`,this.opts.code.process&&(h=this.opts.code.process(h,t));let f=new Function(`${Cn.default.self}`,`${Cn.default.scope}`,h)(this,this.scope.get());if(this.scope.value(l,{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:l,validateCode:p,scopeValues:s._values}),this.opts.unevaluated){let{props:m,items:y}=d;f.evaluated={props:m instanceof dt.Name?void 0:m,items:y instanceof dt.Name?void 0:y,dynamicProps:m instanceof dt.Name,dynamicItems:y instanceof dt.Name},f.source&&(f.source.evaluated=(0,dt.stringify)(f.evaluated))}return t.validate=f,t}catch(p){throw delete t.validate,delete t.validateName,h&&this.logger.error("Error compiling schema, function code:",h),p}finally{this._compilations.delete(t)}}rt.compileSchema=sd;function PA(t,e,n){var r;n=(0,ut.resolveUrl)(this.opts.uriResolver,e,n);let o=t.refs[n];if(o)return o;let a=RA.call(this,t,n);if(a===void 0){let s=(r=t.localRefs)===null||r===void 0?void 0:r[n],{schemaId:i}=this.opts;s&&(a=new hr({schema:s,schemaId:i,root:t,baseId:e}))}if(a!==void 0)return t.refs[n]=CA.call(this,a)}rt.resolveRef=PA;function CA(t){return(0,ut.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:sd.call(this,t)}function Af(t){for(let e of this._compilations)if(DA(e,t))return e}rt.getCompilingSchema=Af;function DA(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function RA(t,e){let n;for(;typeof(n=this.refs[e])=="string";)e=n;return n||this.schemas[e]||Ja.call(this,t,e)}function Ja(t,e){let n=this.opts.uriResolver.parse(e),r=(0,ut._getFullPath)(this.opts.uriResolver,n),o=(0,ut.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&r===o)return ad.call(this,n,t);let a=(0,ut.normalizeId)(r),s=this.refs[a]||this.schemas[a];if(typeof s=="string"){let i=Ja.call(this,t,s);return typeof i?.schema!="object"?void 0:ad.call(this,n,i)}if(typeof s?.schema=="object"){if(s.validate||sd.call(this,s),a===(0,ut.normalizeId)(e)){let{schema:i}=s,{schemaId:l}=this.opts,d=i[l];return d&&(o=(0,ut.resolveUrl)(this.opts.uriResolver,o,d)),new hr({schema:i,schemaId:l,root:t,baseId:o})}return ad.call(this,n,s)}}rt.resolveSchema=Ja;var xA=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ad(t,{baseId:e,schema:n,root:r}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let i of t.fragment.slice(1).split("/")){if(typeof n=="boolean")return;let l=n[(0,If.unescapeFragment)(i)];if(l===void 0)return;n=l;let d=typeof n=="object"&&n[this.opts.schemaId];!xA.has(i)&&d&&(e=(0,ut.resolveUrl)(this.opts.uriResolver,e,d))}let a;if(typeof n!="boolean"&&n.$ref&&!(0,If.schemaHasRulesButRef)(n,this.RULES)){let i=(0,ut.resolveUrl)(this.opts.uriResolver,e,n.$ref);a=Ja.call(this,r,i)}let{schemaId:s}=this.opts;if(a=a||new hr({schema:n,schemaId:s,root:r,baseId:e}),a.schema!==a.root.schema)return a}});var Sf=N((D$,kA)=>{kA.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 ld=N((R$,Rf)=>{"use strict";u();var LA=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Nf=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),id=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Pf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),$A=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function cd(t){let e="",n=0,r=0;for(r=0;r<t.length;r++)if(n=t[r].charCodeAt(0),n!==48){if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";e+=t[r];break}for(r+=1;r<t.length;r++){if(n=t[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";e+=t[r]}return e}var MA=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Of(t){return t.length=0,!0}function zA(t,e,n){if(t.length){let r=cd(t);if(r!=="")e.push(r);else return n.error=!0,!1;t.length=0}return!0}function UA(t){let e=0,n={error:!1,address:"",zone:""},r=[],o=[],a=!1,s=!1,i=zA;for(let l=0;l<t.length;l++){let d=t[l];if(!(d==="["||d==="]"))if(d===":"){if(a===!0&&(s=!0),!i(o,r,n))break;if(++e>7){n.error=!0;break}l>0&&t[l-1]===":"&&(a=!0),r.push(":");continue}else if(d==="%"){if(!i(o,r,n))break;i=Of}else{o.push(d);continue}}return o.length&&(i===Of?n.zone=o.join(""):s?r.push(o.join("")):r.push(cd(o))),n.address=r.join(""),n}function Cf(t){if(FA(t,":")<2)return{host:t,isIPV6:!1};let e=UA(t);if(e.error)return{host:t,isIPV6:!1};{let n=e.address,r=e.address;return e.zone&&(n+="%"+e.zone,r+="%25"+e.zone),{host:n,isIPV6:!0,escapedHost:r}}}function FA(t,e){let n=0;for(let r=0;r<t.length;r++)t[r]===e&&n++;return n}function jA(t){let e=t,n=[],r=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){n.push("/");break}else{n.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){n.push("/");break}}else if(o===3&&e==="/.."){n.length!==0&&n.pop(),n.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),n.length!==0&&n.pop();continue}}if((r=e.indexOf("/",1))===-1){n.push(e);break}else n.push(e.slice(0,r)),e=e.slice(r)}return n.join("")}var GA={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ZA=/[@/?#:]/g,BA=/[@/?#]/g;function Df(t,e){let n=e?BA:ZA;return n.lastIndex=0,t.replace(n,r=>GA[r])}function qA(t,e=!1){if(t.indexOf("%")===-1)return t;let n="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(id(o)){let a=o.toUpperCase(),s=String.fromCharCode(parseInt(a,16));e&&Pf(s)?n+=s:n+="%"+a,r+=2;continue}}n+=t[r]}return n}function VA(t){let e="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let r=t.slice(n+1,n+3);if(id(r)){let o=r.toUpperCase(),a=String.fromCharCode(parseInt(o,16));a!=="."&&Pf(a)?e+=a:e+="%"+o,n+=2;continue}}$A(t[n])?e+=t[n]:e+=escape(t[n])}return e}function WA(t){let e="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let r=t.slice(n+1,n+3);if(id(r)){e+="%"+r.toUpperCase(),n+=2;continue}}e+=escape(t[n])}return e}function HA(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let n=unescape(t.host);if(!Nf(n)){let r=Cf(n);r.isIPV6===!0?n=`[${r.escapedHost}]`:n=Df(n,!1)}e.push(n)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Rf.exports={nonSimpleDomain:MA,recomposeAuthority:HA,reescapeHostDelimiters:Df,normalizePercentEncoding:qA,normalizePathEncoding:VA,escapePreservingEscapes:WA,removeDotSegments:jA,isIPv4:Nf,isUUID:LA,normalizeIPv6:Cf,stringArrayToHexStripped:cd}});var Mf=N((k$,$f)=>{"use strict";u();var{isUUID:YA}=ld(),KA=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,JA=["http","https","ws","wss","urn","urn:uuid"];function XA(t){return JA.indexOf(t)!==-1}function dd(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 xf(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function kf(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 QA(t){return t.secure=dd(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function eS(t){if((t.port===(dd(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,n]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=n,t.resourceName=void 0}return t.fragment=void 0,t}function tS(t,e){if(!t.path)return t.error="URN can not be parsed",t;let n=t.path.match(KA);if(n){let r=e.scheme||t.scheme||"urn";t.nid=n[1].toLowerCase(),t.nss=n[2];let o=`${r}:${e.nid||t.nid}`,a=ud(o);t.path=void 0,a&&(t=a.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function nS(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let n=e.scheme||t.scheme||"urn",r=t.nid.toLowerCase(),o=`${n}:${e.nid||r}`,a=ud(o);a&&(t=a.serialize(t,e));let s=t,i=t.nss;return s.path=`${r||e.nid}:${i}`,e.skipEscape=!0,s}function rS(t,e){let n=t;return n.uuid=n.nss,n.nss=void 0,!e.tolerant&&(!n.uuid||!YA(n.uuid))&&(n.error=n.error||"UUID is not valid."),n}function oS(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Lf={scheme:"http",domainHost:!0,parse:xf,serialize:kf},aS={scheme:"https",domainHost:Lf.domainHost,parse:xf,serialize:kf},Qa={scheme:"ws",domainHost:!0,parse:QA,serialize:eS},sS={scheme:"wss",domainHost:Qa.domainHost,parse:Qa.parse,serialize:Qa.serialize},iS={scheme:"urn",parse:tS,serialize:nS,skipNormalize:!0},cS={scheme:"urn:uuid",parse:rS,serialize:oS,skipNormalize:!0},es={http:Lf,https:aS,ws:Qa,wss:sS,urn:iS,"urn:uuid":cS};Object.setPrototypeOf(es,null);function ud(t){return t&&(es[t]||es[t.toLowerCase()])||void 0}$f.exports={wsIsSecure:dd,SCHEMES:es,isValidSchemeName:XA,getSchemeHandler:ud}});var Zf=N(($$,ts)=>{"use strict";u();var{normalizeIPv6:lS,removeDotSegments:_o,recomposeAuthority:dS,normalizePercentEncoding:uS,normalizePathEncoding:hS,escapePreservingEscapes:pS,reescapeHostDelimiters:mS,isIPv4:fS,nonSimpleDomain:_S}=ld(),{SCHEMES:gS,getSchemeHandler:Uf}=Mf();function yS(t,e){return typeof t=="string"?t=vS(t,e):typeof t=="object"&&(t=pr(Dn(t,e),e)),t}function ES(t,e,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},o=Ff(pr(t,r),pr(e,r),r,!0);return r.skipEscape=!0,Dn(o,r)}function Ff(t,e,n,r){let o={};return r||(t=pr(Dn(t,n),n),e=pr(Dn(e,n),n)),n=n||{},!n.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=_o(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=_o(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=_o(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=_o(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function TS(t,e,n){let r=zf(t,n),o=zf(e,n);return r!==void 0&&o!==void 0&&r.toLowerCase()===o.toLowerCase()}function Dn(t,e){let n={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:""},r=Object.assign({},e),o=[],a=Uf(r.scheme||n.scheme);a&&a.serialize&&a.serialize(n,r),n.path!==void 0&&(r.skipEscape?n.path=uS(n.path):(n.path=pS(n.path),n.scheme!==void 0&&(n.path=n.path.split("%3A").join(":")))),r.reference!=="suffix"&&n.scheme&&o.push(n.scheme,":");let s=dS(n);if(s!==void 0&&(r.reference!=="suffix"&&o.push("//"),o.push(s),n.path&&n.path[0]!=="/"&&o.push("/")),n.path!==void 0){let i=n.path;!r.absolutePath&&(!a||!a.absolutePath)&&(i=_o(i)),s===void 0&&i[0]==="/"&&i[1]==="/"&&(i="/%2F"+i.slice(2)),o.push(i)}return n.query!==void 0&&o.push("?",n.query),n.fragment!==void 0&&o.push("#",n.fragment),o.join("")}var bS=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function wS(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 jf(t,e){let n=Object.assign({},e),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,a=!1;n.reference==="suffix"&&(n.scheme?t=n.scheme+":"+t:t="//"+t);let s=t.match(bS);if(s){r.scheme=s[1],r.userinfo=s[3],r.host=s[4],r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=s[7],r.fragment=s[8],isNaN(r.port)&&(r.port=s[5]);let i=wS(r,s);if(i!==void 0&&(r.error=r.error||i,o=!0),r.host)if(fS(r.host)===!1){let h=lS(r.host);r.host=h.host.toLowerCase(),a=h.isIPV6}else a=!0;r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path?r.reference="same-document":r.scheme===void 0?r.reference="relative":r.fragment===void 0?r.reference="absolute":r.reference="uri",n.reference&&n.reference!=="suffix"&&n.reference!==r.reference&&(r.error=r.error||"URI is not a "+n.reference+" reference.");let l=Uf(n.scheme||r.scheme);if(!n.unicodeSupport&&(!l||!l.unicodeSupport)&&r.host&&(n.domainHost||l&&l.domainHost)&&a===!1&&_S(r.host))try{r.host=URL.domainToASCII(r.host.toLowerCase())}catch(d){r.error=r.error||"Host's domain name can not be converted to ASCII: "+d}if((!l||l&&!l.skipNormalize)&&(t.indexOf("%")!==-1&&(r.scheme!==void 0&&(r.scheme=unescape(r.scheme)),r.host!==void 0&&(r.host=mS(unescape(r.host),a))),r.path&&(r.path=hS(r.path)),r.fragment))try{r.fragment=encodeURI(decodeURIComponent(r.fragment))}catch{r.error=r.error||"URI malformed"}l&&l.parse&&l.parse(r,n)}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:o}}function pr(t,e){return jf(t,e).parsed}function vS(t,e){return Gf(t,e).normalized}function Gf(t,e){let{parsed:n,malformedAuthorityOrPort:r}=jf(t,e);return{normalized:r?t:Dn(n,e),malformedAuthorityOrPort:r}}function zf(t,e){if(typeof t=="string"){let{normalized:n,malformedAuthorityOrPort:r}=Gf(t,e);return r?void 0:n}if(typeof t=="object")return Dn(t,e)}var hd={SCHEMES:gS,normalize:yS,resolve:ES,resolveComponent:Ff,equal:TS,serialize:Dn,parse:pr};ts.exports=hd;ts.exports.default=hd;ts.exports.fastUri=hd});var qf=N(pd=>{"use strict";u();Object.defineProperty(pd,"__esModule",{value:!0});var Bf=Zf();Bf.code='require("ajv/dist/runtime/uri").default';pd.default=Bf});var Qf=N(Oe=>{"use strict";u();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.CodeGen=Oe.Name=Oe.nil=Oe.stringify=Oe.str=Oe._=Oe.KeywordCxt=void 0;var IS=mo();Object.defineProperty(Oe,"KeywordCxt",{enumerable:!0,get:function(){return IS.KeywordCxt}});var mr=q();Object.defineProperty(Oe,"_",{enumerable:!0,get:function(){return mr._}});Object.defineProperty(Oe,"str",{enumerable:!0,get:function(){return mr.str}});Object.defineProperty(Oe,"stringify",{enumerable:!0,get:function(){return mr.stringify}});Object.defineProperty(Oe,"nil",{enumerable:!0,get:function(){return mr.nil}});Object.defineProperty(Oe,"Name",{enumerable:!0,get:function(){return mr.Name}});Object.defineProperty(Oe,"CodeGen",{enumerable:!0,get:function(){return mr.CodeGen}});var AS=Ka(),Kf=fo(),SS=jl(),go=Xa(),OS=q(),yo=uo(),ns=lo(),fd=Q(),Vf=Sf(),NS=qf(),Jf=(t,e)=>new RegExp(t,e);Jf.code="new RegExp";var PS=["removeAdditional","useDefaults","coerceTypes"],CS=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),DS={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."},RS={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Wf=200;function xS(t){var e,n,r,o,a,s,i,l,d,h,p,g,f,m,y,T,w,I,S,D,M,xe,Ye,Un,Rs;let Ir=t.strict,xs=(e=t.code)===null||e===void 0?void 0:e.optimize,vu=xs===!0||xs===void 0?1:xs||0,Iu=(r=(n=t.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:Jf,iy=(o=t.uriResolver)!==null&&o!==void 0?o:NS.default;return{strictSchema:(s=(a=t.strictSchema)!==null&&a!==void 0?a:Ir)!==null&&s!==void 0?s:!0,strictNumbers:(l=(i=t.strictNumbers)!==null&&i!==void 0?i:Ir)!==null&&l!==void 0?l:!0,strictTypes:(h=(d=t.strictTypes)!==null&&d!==void 0?d:Ir)!==null&&h!==void 0?h:"log",strictTuples:(g=(p=t.strictTuples)!==null&&p!==void 0?p:Ir)!==null&&g!==void 0?g:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:Ir)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:vu,regExp:Iu}:{optimize:vu,regExp:Iu},loopRequired:(y=t.loopRequired)!==null&&y!==void 0?y:Wf,loopEnum:(T=t.loopEnum)!==null&&T!==void 0?T:Wf,meta:(w=t.meta)!==null&&w!==void 0?w:!0,messages:(I=t.messages)!==null&&I!==void 0?I:!0,inlineRefs:(S=t.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(D=t.schemaId)!==null&&D!==void 0?D:"$id",addUsedSchema:(M=t.addUsedSchema)!==null&&M!==void 0?M:!0,validateSchema:(xe=t.validateSchema)!==null&&xe!==void 0?xe:!0,validateFormats:(Ye=t.validateFormats)!==null&&Ye!==void 0?Ye:!0,unicodeRegExp:(Un=t.unicodeRegExp)!==null&&Un!==void 0?Un:!0,int32range:(Rs=t.int32range)!==null&&Rs!==void 0?Rs:!0,uriResolver:iy}}var Eo=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,...xS(e)};let{es5:n,lines:r}=this.opts.code;this.scope=new OS.ValueScope({scope:{},prefixes:CS,es5:n,lines:r}),this.logger=US(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,SS.getRules)(),Hf.call(this,DS,e,"NOT SUPPORTED"),Hf.call(this,RS,e,"DEPRECATED","warn"),this._metaOpts=MS.call(this),e.formats&&LS.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&$S.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),kS.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:n,schemaId:r}=this.opts,o=Vf;r==="id"&&(o={...Vf},o.id=o.$id,delete o.$id),n&&e&&this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:n}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[n]||e:void 0}validate(e,n){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(n);return"$async"in r||(this.errors=r.errors),o}compile(e,n){let r=this._addSchema(e,n);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,n){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,n);async function o(h,p){await a.call(this,h.$schema);let g=this._addSchema(h,p);return g.validate||s.call(this,g)}async function a(h){h&&!this.getSchema(h)&&await o.call(this,{$ref:h},!0)}async function s(h){try{return this._compileSchemaEnv(h)}catch(p){if(!(p instanceof Kf.default))throw p;return i.call(this,p),await l.call(this,p.missingSchema),s.call(this,h)}}function i({missingSchema:h,missingRef:p}){if(this.refs[h])throw new Error(`AnySchema ${h} is loaded but ${p} cannot be resolved`)}async function l(h){let p=await d.call(this,h);this.refs[h]||await a.call(this,p.$schema),this.refs[h]||this.addSchema(p,h,n)}async function d(h){let p=this._loading[h];if(p)return p;try{return await(this._loading[h]=r(h))}finally{delete this._loading[h]}}}addSchema(e,n,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,o);return this}let a;if(typeof e=="object"){let{schemaId:s}=this.opts;if(a=e[s],a!==void 0&&typeof a!="string")throw new Error(`schema ${s} must be string`)}return n=(0,yo.normalizeId)(n||a),this._checkUnique(n),this.schemas[n]=this._addSchema(e,r,n,o,!0),this}addMetaSchema(e,n,r=this.opts.validateSchema){return this.addSchema(e,n,!0,r),this}validateSchema(e,n){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&n){let a="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(a);else throw new Error(a)}return o}getSchema(e){let n;for(;typeof(n=Yf.call(this,e))=="string";)e=n;if(n===void 0){let{schemaId:r}=this.opts,o=new go.SchemaEnv({schema:{},schemaId:r});if(n=go.resolveSchema.call(this,o,e),!n)return;this.refs[e]=n}return n.validate||this._compileSchemaEnv(n)}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 n=Yf.call(this,e);return typeof n=="object"&&this._cache.delete(n.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let n=e;this._cache.delete(n);let r=e[this.opts.schemaId];return r&&(r=(0,yo.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let n of e)this.addKeyword(n);return this}addKeyword(e,n){let r;if(typeof e=="string")r=e,typeof n=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),n.keyword=r);else if(typeof e=="object"&&n===void 0){if(n=e,r=n.keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(jS.call(this,r,n),!n)return(0,fd.eachItem)(r,a=>md.call(this,a)),this;ZS.call(this,n);let o={...n,type:(0,ns.getJSONTypes)(n.type),schemaType:(0,ns.getJSONTypes)(n.schemaType)};return(0,fd.eachItem)(r,o.type.length===0?a=>md.call(this,a,o):a=>o.type.forEach(s=>md.call(this,a,o,s))),this}getKeyword(e){let n=this.RULES.all[e];return typeof n=="object"?n.definition:!!n}removeKeyword(e){let{RULES:n}=this;delete n.keywords[e],delete n.all[e];for(let r of n.rules){let o=r.rules.findIndex(a=>a.keyword===e);o>=0&&r.rules.splice(o,1)}return this}addFormat(e,n){return typeof n=="string"&&(n=new RegExp(n)),this.formats[e]=n,this}errorsText(e=this.errors,{separator:n=", ",dataVar:r="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${r}${o.instancePath} ${o.message}`).reduce((o,a)=>o+n+a)}$dataMetaSchema(e,n){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of n){let a=o.split("/").slice(1),s=e;for(let i of a)s=s[i];for(let i in r){let l=r[i];if(typeof l!="object")continue;let{$data:d}=l.definition,h=s[i];d&&h&&(s[i]=Xf(h))}}return e}_removeAllSchemas(e,n){for(let r in e){let o=e[r];(!n||n.test(r))&&(typeof o=="string"?delete e[r]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[r]))}}_addSchema(e,n,r,o=this.opts.validateSchema,a=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];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 l=this._cache.get(e);if(l!==void 0)return l;r=(0,yo.normalizeId)(s||r);let d=yo.getSchemaRefs.call(this,e,r);return l=new go.SchemaEnv({schema:e,schemaId:i,meta:n,baseId:r,localRefs:d}),this._cache.set(l.schema,l),a&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),o&&this.validateSchema(e,!0),l}_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):go.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let n=this.opts;this.opts=this._metaOpts;try{go.compileSchema.call(this,e)}finally{this.opts=n}}};Eo.ValidationError=AS.default;Eo.MissingRefError=Kf.default;Oe.default=Eo;function Hf(t,e,n,r="error"){for(let o in t){let a=o;a in e&&this.logger[r](`${n}: option ${o}. ${t[a]}`)}}function Yf(t){return t=(0,yo.normalizeId)(t),this.schemas[t]||this.refs[t]}function kS(){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 LS(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function $S(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 n=t[e];n.keyword||(n.keyword=e),this.addKeyword(n)}}function MS(){let t={...this.opts};for(let e of PS)delete t[e];return t}var zS={log(){},warn(){},error(){}};function US(t){if(t===!1)return zS;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 FS=/^[a-z_$][a-z0-9_$:-]*$/i;function jS(t,e){let{RULES:n}=this;if((0,fd.eachItem)(t,r=>{if(n.keywords[r])throw new Error(`Keyword ${r} is already defined`);if(!FS.test(r))throw new Error(`Keyword ${r} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function md(t,e,n){var r;let o=e?.post;if(n&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:a}=this,s=o?a.post:a.rules.find(({type:l})=>l===n);if(s||(s={type:n,rules:[]},a.rules.push(s)),a.keywords[t]=!0,!e)return;let i={keyword:t,definition:{...e,type:(0,ns.getJSONTypes)(e.type),schemaType:(0,ns.getJSONTypes)(e.schemaType)}};e.before?GS.call(this,s,i,e.before):s.rules.push(i),a.all[t]=i,(r=e.implements)===null||r===void 0||r.forEach(l=>this.addKeyword(l))}function GS(t,e,n){let r=t.rules.findIndex(o=>o.keyword===n);r>=0?t.rules.splice(r,0,e):(t.rules.push(e),this.logger.warn(`rule ${n} is not defined`))}function ZS(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Xf(e)),t.validateSchema=this.compile(e,!0))}var BS={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Xf(t){return{anyOf:[t,BS]}}});var e_=N(_d=>{"use strict";u();Object.defineProperty(_d,"__esModule",{value:!0});var qS={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};_d.default=qS});var o_=N(Rn=>{"use strict";u();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.callRef=Rn.getValidate=void 0;var VS=fo(),t_=nt(),qe=q(),fr=Ct(),n_=Xa(),rs=Q(),WS={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:n,it:r}=t,{baseId:o,schemaEnv:a,validateName:s,opts:i,self:l}=r,{root:d}=a;if((n==="#"||n==="#/")&&o===d.baseId)return p();let h=n_.resolveRef.call(l,d,o,n);if(h===void 0)throw new VS.default(r.opts.uriResolver,o,n);if(h instanceof n_.SchemaEnv)return g(h);return f(h);function p(){if(a===d)return os(t,s,a,a.$async);let m=e.scopeValue("root",{ref:d});return os(t,(0,qe._)`${m}.validate`,d,d.$async)}function g(m){let y=r_(t,m);os(t,y,m,m.$async)}function f(m){let y=e.scopeValue("schema",i.code.source===!0?{ref:m,code:(0,qe.stringify)(m)}:{ref:m}),T=e.name("valid"),w=t.subschema({schema:m,dataTypes:[],schemaPath:qe.nil,topSchemaRef:y,errSchemaPath:n},T);t.mergeEvaluated(w),t.ok(T)}}};function r_(t,e){let{gen:n}=t;return e.validate?n.scopeValue("validate",{ref:e.validate}):(0,qe._)`${n.scopeValue("wrapper",{ref:e})}.validate`}Rn.getValidate=r_;function os(t,e,n,r){let{gen:o,it:a}=t,{allErrors:s,schemaEnv:i,opts:l}=a,d=l.passContext?fr.default.this:qe.nil;r?h():p();function h(){if(!i.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,qe._)`await ${(0,t_.callValidateCode)(t,e,d)}`),f(e),s||o.assign(m,!0)},y=>{o.if((0,qe._)`!(${y} instanceof ${a.ValidationError})`,()=>o.throw(y)),g(y),s||o.assign(m,!1)}),t.ok(m)}function p(){t.result((0,t_.callValidateCode)(t,e,d),()=>f(e),()=>g(e))}function g(m){let y=(0,qe._)`${m}.errors`;o.assign(fr.default.vErrors,(0,qe._)`${fr.default.vErrors} === null ? ${y} : ${fr.default.vErrors}.concat(${y})`),o.assign(fr.default.errors,(0,qe._)`${fr.default.vErrors}.length`)}function f(m){var y;if(!a.opts.unevaluated)return;let T=(y=n?.validate)===null||y===void 0?void 0:y.evaluated;if(a.props!==!0)if(T&&!T.dynamicProps)T.props!==void 0&&(a.props=rs.mergeEvaluated.props(o,T.props,a.props));else{let w=o.var("props",(0,qe._)`${m}.evaluated.props`);a.props=rs.mergeEvaluated.props(o,w,a.props,qe.Name)}if(a.items!==!0)if(T&&!T.dynamicItems)T.items!==void 0&&(a.items=rs.mergeEvaluated.items(o,T.items,a.items));else{let w=o.var("items",(0,qe._)`${m}.evaluated.items`);a.items=rs.mergeEvaluated.items(o,w,a.items,qe.Name)}}}Rn.callRef=os;Rn.default=WS});var a_=N(gd=>{"use strict";u();Object.defineProperty(gd,"__esModule",{value:!0});var HS=e_(),YS=o_(),KS=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",HS.default,YS.default];gd.default=KS});var s_=N(yd=>{"use strict";u();Object.defineProperty(yd,"__esModule",{value:!0});var as=q(),Kt=as.operators,ss={maximum:{okStr:"<=",ok:Kt.LTE,fail:Kt.GT},minimum:{okStr:">=",ok:Kt.GTE,fail:Kt.LT},exclusiveMaximum:{okStr:"<",ok:Kt.LT,fail:Kt.GTE},exclusiveMinimum:{okStr:">",ok:Kt.GT,fail:Kt.LTE}},JS={message:({keyword:t,schemaCode:e})=>(0,as.str)`must be ${ss[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,as._)`{comparison: ${ss[t].okStr}, limit: ${e}}`},XS={keyword:Object.keys(ss),type:"number",schemaType:"number",$data:!0,error:JS,code(t){let{keyword:e,data:n,schemaCode:r}=t;t.fail$data((0,as._)`${n} ${ss[e].fail} ${r} || isNaN(${n})`)}};yd.default=XS});var i_=N(Ed=>{"use strict";u();Object.defineProperty(Ed,"__esModule",{value:!0});var To=q(),QS={message:({schemaCode:t})=>(0,To.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,To._)`{multipleOf: ${t}}`},eO={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:QS,code(t){let{gen:e,data:n,schemaCode:r,it:o}=t,a=o.opts.multipleOfPrecision,s=e.let("res"),i=a?(0,To._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${a}`:(0,To._)`${s} !== parseInt(${s})`;t.fail$data((0,To._)`(${r} === 0 || (${s} = ${n}/${r}, ${i}))`)}};Ed.default=eO});var l_=N(Td=>{"use strict";u();Object.defineProperty(Td,"__esModule",{value:!0});function c_(t){let e=t.length,n=0,r=0,o;for(;r<e;)n++,o=t.charCodeAt(r++),o>=55296&&o<=56319&&r<e&&(o=t.charCodeAt(r),(o&64512)===56320&&r++);return n}Td.default=c_;c_.code='require("ajv/dist/runtime/ucs2length").default'});var d_=N(bd=>{"use strict";u();Object.defineProperty(bd,"__esModule",{value:!0});var xn=q(),tO=Q(),nO=l_(),rO={message({keyword:t,schemaCode:e}){let n=t==="maxLength"?"more":"fewer";return(0,xn.str)`must NOT have ${n} than ${e} characters`},params:({schemaCode:t})=>(0,xn._)`{limit: ${t}}`},oO={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:rO,code(t){let{keyword:e,data:n,schemaCode:r,it:o}=t,a=e==="maxLength"?xn.operators.GT:xn.operators.LT,s=o.opts.unicode===!1?(0,xn._)`${n}.length`:(0,xn._)`${(0,tO.useFunc)(t.gen,nO.default)}(${n})`;t.fail$data((0,xn._)`${s} ${a} ${r}`)}};bd.default=oO});var u_=N(wd=>{"use strict";u();Object.defineProperty(wd,"__esModule",{value:!0});var aO=nt(),sO=Q(),_r=q(),iO={message:({schemaCode:t})=>(0,_r.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,_r._)`{pattern: ${t}}`},cO={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:iO,code(t){let{gen:e,data:n,$data:r,schema:o,schemaCode:a,it:s}=t,i=s.opts.unicodeRegExp?"u":"";if(r){let{regExp:l}=s.opts.code,d=l.code==="new RegExp"?(0,_r._)`new RegExp`:(0,sO.useFunc)(e,l),h=e.let("valid");e.try(()=>e.assign(h,(0,_r._)`${d}(${a}, ${i}).test(${n})`),()=>e.assign(h,!1)),t.fail$data((0,_r._)`!${h}`)}else{let l=(0,aO.usePattern)(t,o);t.fail$data((0,_r._)`!${l}.test(${n})`)}}};wd.default=cO});var h_=N(vd=>{"use strict";u();Object.defineProperty(vd,"__esModule",{value:!0});var bo=q(),lO={message({keyword:t,schemaCode:e}){let n=t==="maxProperties"?"more":"fewer";return(0,bo.str)`must NOT have ${n} than ${e} properties`},params:({schemaCode:t})=>(0,bo._)`{limit: ${t}}`},dO={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:lO,code(t){let{keyword:e,data:n,schemaCode:r}=t,o=e==="maxProperties"?bo.operators.GT:bo.operators.LT;t.fail$data((0,bo._)`Object.keys(${n}).length ${o} ${r}`)}};vd.default=dO});var p_=N(Id=>{"use strict";u();Object.defineProperty(Id,"__esModule",{value:!0});var wo=nt(),vo=q(),uO=Q(),hO={message:({params:{missingProperty:t}})=>(0,vo.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,vo._)`{missingProperty: ${t}}`},pO={keyword:"required",type:"object",schemaType:"array",$data:!0,error:hO,code(t){let{gen:e,schema:n,schemaCode:r,data:o,$data:a,it:s}=t,{opts:i}=s;if(!a&&n.length===0)return;let l=n.length>=i.loopRequired;if(s.allErrors?d():h(),i.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let y of n)if(f?.[y]===void 0&&!m.has(y)){let T=s.schemaEnv.baseId+s.errSchemaPath,w=`required property "${y}" is not defined at "${T}" (strictRequired)`;(0,uO.checkStrictMode)(s,w,s.opts.strictRequired)}}function d(){if(l||a)t.block$data(vo.nil,p);else for(let f of n)(0,wo.checkReportMissingProp)(t,f)}function h(){let f=e.let("missing");if(l||a){let m=e.let("valid",!0);t.block$data(m,()=>g(f,m)),t.ok(m)}else e.if((0,wo.checkMissingProp)(t,n,f)),(0,wo.reportMissingProp)(t,f),e.else()}function p(){e.forOf("prop",r,f=>{t.setParams({missingProperty:f}),e.if((0,wo.noPropertyInData)(e,o,f,i.ownProperties),()=>t.error())})}function g(f,m){t.setParams({missingProperty:f}),e.forOf(f,r,()=>{e.assign(m,(0,wo.propertyInData)(e,o,f,i.ownProperties)),e.if((0,vo.not)(m),()=>{t.error(),e.break()})},vo.nil)}}};Id.default=pO});var m_=N(Ad=>{"use strict";u();Object.defineProperty(Ad,"__esModule",{value:!0});var Io=q(),mO={message({keyword:t,schemaCode:e}){let n=t==="maxItems"?"more":"fewer";return(0,Io.str)`must NOT have ${n} than ${e} items`},params:({schemaCode:t})=>(0,Io._)`{limit: ${t}}`},fO={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:mO,code(t){let{keyword:e,data:n,schemaCode:r}=t,o=e==="maxItems"?Io.operators.GT:Io.operators.LT;t.fail$data((0,Io._)`${n}.length ${o} ${r}`)}};Ad.default=fO});var is=N(Sd=>{"use strict";u();Object.defineProperty(Sd,"__esModule",{value:!0});var f_=Yl();f_.code='require("ajv/dist/runtime/equal").default';Sd.default=f_});var __=N(Nd=>{"use strict";u();Object.defineProperty(Nd,"__esModule",{value:!0});var Od=lo(),Ne=q(),_O=Q(),gO=is(),yO={message:({params:{i:t,j:e}})=>(0,Ne.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ne._)`{i: ${t}, j: ${e}}`},EO={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:yO,code(t){let{gen:e,data:n,$data:r,schema:o,parentSchema:a,schemaCode:s,it:i}=t;if(!r&&!o)return;let l=e.let("valid"),d=a.items?(0,Od.getSchemaTypes)(a.items):[];t.block$data(l,h,(0,Ne._)`${s} === false`),t.ok(l);function h(){let m=e.let("i",(0,Ne._)`${n}.length`),y=e.let("j");t.setParams({i:m,j:y}),e.assign(l,!0),e.if((0,Ne._)`${m} > 1`,()=>(p()?g:f)(m,y))}function p(){return d.length>0&&!d.some(m=>m==="object"||m==="array")}function g(m,y){let T=e.name("item"),w=(0,Od.checkDataTypes)(d,T,i.opts.strictNumbers,Od.DataType.Wrong),I=e.const("indices",(0,Ne._)`{}`);e.for((0,Ne._)`;${m}--;`,()=>{e.let(T,(0,Ne._)`${n}[${m}]`),e.if(w,(0,Ne._)`continue`),d.length>1&&e.if((0,Ne._)`typeof ${T} == "string"`,(0,Ne._)`${T} += "_"`),e.if((0,Ne._)`typeof ${I}[${T}] == "number"`,()=>{e.assign(y,(0,Ne._)`${I}[${T}]`),t.error(),e.assign(l,!1).break()}).code((0,Ne._)`${I}[${T}] = ${m}`)})}function f(m,y){let T=(0,_O.useFunc)(e,gO.default),w=e.name("outer");e.label(w).for((0,Ne._)`;${m}--;`,()=>e.for((0,Ne._)`${y} = ${m}; ${y}--;`,()=>e.if((0,Ne._)`${T}(${n}[${m}], ${n}[${y}])`,()=>{t.error(),e.assign(l,!1).break(w)})))}}};Nd.default=EO});var g_=N(Cd=>{"use strict";u();Object.defineProperty(Cd,"__esModule",{value:!0});var Pd=q(),TO=Q(),bO=is(),wO={message:"must be equal to constant",params:({schemaCode:t})=>(0,Pd._)`{allowedValue: ${t}}`},vO={keyword:"const",$data:!0,error:wO,code(t){let{gen:e,data:n,$data:r,schemaCode:o,schema:a}=t;r||a&&typeof a=="object"?t.fail$data((0,Pd._)`!${(0,TO.useFunc)(e,bO.default)}(${n}, ${o})`):t.fail((0,Pd._)`${a} !== ${n}`)}};Cd.default=vO});var y_=N(Dd=>{"use strict";u();Object.defineProperty(Dd,"__esModule",{value:!0});var Ao=q(),IO=Q(),AO=is(),SO={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Ao._)`{allowedValues: ${t}}`},OO={keyword:"enum",schemaType:"array",$data:!0,error:SO,code(t){let{gen:e,data:n,$data:r,schema:o,schemaCode:a,it:s}=t;if(!r&&o.length===0)throw new Error("enum must have non-empty array");let i=o.length>=s.opts.loopEnum,l,d=()=>l??(l=(0,IO.useFunc)(e,AO.default)),h;if(i||r)h=e.let("valid"),t.block$data(h,p);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",a);h=(0,Ao.or)(...o.map((m,y)=>g(f,y)))}t.pass(h);function p(){e.assign(h,!1),e.forOf("v",a,f=>e.if((0,Ao._)`${d()}(${n}, ${f})`,()=>e.assign(h,!0).break()))}function g(f,m){let y=o[m];return typeof y=="object"&&y!==null?(0,Ao._)`${d()}(${n}, ${f}[${m}])`:(0,Ao._)`${n} === ${y}`}}};Dd.default=OO});var E_=N(Rd=>{"use strict";u();Object.defineProperty(Rd,"__esModule",{value:!0});var NO=s_(),PO=i_(),CO=d_(),DO=u_(),RO=h_(),xO=p_(),kO=m_(),LO=__(),$O=g_(),MO=y_(),zO=[NO.default,PO.default,CO.default,DO.default,RO.default,xO.default,kO.default,LO.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},$O.default,MO.default];Rd.default=zO});var kd=N(So=>{"use strict";u();Object.defineProperty(So,"__esModule",{value:!0});So.validateAdditionalItems=void 0;var kn=q(),xd=Q(),UO={message:({params:{len:t}})=>(0,kn.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,kn._)`{limit: ${t}}`},FO={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:UO,code(t){let{parentSchema:e,it:n}=t,{items:r}=e;if(!Array.isArray(r)){(0,xd.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}T_(t,r)}};function T_(t,e){let{gen:n,schema:r,data:o,keyword:a,it:s}=t;s.items=!0;let i=n.const("len",(0,kn._)`${o}.length`);if(r===!1)t.setParams({len:e.length}),t.pass((0,kn._)`${i} <= ${e.length}`);else if(typeof r=="object"&&!(0,xd.alwaysValidSchema)(s,r)){let d=n.var("valid",(0,kn._)`${i} <= ${e.length}`);n.if((0,kn.not)(d),()=>l(d)),t.ok(d)}function l(d){n.forRange("i",e.length,i,h=>{t.subschema({keyword:a,dataProp:h,dataPropType:xd.Type.Num},d),s.allErrors||n.if((0,kn.not)(d),()=>n.break())})}}So.validateAdditionalItems=T_;So.default=FO});var Ld=N(Oo=>{"use strict";u();Object.defineProperty(Oo,"__esModule",{value:!0});Oo.validateTuple=void 0;var b_=q(),cs=Q(),jO=nt(),GO={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:n}=t;if(Array.isArray(e))return w_(t,"additionalItems",e);n.items=!0,!(0,cs.alwaysValidSchema)(n,e)&&t.ok((0,jO.validateArray)(t))}};function w_(t,e,n=t.schema){let{gen:r,parentSchema:o,data:a,keyword:s,it:i}=t;h(o),i.opts.unevaluated&&n.length&&i.items!==!0&&(i.items=cs.mergeEvaluated.items(r,n.length,i.items));let l=r.name("valid"),d=r.const("len",(0,b_._)`${a}.length`);n.forEach((p,g)=>{(0,cs.alwaysValidSchema)(i,p)||(r.if((0,b_._)`${d} > ${g}`,()=>t.subschema({keyword:s,schemaProp:g,dataProp:g},l)),t.ok(l))});function h(p){let{opts:g,errSchemaPath:f}=i,m=n.length,y=m===p.minItems&&(m===p.maxItems||p[e]===!1);if(g.strictTuples&&!y){let T=`"${s}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,cs.checkStrictMode)(i,T,g.strictTuples)}}}Oo.validateTuple=w_;Oo.default=GO});var v_=N($d=>{"use strict";u();Object.defineProperty($d,"__esModule",{value:!0});var ZO=Ld(),BO={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,ZO.validateTuple)(t,"items")};$d.default=BO});var A_=N(Md=>{"use strict";u();Object.defineProperty(Md,"__esModule",{value:!0});var I_=q(),qO=Q(),VO=nt(),WO=kd(),HO={message:({params:{len:t}})=>(0,I_.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,I_._)`{limit: ${t}}`},YO={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:HO,code(t){let{schema:e,parentSchema:n,it:r}=t,{prefixItems:o}=n;r.items=!0,!(0,qO.alwaysValidSchema)(r,e)&&(o?(0,WO.validateAdditionalItems)(t,o):t.ok((0,VO.validateArray)(t)))}};Md.default=YO});var S_=N(zd=>{"use strict";u();Object.defineProperty(zd,"__esModule",{value:!0});var ot=q(),ls=Q(),KO={message:({params:{min:t,max:e}})=>e===void 0?(0,ot.str)`must contain at least ${t} valid item(s)`:(0,ot.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ot._)`{minContains: ${t}}`:(0,ot._)`{minContains: ${t}, maxContains: ${e}}`},JO={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:KO,code(t){let{gen:e,schema:n,parentSchema:r,data:o,it:a}=t,s,i,{minContains:l,maxContains:d}=r;a.opts.next?(s=l===void 0?1:l,i=d):s=1;let h=e.const("len",(0,ot._)`${o}.length`);if(t.setParams({min:s,max:i}),i===void 0&&s===0){(0,ls.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(i!==void 0&&s>i){(0,ls.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ls.alwaysValidSchema)(a,n)){let y=(0,ot._)`${h} >= ${s}`;i!==void 0&&(y=(0,ot._)`${y} && ${h} <= ${i}`),t.pass(y);return}a.items=!0;let p=e.name("valid");i===void 0&&s===1?f(p,()=>e.if(p,()=>e.break())):s===0?(e.let(p,!0),i!==void 0&&e.if((0,ot._)`${o}.length > 0`,g)):(e.let(p,!1),g()),t.result(p,()=>t.reset());function g(){let y=e.name("_valid"),T=e.let("count",0);f(y,()=>e.if(y,()=>m(T)))}function f(y,T){e.forRange("i",0,h,w=>{t.subschema({keyword:"contains",dataProp:w,dataPropType:ls.Type.Num,compositeRule:!0},y),T()})}function m(y){e.code((0,ot._)`${y}++`),i===void 0?e.if((0,ot._)`${y} >= ${s}`,()=>e.assign(p,!0).break()):(e.if((0,ot._)`${y} > ${i}`,()=>e.assign(p,!1).break()),s===1?e.assign(p,!0):e.if((0,ot._)`${y} >= ${s}`,()=>e.assign(p,!0)))}}};zd.default=JO});var P_=N(Tt=>{"use strict";u();Object.defineProperty(Tt,"__esModule",{value:!0});Tt.validateSchemaDeps=Tt.validatePropertyDeps=Tt.error=void 0;var Ud=q(),XO=Q(),No=nt();Tt.error={message:({params:{property:t,depsCount:e,deps:n}})=>{let r=e===1?"property":"properties";return(0,Ud.str)`must have ${r} ${n} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:n,missingProperty:r}})=>(0,Ud._)`{property: ${t},
8
8
  missingProperty: ${r},
9
9
  depsCount: ${e},
10
- deps: ${n}}`};var YO={keyword:"dependencies",type:"object",schemaType:"object",error:Tt.error,code(t){let[e,n]=KO(t);S_(t,e),O_(t,n)}};function KO({schema:t}){let e={},n={};for(let r in t){if(r==="__proto__")continue;let o=Array.isArray(t[r])?e:n;o[r]=t[r]}return[e,n]}function S_(t,e=t.schema){let{gen:n,data:r,it:o}=t;if(Object.keys(e).length===0)return;let a=n.let("missing");for(let s in e){let i=e[s];if(i.length===0)continue;let l=(0,Oo.propertyInData)(n,r,s,o.opts.ownProperties);t.setParams({property:s,depsCount:i.length,deps:i.join(", ")}),o.allErrors?n.if(l,()=>{for(let d of i)(0,Oo.checkReportMissingProp)(t,d)}):(n.if((0,Md._)`${l} && (${(0,Oo.checkMissingProp)(t,i,a)})`),(0,Oo.reportMissingProp)(t,a),n.else())}}Tt.validatePropertyDeps=S_;function O_(t,e=t.schema){let{gen:n,data:r,keyword:o,it:a}=t,s=n.name("valid");for(let i in e)(0,HO.alwaysValidSchema)(a,e[i])||(n.if((0,Oo.propertyInData)(n,r,i,a.opts.ownProperties),()=>{let l=t.subschema({keyword:o,schemaProp:i},s);t.mergeValidEvaluated(l,s)},()=>n.var(s,!0)),t.ok(s))}Tt.validateSchemaDeps=O_;Tt.default=YO});var C_=N(zd=>{"use strict";u();Object.defineProperty(zd,"__esModule",{value:!0});var P_=q(),JO=Q(),XO={message:"property name must be valid",params:({params:t})=>(0,P_._)`{propertyName: ${t.propertyName}}`},QO={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:XO,code(t){let{gen:e,schema:n,data:r,it:o}=t;if((0,JO.alwaysValidSchema)(o,n))return;let a=e.name("valid");e.forIn("key",r,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},a),e.if((0,P_.not)(a),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(a)}};zd.default=QO});var Fd=N(Ud=>{"use strict";u();Object.defineProperty(Ud,"__esModule",{value:!0});var ls=nt(),ht=q(),eN=Ct(),ds=Q(),tN={message:"must NOT have additional properties",params:({params:t})=>(0,ht._)`{additionalProperty: ${t.additionalProperty}}`},nN={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tN,code(t){let{gen:e,schema:n,parentSchema:r,data:o,errsCount:a,it:s}=t;if(!a)throw new Error("ajv implementation error");let{allErrors:i,opts:l}=s;if(s.props=!0,l.removeAdditional!=="all"&&(0,ds.alwaysValidSchema)(s,n))return;let d=(0,ls.allSchemaProperties)(r.properties),h=(0,ls.allSchemaProperties)(r.patternProperties);p(),t.ok((0,ht._)`${a} === ${eN.default.errors}`);function p(){e.forIn("key",o,T=>{!d.length&&!h.length?m(T):e.if(g(T),()=>m(T))})}function g(T){let w;if(d.length>8){let I=(0,ds.schemaRefOrVal)(s,r.properties,"properties");w=(0,ls.isOwnProperty)(e,I,T)}else d.length?w=(0,ht.or)(...d.map(I=>(0,ht._)`${T} === ${I}`)):w=ht.nil;return h.length&&(w=(0,ht.or)(w,...h.map(I=>(0,ht._)`${(0,ls.usePattern)(t,I)}.test(${T})`))),(0,ht.not)(w)}function f(T){e.code((0,ht._)`delete ${o}[${T}]`)}function m(T){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){f(T);return}if(n===!1){t.setParams({additionalProperty:T}),t.error(),i||e.break();return}if(typeof n=="object"&&!(0,ds.alwaysValidSchema)(s,n)){let w=e.name("valid");l.removeAdditional==="failing"?(y(T,w,!1),e.if((0,ht.not)(w),()=>{t.reset(),f(T)})):(y(T,w),i||e.if((0,ht.not)(w),()=>e.break()))}}function y(T,w,I){let S={keyword:"additionalProperties",dataProp:T,dataPropType:ds.Type.Str};I===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(S,w)}}};Ud.default=nN});var k_=N(Gd=>{"use strict";u();Object.defineProperty(Gd,"__esModule",{value:!0});var rN=po(),D_=nt(),jd=Q(),R_=Fd(),oN={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:n,parentSchema:r,data:o,it:a}=t;a.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&R_.default.code(new rN.KeywordCxt(a,R_.default,"additionalProperties"));let s=(0,D_.allSchemaProperties)(n);for(let p of s)a.definedProperties.add(p);a.opts.unevaluated&&s.length&&a.props!==!0&&(a.props=jd.mergeEvaluated.props(e,(0,jd.toHash)(s),a.props));let i=s.filter(p=>!(0,jd.alwaysValidSchema)(a,n[p]));if(i.length===0)return;let l=e.name("valid");for(let p of i)d(p)?h(p):(e.if((0,D_.propertyInData)(e,o,p,a.opts.ownProperties)),h(p),a.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(p),t.ok(l);function d(p){return a.opts.useDefaults&&!a.compositeRule&&n[p].default!==void 0}function h(p){t.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};Gd.default=oN});var M_=N(Zd=>{"use strict";u();Object.defineProperty(Zd,"__esModule",{value:!0});var x_=nt(),us=q(),L_=Q(),$_=Q(),aN={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:n,data:r,parentSchema:o,it:a}=t,{opts:s}=a,i=(0,x_.allSchemaProperties)(n),l=i.filter(y=>(0,L_.alwaysValidSchema)(a,n[y]));if(i.length===0||l.length===i.length&&(!a.opts.unevaluated||a.props===!0))return;let d=s.strictSchema&&!s.allowMatchingProperties&&o.properties,h=e.name("valid");a.props!==!0&&!(a.props instanceof us.Name)&&(a.props=(0,$_.evaluatedPropsToName)(e,a.props));let{props:p}=a;g();function g(){for(let y of i)d&&f(y),a.allErrors?m(y):(e.var(h,!0),m(y),e.if(h))}function f(y){for(let T in d)new RegExp(y).test(T)&&(0,L_.checkStrictMode)(a,`property ${T} matches pattern ${y} (use allowMatchingProperties)`)}function m(y){e.forIn("key",r,T=>{e.if((0,us._)`${(0,x_.usePattern)(t,y)}.test(${T})`,()=>{let w=l.includes(y);w||t.subschema({keyword:"patternProperties",schemaProp:y,dataProp:T,dataPropType:$_.Type.Str},h),a.opts.unevaluated&&p!==!0?e.assign((0,us._)`${p}[${T}]`,!0):!w&&!a.allErrors&&e.if((0,us.not)(h),()=>e.break())})})}}};Zd.default=aN});var z_=N(Bd=>{"use strict";u();Object.defineProperty(Bd,"__esModule",{value:!0});var sN=Q(),iN={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:n,it:r}=t;if((0,sN.alwaysValidSchema)(r,n)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Bd.default=iN});var U_=N(qd=>{"use strict";u();Object.defineProperty(qd,"__esModule",{value:!0});var cN=nt(),lN={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cN.validateUnion,error:{message:"must match a schema in anyOf"}};qd.default=lN});var F_=N(Vd=>{"use strict";u();Object.defineProperty(Vd,"__esModule",{value:!0});var hs=q(),dN=Q(),uN={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,hs._)`{passingSchemas: ${t.passing}}`},hN={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:uN,code(t){let{gen:e,schema:n,parentSchema:r,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;let a=n,s=e.let("valid",!1),i=e.let("passing",null),l=e.name("_valid");t.setParams({passing:i}),e.block(d),t.result(s,()=>t.reset(),()=>t.error(!0));function d(){a.forEach((h,p)=>{let g;(0,dN.alwaysValidSchema)(o,h)?e.var(l,!0):g=t.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l),p>0&&e.if((0,hs._)`${l} && ${s}`).assign(s,!1).assign(i,(0,hs._)`[${i}, ${p}]`).else(),e.if(l,()=>{e.assign(s,!0),e.assign(i,p),g&&t.mergeEvaluated(g,hs.Name)})})}}};Vd.default=hN});var j_=N(Wd=>{"use strict";u();Object.defineProperty(Wd,"__esModule",{value:!0});var pN=Q(),mN={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:n,it:r}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");let o=e.name("valid");n.forEach((a,s)=>{if((0,pN.alwaysValidSchema)(r,a))return;let i=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(i)})}};Wd.default=mN});var B_=N(Hd=>{"use strict";u();Object.defineProperty(Hd,"__esModule",{value:!0});var ps=q(),Z_=Q(),fN={message:({params:t})=>(0,ps.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,ps._)`{failingKeyword: ${t.ifClause}}`},_N={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:fN,code(t){let{gen:e,parentSchema:n,it:r}=t;n.then===void 0&&n.else===void 0&&(0,Z_.checkStrictMode)(r,'"if" without "then" and "else" is ignored');let o=G_(r,"then"),a=G_(r,"else");if(!o&&!a)return;let s=e.let("valid",!0),i=e.name("_valid");if(l(),t.reset(),o&&a){let h=e.let("ifClause");t.setParams({ifClause:h}),e.if(i,d("then",h),d("else",h))}else o?e.if(i,d("then")):e.if((0,ps.not)(i),d("else"));t.pass(s,()=>t.error(!0));function l(){let h=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);t.mergeEvaluated(h)}function d(h,p){return()=>{let g=t.subschema({keyword:h},i);e.assign(s,i),t.mergeValidEvaluated(g,s),p?e.assign(p,(0,ps._)`${h}`):t.setParams({ifClause:h})}}}};function G_(t,e){let n=t.schema[e];return n!==void 0&&!(0,Z_.alwaysValidSchema)(t,n)}Hd.default=_N});var q_=N(Yd=>{"use strict";u();Object.defineProperty(Yd,"__esModule",{value:!0});var gN=Q(),yN={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:n}){e.if===void 0&&(0,gN.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};Yd.default=yN});var V_=N(Kd=>{"use strict";u();Object.defineProperty(Kd,"__esModule",{value:!0});var EN=Rd(),TN=w_(),bN=kd(),wN=I_(),vN=A_(),IN=N_(),AN=C_(),SN=Fd(),ON=k_(),NN=M_(),PN=z_(),CN=U_(),DN=F_(),RN=j_(),kN=B_(),xN=q_();function LN(t=!1){let e=[PN.default,CN.default,DN.default,RN.default,kN.default,xN.default,AN.default,SN.default,IN.default,ON.default,NN.default];return t?e.push(TN.default,wN.default):e.push(EN.default,bN.default),e.push(vN.default),e}Kd.default=LN});var W_=N(Jd=>{"use strict";u();Object.defineProperty(Jd,"__esModule",{value:!0});var ge=q(),$N={message:({schemaCode:t})=>(0,ge.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ge._)`{format: ${t}}`},MN={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:$N,code(t,e){let{gen:n,data:r,$data:o,schema:a,schemaCode:s,it:i}=t,{opts:l,errSchemaPath:d,schemaEnv:h,self:p}=i;if(!l.validateFormats)return;o?g():f();function g(){let m=n.scopeValue("formats",{ref:p.formats,code:l.code.formats}),y=n.const("fDef",(0,ge._)`${m}[${s}]`),T=n.let("fType"),w=n.let("format");n.if((0,ge._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>n.assign(T,(0,ge._)`${y}.type || "string"`).assign(w,(0,ge._)`${y}.validate`),()=>n.assign(T,(0,ge._)`"string"`).assign(w,y)),t.fail$data((0,ge.or)(I(),S()));function I(){return l.strictSchema===!1?ge.nil:(0,ge._)`${s} && !${w}`}function S(){let D=h.$async?(0,ge._)`(${y}.async ? await ${w}(${r}) : ${w}(${r}))`:(0,ge._)`${w}(${r})`,M=(0,ge._)`(typeof ${w} == "function" ? ${D} : ${w}.test(${r}))`;return(0,ge._)`${w} && ${w} !== true && ${T} === ${e} && !${M}`}}function f(){let m=p.formats[a];if(!m){I();return}if(m===!0)return;let[y,T,w]=S(m);y===e&&t.pass(D());function I(){if(l.strictSchema===!1){p.logger.warn(M());return}throw new Error(M());function M(){return`unknown format "${a}" ignored in schema at path "${d}"`}}function S(M){let ke=M instanceof RegExp?(0,ge.regexpCode)(M):l.code.formats?(0,ge._)`${l.code.formats}${(0,ge.getProperty)(a)}`:void 0,Ye=n.scopeValue("formats",{key:a,ref:M,code:ke});return typeof M=="object"&&!(M instanceof RegExp)?[M.type||"string",M.validate,(0,ge._)`${Ye}.validate`]:["string",M,Ye]}function D(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!h.$async)throw new Error("async format in sync schema");return(0,ge._)`await ${w}(${r})`}return typeof T=="function"?(0,ge._)`${w}(${r})`:(0,ge._)`${w}.test(${r})`}}}};Jd.default=MN});var H_=N(Xd=>{"use strict";u();Object.defineProperty(Xd,"__esModule",{value:!0});var zN=W_(),UN=[zN.default];Xd.default=UN});var Y_=N(_r=>{"use strict";u();Object.defineProperty(_r,"__esModule",{value:!0});_r.contentVocabulary=_r.metadataVocabulary=void 0;_r.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];_r.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var J_=N(Qd=>{"use strict";u();Object.defineProperty(Qd,"__esModule",{value:!0});var FN=o_(),jN=y_(),GN=V_(),ZN=H_(),K_=Y_(),BN=[FN.default,jN.default,(0,GN.default)(),ZN.default,K_.metadataVocabulary,K_.contentVocabulary];Qd.default=BN});var Q_=N(ms=>{"use strict";u();Object.defineProperty(ms,"__esModule",{value:!0});ms.DiscrError=void 0;var X_;(function(t){t.Tag="tag",t.Mapping="mapping"})(X_||(ms.DiscrError=X_={}))});var tg=N(tu=>{"use strict";u();Object.defineProperty(tu,"__esModule",{value:!0});var gr=q(),eu=Q_(),eg=Ja(),qN=mo(),VN=Q(),WN={message:({params:{discrError:t,tagName:e}})=>t===eu.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:n}})=>(0,gr._)`{error: ${t}, tag: ${n}, tagValue: ${e}}`},HN={keyword:"discriminator",type:"object",schemaType:"object",error:WN,code(t){let{gen:e,data:n,schema:r,parentSchema:o,it:a}=t,{oneOf:s}=o;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let i=r.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),d=e.const("tag",(0,gr._)`${n}${(0,gr.getProperty)(i)}`);e.if((0,gr._)`typeof ${d} == "string"`,()=>h(),()=>t.error(!1,{discrError:eu.DiscrError.Tag,tag:d,tagName:i})),t.ok(l);function h(){let f=g();e.if(!1);for(let m in f)e.elseIf((0,gr._)`${d} === ${m}`),e.assign(l,p(f[m]));e.else(),t.error(!1,{discrError:eu.DiscrError.Mapping,tag:d,tagName:i}),e.endIf()}function p(f){let m=e.name("valid"),y=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(y,gr.Name),m}function g(){var f;let m={},y=w(o),T=!0;for(let D=0;D<s.length;D++){let M=s[D];if(M?.$ref&&!(0,VN.schemaHasRulesButRef)(M,a.self.RULES)){let Ye=M.$ref;if(M=eg.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,Ye),M instanceof eg.SchemaEnv&&(M=M.schema),M===void 0)throw new qN.default(a.opts.uriResolver,a.baseId,Ye)}let ke=(f=M?.properties)===null||f===void 0?void 0:f[i];if(typeof ke!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);T=T&&(y||w(M)),I(ke,D)}if(!T)throw new Error(`discriminator: "${i}" must be required`);return m;function w({required:D}){return Array.isArray(D)&&D.includes(i)}function I(D,M){if(D.const)S(D.const,M);else if(D.enum)for(let ke of D.enum)S(ke,M);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function S(D,M){if(typeof D!="string"||D in m)throw new Error(`discriminator: "${i}" values must be unique strings`);m[D]=M}}}};tu.default=HN});var ng=N((az,YN)=>{YN.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 ru=N((ue,nu)=>{"use strict";u();Object.defineProperty(ue,"__esModule",{value:!0});ue.MissingRefError=ue.ValidationError=ue.CodeGen=ue.Name=ue.nil=ue.stringify=ue.str=ue._=ue.KeywordCxt=ue.Ajv=void 0;var KN=Xf(),JN=J_(),XN=tg(),rg=ng(),QN=["/properties"],fs="http://json-schema.org/draft-07/schema",yr=class extends KN.default{_addVocabularies(){super._addVocabularies(),JN.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(XN.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(rg,QN):rg;this.addMetaSchema(e,fs,!1),this.refs["http://json-schema.org/schema"]=fs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(fs)?fs:void 0)}};ue.Ajv=yr;nu.exports=ue=yr;nu.exports.Ajv=yr;Object.defineProperty(ue,"__esModule",{value:!0});ue.default=yr;var eP=po();Object.defineProperty(ue,"KeywordCxt",{enumerable:!0,get:function(){return eP.KeywordCxt}});var Er=q();Object.defineProperty(ue,"_",{enumerable:!0,get:function(){return Er._}});Object.defineProperty(ue,"str",{enumerable:!0,get:function(){return Er.str}});Object.defineProperty(ue,"stringify",{enumerable:!0,get:function(){return Er.stringify}});Object.defineProperty(ue,"nil",{enumerable:!0,get:function(){return Er.nil}});Object.defineProperty(ue,"Name",{enumerable:!0,get:function(){return Er.Name}});Object.defineProperty(ue,"CodeGen",{enumerable:!0,get:function(){return Er.CodeGen}});var tP=Ya();Object.defineProperty(ue,"ValidationError",{enumerable:!0,get:function(){return tP.default}});var nP=mo();Object.defineProperty(ue,"MissingRefError",{enumerable:!0,get:function(){return nP.default}})});var ug=N(wt=>{"use strict";u();Object.defineProperty(wt,"__esModule",{value:!0});wt.formatNames=wt.fastFormats=wt.fullFormats=void 0;function bt(t,e){return{validate:t,compare:e}}wt.fullFormats={date:bt(ig,iu),time:bt(au(!0),cu),"date-time":bt(og(!0),lg),"iso-time":bt(au(),cg),"iso-date-time":bt(og(),dg),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:cP,"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:fP,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:lP,int32:{type:"number",validate:hP},int64:{type:"number",validate:pP},float:{type:"number",validate:sg},double:{type:"number",validate:sg},password:!0,binary:!0};wt.fastFormats={...wt.fullFormats,date:bt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,iu),time:bt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,cu),"date-time":bt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,lg),"iso-time":bt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,cg),"iso-date-time":bt(/^\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,dg),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};wt.formatNames=Object.keys(wt.fullFormats);function rP(t){return t%4===0&&(t%100!==0||t%400===0)}var oP=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,aP=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ig(t){let e=oP.exec(t);if(!e)return!1;let n=+e[1],r=+e[2],o=+e[3];return r>=1&&r<=12&&o>=1&&o<=(r===2&&rP(n)?29:aP[r])}function iu(t,e){if(t&&e)return t>e?1:t<e?-1:0}var ou=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function au(t){return function(n){let r=ou.exec(n);if(!r)return!1;let o=+r[1],a=+r[2],s=+r[3],i=r[4],l=r[5]==="-"?-1:1,d=+(r[6]||0),h=+(r[7]||0);if(d>23||h>59||t&&!i)return!1;if(o<=23&&a<=59&&s<60)return!0;let p=a-h*l,g=o-d*l-(p<0?1:0);return(g===23||g===-1)&&(p===59||p===-1)&&s<61}}function cu(t,e){if(!(t&&e))return;let n=new Date("2020-01-01T"+t).valueOf(),r=new Date("2020-01-01T"+e).valueOf();if(n&&r)return n-r}function cg(t,e){if(!(t&&e))return;let n=ou.exec(t),r=ou.exec(e);if(n&&r)return t=n[1]+n[2]+n[3],e=r[1]+r[2]+r[3],t>e?1:t<e?-1:0}var su=/t|\s/i;function og(t){let e=au(t);return function(r){let o=r.split(su);return o.length===2&&ig(o[0])&&e(o[1])}}function lg(t,e){if(!(t&&e))return;let n=new Date(t).valueOf(),r=new Date(e).valueOf();if(n&&r)return n-r}function dg(t,e){if(!(t&&e))return;let[n,r]=t.split(su),[o,a]=e.split(su),s=iu(n,o);if(s!==void 0)return s||cu(r,a)}var sP=/\/|:/,iP=/^(?:[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 cP(t){return sP.test(t)&&iP.test(t)}var ag=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function lP(t){return ag.lastIndex=0,ag.test(t)}var dP=-(2**31),uP=2**31-1;function hP(t){return Number.isInteger(t)&&t<=uP&&t>=dP}function pP(t){return Number.isInteger(t)}function sg(){return!0}var mP=/[^\\]\\Z/;function fP(t){if(mP.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var hg=N(Tr=>{"use strict";u();Object.defineProperty(Tr,"__esModule",{value:!0});Tr.formatLimitDefinition=void 0;var _P=ru(),pt=q(),Jt=pt.operators,_s={formatMaximum:{okStr:"<=",ok:Jt.LTE,fail:Jt.GT},formatMinimum:{okStr:">=",ok:Jt.GTE,fail:Jt.LT},formatExclusiveMaximum:{okStr:"<",ok:Jt.LT,fail:Jt.GTE},formatExclusiveMinimum:{okStr:">",ok:Jt.GT,fail:Jt.LTE}},gP={message:({keyword:t,schemaCode:e})=>(0,pt.str)`should be ${_s[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,pt._)`{comparison: ${_s[t].okStr}, limit: ${e}}`};Tr.formatLimitDefinition={keyword:Object.keys(_s),type:"string",schemaType:"string",$data:!0,error:gP,code(t){let{gen:e,data:n,schemaCode:r,keyword:o,it:a}=t,{opts:s,self:i}=a;if(!s.validateFormats)return;let l=new _P.KeywordCxt(a,i.RULES.all.format.definition,"format");l.$data?d():h();function d(){let g=e.scopeValue("formats",{ref:i.formats,code:s.code.formats}),f=e.const("fmt",(0,pt._)`${g}[${l.schemaCode}]`);t.fail$data((0,pt.or)((0,pt._)`typeof ${f} != "object"`,(0,pt._)`${f} instanceof RegExp`,(0,pt._)`typeof ${f}.compare != "function"`,p(f)))}function h(){let g=l.schema,f=i.formats[g];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${g}" does not define "compare" function`);let m=e.scopeValue("formats",{key:g,ref:f,code:s.code.formats?(0,pt._)`${s.code.formats}${(0,pt.getProperty)(g)}`:void 0});t.fail$data(p(m))}function p(g){return(0,pt._)`${g}.compare(${n}, ${r}) ${_s[o].fail} 0`}},dependencies:["format"]};var yP=t=>(t.addKeyword(Tr.formatLimitDefinition),t);Tr.default=yP});var _g=N((No,fg)=>{"use strict";u();Object.defineProperty(No,"__esModule",{value:!0});var br=ug(),EP=hg(),lu=q(),pg=new lu.Name("fullFormats"),TP=new lu.Name("fastFormats"),du=(t,e={keywords:!0})=>{if(Array.isArray(e))return mg(t,e,br.fullFormats,pg),t;let[n,r]=e.mode==="fast"?[br.fastFormats,TP]:[br.fullFormats,pg],o=e.formats||br.formatNames;return mg(t,o,n,r),e.keywords&&(0,EP.default)(t),t};du.get=(t,e="full")=>{let r=(e==="fast"?br.fastFormats:br.fullFormats)[t];if(!r)throw new Error(`Unknown format "${t}"`);return r};function mg(t,e,n,r){var o,a;(o=(a=t.opts.code).formats)!==null&&o!==void 0||(a.formats=(0,lu._)`require("ajv-formats/dist/formats").${r}`);for(let s of e)t.addFormat(s,n[s])}fg.exports=No=du;Object.defineProperty(No,"__esModule",{value:!0});No.default=du});u();import{appendFileSync as oy,existsSync as xo,mkdirSync as ay,renameSync as Ou,statSync as ks,unlinkSync as xs}from"fs";import Lo from"path";var Ls=null;function aC(t){Ls=t}var Ir={debug:0,info:1,notice:2,warning:3,error:4,critical:5,alert:6,emergency:7},sy=t=>t!==void 0&&["1","true","on","yes"].includes(t.trim().toLowerCase()),iy=()=>(process.env.MCP_LOG_LEVEL??"").trim().toLowerCase()==="verbose",cy=()=>iy()||sy(process.env.MCP_LOG_GQL),ly=()=>{if(cy())return Ir.debug;let t=process.env.MCP_LOG_LEVEL?.trim().toLowerCase();return t&&t in Ir?Ir[t]:Ir.info},dy=50*1024*1024,uy=5,Nu=1,hy=6e4,Pu=(t,e)=>{let n=t?parseInt(t,10):NaN;return Number.isFinite(n)&&n>0?n:e},py=()=>{let t=process.env.MCP_LOG_MAX_AGE_DAYS;if(t===void 0)return Nu*864e5;let e=Number(t);return Number.isFinite(e)&&e>=0?e*864e5:Nu*864e5};function my(){if(process.env.MCP_LOG_DIR)return Lo.resolve(process.env.MCP_LOG_DIR);let t=process.env.WORKSPACE_ROOT||process.cwd();return Lo.join(t,`.${ko}`,"logs")}function fy(){return Lo.join(my(),`${ko}.log`)}var Cu=!1,$s=0;function _y(t,e){try{let n=`${t}.${e}`;xo(n)&&xs(n);for(let r=e-1;r>=1;r--){let o=`${t}.${r}`;xo(o)&&Ou(o,`${t}.${r+1}`)}Ou(t,`${t}.1`)}catch{}}function gy(t,e){$s=Date.now();let n=py();if(n<=0)return;let r=$s-n;for(let o=1;o<=e;o++){let a=`${t}.${o}`;try{xo(a)&&ks(a).mtimeMs<r&&xs(a)}catch{}}try{xo(t)&&ks(t).mtimeMs<r&&xs(t)}catch{}}function yy(t){let e=Pu(process.env.MCP_LOG_MAX_FILES,uy);Date.now()-$s>=hy&&gy(t,e);let n;try{n=ks(t).size}catch{return}n>=Pu(process.env.MCP_LOG_MAX_BYTES,dy)&&_y(t,e)}function Ey(t,e){if(!(Cu||process.env.MCP_LOG_FILE==="off"))try{let n=fy();ay(Lo.dirname(n),{recursive:!0}),yy(n),oy(n,`${new Date().toISOString()} [${t.toUpperCase()}] ${e}
11
- `)}catch{Cu=!0}}function kt(t,e,...n){if(Ir[t]<ly())return;let r=`[${ko}] ${e} ${n.length>0?JSON.stringify(n):""}`;if(Ey(t,r),Ls)try{Ls.server.sendLoggingMessage({level:t,data:r}).catch(o=>{console.error(`[${t.toUpperCase()}] ${r}`)});return}catch{}console.error(`[${t.toUpperCase()}] ${r}`)}var sC={debug:(t,...e)=>kt("debug",t,...e),info:(t,...e)=>kt("info",t,...e),notice:(t,...e)=>kt("notice",t,...e),warn:(t,...e)=>kt("warning",t,...e),error:(t,...e)=>kt("error",t,...e),critical:(t,...e)=>kt("critical",t,...e)};u();var Ms=Su,$o=null;function Fn(){if($o)return $o;let t=(process.env.ZION_ENV??process.env.MCP_ENV)?.trim().toLowerCase(),e=Au;if(t){if(!Ms[t])throw new Error(`Unknown environment "${t}". Known: ${Object.keys(Ms).join(", ")}.`);e=t}let n=Ms[e];return $o={name:e,authEndpoint:process.env.BACKEND_AUTH_ENDPOINT||n.authEndpoint,apiBaseUrl:process.env.BACKEND_API_BASE||n.apiBaseUrl,zeroApiUrlTemplate:process.env.ZERO_API_URL_TEMPLATE||n.zeroApiUrlTemplate,logApiUrlTemplate:process.env.LOG_API_URL_TEMPLATE||n.logApiUrlTemplate,editorBaseUrl:process.env.EDITOR_BASE_URL||n.editorBaseUrl},$o}var Du=!1;function uC(){if(Du)return;Du=!0;let t=Fn();kt("info",`Backend environment: ${t.name} (api=${t.apiBaseUrl})`)}u();u();u();u();var c={};Rs(c,{BRAND:()=>qy,DIRTY:()=>en,EMPTY_PATH:()=>vy,INVALID:()=>z,NEVER:()=>NE,OK:()=>Pe,ParseStatus:()=>ve,Schema:()=>B,ZodAny:()=>$t,ZodArray:()=>St,ZodBigInt:()=>nn,ZodBoolean:()=>rn,ZodBranded:()=>Sr,ZodCatch:()=>fn,ZodDate:()=>on,ZodDefault:()=>mn,ZodDiscriminatedUnion:()=>Uo,ZodEffects:()=>Je,ZodEnum:()=>hn,ZodError:()=>ze,ZodFirstPartyTypeKind:()=>A,ZodFunction:()=>jo,ZodIntersection:()=>ln,ZodIssueCode:()=>v,ZodLazy:()=>dn,ZodLiteral:()=>un,ZodMap:()=>Vn,ZodNaN:()=>Hn,ZodNativeEnum:()=>pn,ZodNever:()=>at,ZodNull:()=>sn,ZodNullable:()=>_t,ZodNumber:()=>tn,ZodObject:()=>Fe,ZodOptional:()=>Ue,ZodParsedType:()=>P,ZodPipeline:()=>Or,ZodPromise:()=>Mt,ZodReadonly:()=>_n,ZodRecord:()=>Fo,ZodSchema:()=>B,ZodSet:()=>Wn,ZodString:()=>Lt,ZodSymbol:()=>Bn,ZodTransformer:()=>Je,ZodTuple:()=>ft,ZodType:()=>B,ZodUndefined:()=>an,ZodUnion:()=>cn,ZodUnknown:()=>At,ZodVoid:()=>qn,addIssueToContext:()=>O,any:()=>eE,array:()=>oE,bigint:()=>Yy,boolean:()=>Gu,coerce:()=>OE,custom:()=>Uu,date:()=>Ky,datetimeRegex:()=>Mu,defaultErrorMap:()=>vt,discriminatedUnion:()=>iE,effect:()=>EE,enum:()=>_E,function:()=>pE,getErrorMap:()=>jn,getParsedType:()=>mt,instanceof:()=>Wy,intersection:()=>cE,isAborted:()=>Mo,isAsync:()=>Gn,isDirty:()=>zo,isValid:()=>xt,late:()=>Vy,lazy:()=>mE,literal:()=>fE,makeIssue:()=>Ar,map:()=>uE,nan:()=>Hy,nativeEnum:()=>gE,never:()=>nE,null:()=>Qy,nullable:()=>bE,number:()=>ju,object:()=>js,objectUtil:()=>zs,oboolean:()=>SE,onumber:()=>AE,optional:()=>TE,ostring:()=>IE,pipeline:()=>vE,preprocess:()=>wE,promise:()=>yE,quotelessJson:()=>Ty,record:()=>dE,set:()=>hE,setErrorMap:()=>wy,strictObject:()=>aE,string:()=>Fu,symbol:()=>Jy,transformer:()=>EE,tuple:()=>lE,undefined:()=>Xy,union:()=>sE,unknown:()=>tE,util:()=>H,void:()=>rE});u();u();u();u();u();var H;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let a={};for(let s of o)a[s]=s;return a},t.getValidEnumValues=o=>{let a=t.objectKeys(o).filter(i=>typeof o[o[i]]!="number"),s={};for(let i of a)s[i]=o[i];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(a){return o[a]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&a.push(s);return a},t.find=(o,a)=>{for(let s of o)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,a=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(o,a)=>typeof a=="bigint"?a.toString():a})(H||(H={}));var zs;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(zs||(zs={}));var P=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mt=t=>{switch(typeof t){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(t)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(t)?P.array:t===null?P.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?P.promise:typeof Map<"u"&&t instanceof Map?P.map:typeof Set<"u"&&t instanceof Set?P.set:typeof Date<"u"&&t instanceof Date?P.date:P.object;default:return P.unknown}};var v=H.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ty=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ze=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(a){return a.message},r={_errors:[]},o=a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let i=r,l=0;for(;l<s.path.length;){let d=s.path[l];l===s.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(n(s))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let a=o.path[0];n[a]=n[a]||[],n[a].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};ze.create=t=>new ze(t);var by=(t,e)=>{let n;switch(t.code){case v.invalid_type:t.received===P.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case v.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,H.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:n=`Unrecognized key(s) in object: ${H.joinValues(t.keys,", ")}`;break;case v.invalid_union:n="Invalid input";break;case v.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${H.joinValues(t.options)}`;break;case v.invalid_enum_value:n=`Invalid enum value. Expected ${H.joinValues(t.options)}, received '${t.received}'`;break;case v.invalid_arguments:n="Invalid function arguments";break;case v.invalid_return_type:n="Invalid function return type";break;case v.invalid_date:n="Invalid date";break;case v.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:H.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case v.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case v.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case v.custom:n="Invalid input";break;case v.invalid_intersection_types:n="Intersection results could not be merged";break;case v.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case v.not_finite:n="Number must be finite";break;default:n=e.defaultError,H.assertNever(t)}return{message:n}},vt=by;var Ru=vt;function wy(t){Ru=t}function jn(){return Ru}u();var Ar=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,a=[...n,...o.path||[]],s={...o,path:a};if(o.message!==void 0)return{...o,path:a,message:o.message};let i="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)i=d(s,{data:e,defaultError:i}).message;return{...o,path:a,message:i}},vy=[];function O(t,e){let n=jn(),r=Ar({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===vt?void 0:vt].filter(o=>!!o)});t.common.issues.push(r)}var ve=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return z;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let a=await o.key,s=await o.value;r.push({key:a,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:a,value:s}=o;if(a.status==="aborted"||s.status==="aborted")return z;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[a.value]=s.value)}return{status:e.value,value:r}}},z=Object.freeze({status:"aborted"}),en=t=>({status:"dirty",value:t}),Pe=t=>({status:"valid",value:t}),Mo=t=>t.status==="aborted",zo=t=>t.status==="dirty",xt=t=>t.status==="valid",Gn=t=>typeof Promise<"u"&&t instanceof Promise;u();u();var R;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(R||(R={}));var Ke=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ku=(t,e)=>{if(xt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new ze(t.common.issues);return this._error=n,this._error}}};function G(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,i)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??i.defaultError}:typeof i.data>"u"?{message:l??r??i.defaultError}:s.code!=="invalid_type"?{message:i.defaultError}:{message:l??n??i.defaultError}},description:o}}var B=class{get description(){return this._def.description}_getType(e){return mt(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:mt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ve,ctx:{common:e.parent.common,data:e.data,parsedType:mt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Gn(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mt(e)},o=this._parseSync({data:e,path:r.path,parent:r});return ku(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return xt(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>xt(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mt(e)},o=this._parse({data:e,path:r.path,parent:r}),a=await(Gn(o)?o:Promise.resolve(o));return ku(r,a)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,a)=>{let s=e(o),i=()=>a.addIssue({code:v.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(i(),!1)):s?!0:(i(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Je({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ue.create(this,this._def)}nullable(){return _t.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return St.create(this)}promise(){return Mt.create(this,this._def)}or(e){return cn.create([this,e],this._def)}and(e){return ln.create(this,e,this._def)}transform(e){return new Je({...G(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new mn({...G(this._def),innerType:this,defaultValue:n,typeName:A.ZodDefault})}brand(){return new Sr({typeName:A.ZodBranded,type:this,...G(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new fn({...G(this._def),innerType:this,catchValue:n,typeName:A.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Or.create(this,e)}readonly(){return _n.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Iy=/^c[^\s-]{8,}$/i,Ay=/^[0-9a-z]+$/,Sy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Oy=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ny=/^[a-z0-9_-]{21}$/i,Py=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Cy=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Dy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ry="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Us,ky=/^(?:(?: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])$/,xy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ly=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$y=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,My=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lu="((\\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])))",Uy=new RegExp(`^${Lu}$`);function $u(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Fy(t){return new RegExp(`^${$u(t)}$`)}function Mu(t){let e=`${Lu}T${$u(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function jy(t,e){return!!((e==="v4"||!e)&&ky.test(t)||(e==="v6"||!e)&&Ly.test(t))}function Gy(t,e){if(!Py.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Zy(t,e){return!!((e==="v4"||!e)&&xy.test(t)||(e==="v6"||!e)&&$y.test(t))}var Lt=class t extends B{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==P.string){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_type,expected:P.string,received:a.parsedType}),z}let r=new ve,o;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(o=this._getOrReturnCtx(e,o),O(o,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(o=this._getOrReturnCtx(e,o),O(o,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,i=e.data.length<a.value;(s||i)&&(o=this._getOrReturnCtx(e,o),s?O(o,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&O(o,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Dy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"email",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")Us||(Us=new RegExp(Ry,"u")),Us.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"emoji",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Oy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"uuid",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Ny.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"nanoid",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Iy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"cuid",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Ay.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"cuid2",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Sy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"ulid",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),O(o,{validation:"url",code:v.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"regex",code:v.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Mu(a).test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Uy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?Fy(a).test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?Cy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"duration",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?jy(e.data,a.version)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"ip",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Gy(e.data,a.alg)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"jwt",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Zy(e.data,a.version)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"cidr",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?My.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"base64",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?zy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"base64url",code:v.invalid_string,message:a.message}),r.dirty()):H.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:v.invalid_string,...R.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...R.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...R.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...R.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...R.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...R.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...R.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...R.errToObj(n)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Lt.create=t=>new Lt({checks:[],typeName:A.ZodString,coerce:t?.coerce??!1,...G(t)});function By(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,a=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return a%s/10**o}var tn=class t extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==P.number){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_type,expected:P.number,received:a.parsedType}),z}let r,o=new ve;for(let a of this._def.checks)a.kind==="int"?H.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),O(r,{code:v.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?By(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),O(r,{code:v.not_finite,message:a.message}),o.dirty()):H.assertNever(a);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,R.toString(n))}gt(e,n){return this.setLimit("min",e,!1,R.toString(n))}lte(e,n){return this.setLimit("max",e,!0,R.toString(n))}lt(e,n){return this.setLimit("max",e,!1,R.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:R.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&H.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};tn.create=t=>new tn({checks:[],typeName:A.ZodNumber,coerce:t?.coerce||!1,...G(t)});var nn=class t extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==P.bigint)return this._getInvalidInput(e);let r,o=new ve;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):H.assertNever(a);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return O(n,{code:v.invalid_type,expected:P.bigint,received:n.parsedType}),z}gte(e,n){return this.setLimit("min",e,!0,R.toString(n))}gt(e,n){return this.setLimit("min",e,!1,R.toString(n))}lte(e,n){return this.setLimit("max",e,!0,R.toString(n))}lt(e,n){return this.setLimit("max",e,!1,R.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:R.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};nn.create=t=>new nn({checks:[],typeName:A.ZodBigInt,coerce:t?.coerce??!1,...G(t)});var rn=class extends B{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==P.boolean){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.boolean,received:r.parsedType}),z}return Pe(e.data)}};rn.create=t=>new rn({typeName:A.ZodBoolean,coerce:t?.coerce||!1,...G(t)});var on=class t extends B{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==P.date){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_type,expected:P.date,received:a.parsedType}),z}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_date}),z}let r=new ve,o;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(o=this._getOrReturnCtx(e,o),O(o,{code:v.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(o=this._getOrReturnCtx(e,o),O(o,{code:v.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):H.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};on.create=t=>new on({checks:[],coerce:t?.coerce||!1,typeName:A.ZodDate,...G(t)});var Bn=class extends B{_parse(e){if(this._getType(e)!==P.symbol){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.symbol,received:r.parsedType}),z}return Pe(e.data)}};Bn.create=t=>new Bn({typeName:A.ZodSymbol,...G(t)});var an=class extends B{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.undefined,received:r.parsedType}),z}return Pe(e.data)}};an.create=t=>new an({typeName:A.ZodUndefined,...G(t)});var sn=class extends B{_parse(e){if(this._getType(e)!==P.null){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.null,received:r.parsedType}),z}return Pe(e.data)}};sn.create=t=>new sn({typeName:A.ZodNull,...G(t)});var $t=class extends B{constructor(){super(...arguments),this._any=!0}_parse(e){return Pe(e.data)}};$t.create=t=>new $t({typeName:A.ZodAny,...G(t)});var At=class extends B{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Pe(e.data)}};At.create=t=>new At({typeName:A.ZodUnknown,...G(t)});var at=class extends B{_parse(e){let n=this._getOrReturnCtx(e);return O(n,{code:v.invalid_type,expected:P.never,received:n.parsedType}),z}};at.create=t=>new at({typeName:A.ZodNever,...G(t)});var qn=class extends B{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.void,received:r.parsedType}),z}return Pe(e.data)}};qn.create=t=>new qn({typeName:A.ZodVoid,...G(t)});var St=class t extends B{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==P.array)return O(n,{code:v.invalid_type,expected:P.array,received:n.parsedType}),z;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,i=n.data.length<o.exactLength.value;(s||i)&&(O(n,{code:s?v.too_big:v.too_small,minimum:i?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(O(n,{code:v.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(O(n,{code:v.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,i)=>o.type._parseAsync(new Ke(n,s,n.path,i)))).then(s=>ve.mergeArray(r,s));let a=[...n.data].map((s,i)=>o.type._parseSync(new Ke(n,s,n.path,i)));return ve.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:R.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:R.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:R.toString(n)}})}nonempty(e){return this.min(1,e)}};St.create=(t,e)=>new St({type:t,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...G(e)});function Zn(t){if(t instanceof Fe){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Ue.create(Zn(r))}return new Fe({...t._def,shape:()=>e})}else return t instanceof St?new St({...t._def,type:Zn(t.element)}):t instanceof Ue?Ue.create(Zn(t.unwrap())):t instanceof _t?_t.create(Zn(t.unwrap())):t instanceof ft?ft.create(t.items.map(e=>Zn(e))):t}var Fe=class t extends B{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=H.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==P.object){let d=this._getOrReturnCtx(e);return O(d,{code:v.invalid_type,expected:P.object,received:d.parsedType}),z}let{status:r,ctx:o}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof at&&this._def.unknownKeys==="strip"))for(let d in o.data)s.includes(d)||i.push(d);let l=[];for(let d of s){let h=a[d],p=o.data[d];l.push({key:{status:"valid",value:d},value:h._parse(new Ke(o,p,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof at){let d=this._def.unknownKeys;if(d==="passthrough")for(let h of i)l.push({key:{status:"valid",value:h},value:{status:"valid",value:o.data[h]}});else if(d==="strict")i.length>0&&(O(o,{code:v.unrecognized_keys,keys:i}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let h of i){let p=o.data[h];l.push({key:{status:"valid",value:h},value:d._parse(new Ke(o,p,o.path,h)),alwaysSet:h in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let h of l){let p=await h.key,g=await h.value;d.push({key:p,value:g,alwaysSet:h.alwaysSet})}return d}).then(d=>ve.mergeObjectSync(r,d)):ve.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:R.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of H.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of H.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Zn(this)}partial(e){let n={};for(let r of H.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of H.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Ue;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return zu(H.objectKeys(this.shape))}};Fe.create=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strip",catchall:at.create(),typeName:A.ZodObject,...G(e)});Fe.strictCreate=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strict",catchall:at.create(),typeName:A.ZodObject,...G(e)});Fe.lazycreate=(t,e)=>new Fe({shape:t,unknownKeys:"strip",catchall:at.create(),typeName:A.ZodObject,...G(e)});var cn=class extends B{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(i=>new ze(i.ctx.common.issues));return O(n,{code:v.invalid_union,unionErrors:s}),z}if(n.common.async)return Promise.all(r.map(async a=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let a,s=[];for(let l of r){let d={...n,common:{...n.common,issues:[]},parent:null},h=l._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(l=>new ze(l));return O(n,{code:v.invalid_union,unionErrors:i}),z}}get options(){return this._def.options}};cn.create=(t,e)=>new cn({options:t,typeName:A.ZodUnion,...G(e)});var It=t=>t instanceof dn?It(t.schema):t instanceof Je?It(t.innerType()):t instanceof un?[t.value]:t instanceof hn?t.options:t instanceof pn?H.objectValues(t.enum):t instanceof mn?It(t._def.innerType):t instanceof an?[void 0]:t instanceof sn?[null]:t instanceof Ue?[void 0,...It(t.unwrap())]:t instanceof _t?[null,...It(t.unwrap())]:t instanceof Sr||t instanceof _n?It(t.unwrap()):t instanceof fn?It(t._def.innerType):[],Uo=class t extends B{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==P.object)return O(n,{code:v.invalid_type,expected:P.object,received:n.parsedType}),z;let r=this.discriminator,o=n.data[r],a=this.optionsMap.get(o);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(O(n,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let a of n){let s=It(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(o.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);o.set(i,a)}}return new t({typeName:A.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...G(r)})}};function Fs(t,e){let n=mt(t),r=mt(e);if(t===e)return{valid:!0,data:t};if(n===P.object&&r===P.object){let o=H.objectKeys(e),a=H.objectKeys(t).filter(i=>o.indexOf(i)!==-1),s={...t,...e};for(let i of a){let l=Fs(t[i],e[i]);if(!l.valid)return{valid:!1};s[i]=l.data}return{valid:!0,data:s}}else if(n===P.array&&r===P.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let a=0;a<t.length;a++){let s=t[a],i=e[a],l=Fs(s,i);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===P.date&&r===P.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ln=class extends B{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(a,s)=>{if(Mo(a)||Mo(s))return z;let i=Fs(a.value,s.value);return i.valid?((zo(a)||zo(s))&&n.dirty(),{status:n.value,value:i.data}):(O(r,{code:v.invalid_intersection_types}),z)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,s])=>o(a,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ln.create=(t,e,n)=>new ln({left:t,right:e,typeName:A.ZodIntersection,...G(n)});var ft=class t extends B{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.array)return O(r,{code:v.invalid_type,expected:P.array,received:r.parsedType}),z;if(r.data.length<this._def.items.length)return O(r,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z;!this._def.rest&&r.data.length>this._def.items.length&&(O(r,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((s,i)=>{let l=this._def.items[i]||this._def.rest;return l?l._parse(new Ke(r,s,r.path,i)):null}).filter(s=>!!s);return r.common.async?Promise.all(a).then(s=>ve.mergeArray(n,s)):ve.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ft.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ft({items:t,typeName:A.ZodTuple,rest:null,...G(e)})};var Fo=class t extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.object)return O(r,{code:v.invalid_type,expected:P.object,received:r.parsedType}),z;let o=[],a=this._def.keyType,s=this._def.valueType;for(let i in r.data)o.push({key:a._parse(new Ke(r,i,r.path,i)),value:s._parse(new Ke(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?ve.mergeObjectAsync(n,o):ve.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof B?new t({keyType:e,valueType:n,typeName:A.ZodRecord,...G(r)}):new t({keyType:Lt.create(),valueType:e,typeName:A.ZodRecord,...G(n)})}},Vn=class extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.map)return O(r,{code:v.invalid_type,expected:P.map,received:r.parsedType}),z;let o=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map(([i,l],d)=>({key:o._parse(new Ke(r,i,r.path,[d,"key"])),value:a._parse(new Ke(r,l,r.path,[d,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let l of s){let d=await l.key,h=await l.value;if(d.status==="aborted"||h.status==="aborted")return z;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),i.set(d.value,h.value)}return{status:n.value,value:i}})}else{let i=new Map;for(let l of s){let d=l.key,h=l.value;if(d.status==="aborted"||h.status==="aborted")return z;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),i.set(d.value,h.value)}return{status:n.value,value:i}}}};Vn.create=(t,e,n)=>new Vn({valueType:e,keyType:t,typeName:A.ZodMap,...G(n)});var Wn=class t extends B{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.set)return O(r,{code:v.invalid_type,expected:P.set,received:r.parsedType}),z;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(O(r,{code:v.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(O(r,{code:v.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let a=this._def.valueType;function s(l){let d=new Set;for(let h of l){if(h.status==="aborted")return z;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}let i=[...r.data.values()].map((l,d)=>a._parse(new Ke(r,l,r.path,d)));return r.common.async?Promise.all(i).then(l=>s(l)):s(i)}min(e,n){return new t({...this._def,minSize:{value:e,message:R.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:R.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Wn.create=(t,e)=>new Wn({valueType:t,minSize:null,maxSize:null,typeName:A.ZodSet,...G(e)});var jo=class t extends B{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==P.function)return O(n,{code:v.invalid_type,expected:P.function,received:n.parsedType}),z;function r(i,l){return Ar({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,jn(),vt].filter(d=>!!d),issueData:{code:v.invalid_arguments,argumentsError:l}})}function o(i,l){return Ar({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,jn(),vt].filter(d=>!!d),issueData:{code:v.invalid_return_type,returnTypeError:l}})}let a={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Mt){let i=this;return Pe(async function(...l){let d=new ze([]),h=await i._def.args.parseAsync(l,a).catch(f=>{throw d.addIssue(r(l,f)),d}),p=await Reflect.apply(s,this,h);return await i._def.returns._def.type.parseAsync(p,a).catch(f=>{throw d.addIssue(o(p,f)),d})})}else{let i=this;return Pe(function(...l){let d=i._def.args.safeParse(l,a);if(!d.success)throw new ze([r(l,d.error)]);let h=Reflect.apply(s,this,d.data),p=i._def.returns.safeParse(h,a);if(!p.success)throw new ze([o(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ft.create(e).rest(At.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||ft.create([]).rest(At.create()),returns:n||At.create(),typeName:A.ZodFunction,...G(r)})}},dn=class extends B{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};dn.create=(t,e)=>new dn({getter:t,typeName:A.ZodLazy,...G(e)});var un=class extends B{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return O(n,{received:n.data,code:v.invalid_literal,expected:this._def.value}),z}return{status:"valid",value:e.data}}get value(){return this._def.value}};un.create=(t,e)=>new un({value:t,typeName:A.ZodLiteral,...G(e)});function zu(t,e){return new hn({values:t,typeName:A.ZodEnum,...G(e)})}var hn=class t extends B{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return O(n,{expected:H.joinValues(r),received:n.parsedType,code:v.invalid_type}),z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return O(n,{received:n.data,code:v.invalid_enum_value,options:r}),z}return Pe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};hn.create=zu;var pn=class extends B{_parse(e){let n=H.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==P.string&&r.parsedType!==P.number){let o=H.objectValues(n);return O(r,{expected:H.joinValues(o),received:r.parsedType,code:v.invalid_type}),z}if(this._cache||(this._cache=new Set(H.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=H.objectValues(n);return O(r,{received:r.data,code:v.invalid_enum_value,options:o}),z}return Pe(e.data)}get enum(){return this._def.values}};pn.create=(t,e)=>new pn({values:t,typeName:A.ZodNativeEnum,...G(e)});var Mt=class extends B{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==P.promise&&n.common.async===!1)return O(n,{code:v.invalid_type,expected:P.promise,received:n.parsedType}),z;let r=n.parsedType===P.promise?n.data:Promise.resolve(n.data);return Pe(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Mt.create=(t,e)=>new Mt({type:t,typeName:A.ZodPromise,...G(e)});var Je=class extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,a={addIssue:s=>{O(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let s=o.transform(r.data,a);if(r.common.async)return Promise.resolve(s).then(async i=>{if(n.value==="aborted")return z;let l=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});return l.status==="aborted"?z:l.status==="dirty"?en(l.value):n.value==="dirty"?en(l.value):l});{if(n.value==="aborted")return z;let i=this._def.schema._parseSync({data:s,path:r.path,parent:r});return i.status==="aborted"?z:i.status==="dirty"?en(i.value):n.value==="dirty"?en(i.value):i}}if(o.type==="refinement"){let s=i=>{let l=o.refinement(i,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?z:(i.status==="dirty"&&n.dirty(),s(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>i.status==="aborted"?z:(i.status==="dirty"&&n.dirty(),s(i.value).then(()=>({status:n.value,value:i.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!xt(s))return z;let i=o.transform(s.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>xt(s)?Promise.resolve(o.transform(s.value,a)).then(i=>({status:n.value,value:i})):z);H.assertNever(o)}};Je.create=(t,e,n)=>new Je({schema:t,typeName:A.ZodEffects,effect:e,...G(n)});Je.createWithPreprocess=(t,e,n)=>new Je({schema:e,effect:{type:"preprocess",transform:t},typeName:A.ZodEffects,...G(n)});var Ue=class extends B{_parse(e){return this._getType(e)===P.undefined?Pe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ue.create=(t,e)=>new Ue({innerType:t,typeName:A.ZodOptional,...G(e)});var _t=class extends B{_parse(e){return this._getType(e)===P.null?Pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_t.create=(t,e)=>new _t({innerType:t,typeName:A.ZodNullable,...G(e)});var mn=class extends B{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===P.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};mn.create=(t,e)=>new mn({innerType:t,typeName:A.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...G(e)});var fn=class extends B{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Gn(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ze(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ze(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};fn.create=(t,e)=>new fn({innerType:t,typeName:A.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...G(e)});var Hn=class extends B{_parse(e){if(this._getType(e)!==P.nan){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.nan,received:r.parsedType}),z}return{status:"valid",value:e.data}}};Hn.create=t=>new Hn({typeName:A.ZodNaN,...G(t)});var qy=Symbol("zod_brand"),Sr=class extends B{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Or=class t extends B{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?z:a.status==="dirty"?(n.dirty(),en(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?z:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:A.ZodPipeline})}},_n=class extends B{_parse(e){let n=this._def.innerType._parse(e),r=o=>(xt(o)&&(o.value=Object.freeze(o.value)),o);return Gn(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};_n.create=(t,e)=>new _n({innerType:t,typeName:A.ZodReadonly,...G(e)});function xu(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Uu(t,e={},n){return t?$t.create().superRefine((r,o)=>{let a=t(r);if(a instanceof Promise)return a.then(s=>{if(!s){let i=xu(e,r),l=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:l})}});if(!a){let s=xu(e,r),i=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:i})}}):$t.create()}var Vy={object:Fe.lazycreate},A;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(A||(A={}));var Wy=(t,e={message:`Input not instance of ${t.name}`})=>Uu(n=>n instanceof t,e),Fu=Lt.create,ju=tn.create,Hy=Hn.create,Yy=nn.create,Gu=rn.create,Ky=on.create,Jy=Bn.create,Xy=an.create,Qy=sn.create,eE=$t.create,tE=At.create,nE=at.create,rE=qn.create,oE=St.create,js=Fe.create,aE=Fe.strictCreate,sE=cn.create,iE=Uo.create,cE=ln.create,lE=ft.create,dE=Fo.create,uE=Vn.create,hE=Wn.create,pE=jo.create,mE=dn.create,fE=un.create,_E=hn.create,gE=pn.create,yE=Mt.create,EE=Je.create,TE=Ue.create,bE=_t.create,wE=Je.createWithPreprocess,vE=Or.create,IE=()=>Fu().optional(),AE=()=>ju().optional(),SE=()=>Gu().optional(),OE={string:(t=>Lt.create({...t,coerce:!0})),number:(t=>tn.create({...t,coerce:!0})),boolean:(t=>rn.create({...t,coerce:!0})),bigint:(t=>nn.create({...t,coerce:!0})),date:(t=>on.create({...t,coerce:!0}))};var NE=z;u();u();u();var PE=Object.freeze({status:"aborted"});function b(t,e,n){function r(i,l){var d;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(d=i._zod).traits??(d.traits=new Set),i._zod.traits.add(t),e(i,l);for(let h in s.prototype)h in i||Object.defineProperty(i,h,{value:s.prototype[h].bind(i)});i._zod.constr=s,i._zod.def=l}let o=n?.Parent??Object;class a extends o{}Object.defineProperty(a,"name",{value:t});function s(i){var l;let d=n?.Parent?new a:this;r(d,i),(l=d._zod).deferred??(l.deferred=[]);for(let h of d._zod.deferred)h();return d}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:i=>n?.Parent&&i instanceof n.Parent?!0:i?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var CE=Symbol("zod_brand"),Ot=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Go={};function Ve(t){return t&&Object.assign(Go,t),Go}u();u();var Y={};Rs(Y,{BIGINT_FORMAT_RANGES:()=>Bu,Class:()=>Zs,NUMBER_FORMAT_RANGES:()=>Ks,aborted:()=>yn,allowsEval:()=>Ws,assert:()=>LE,assertEqual:()=>DE,assertIs:()=>kE,assertNever:()=>xE,assertNotEqual:()=>RE,assignProp:()=>Vs,cached:()=>Cr,captureStackTrace:()=>Bo,cleanEnum:()=>HE,cleanRegex:()=>Rr,clone:()=>We,createTransparentProxy:()=>jE,defineLazy:()=>se,esc:()=>gn,escapeRegex:()=>zt,extend:()=>BE,finalizeIssue:()=>st,floatSafeRemainder:()=>qs,getElementAtPath:()=>$E,getEnumValues:()=>Pr,getLengthableOrigin:()=>kr,getParsedType:()=>FE,getSizableOrigin:()=>qu,isObject:()=>Yn,isPlainObject:()=>Kn,issue:()=>Js,joinValues:()=>Zo,jsonStringifyReplacer:()=>Bs,merge:()=>qE,normalizeParams:()=>U,nullish:()=>Dr,numKeys:()=>UE,omit:()=>ZE,optionalKeys:()=>Ys,partial:()=>VE,pick:()=>GE,prefixIssues:()=>gt,primitiveTypes:()=>Zu,promiseAllObject:()=>ME,propertyKeyTypes:()=>Hs,randomString:()=>zE,required:()=>WE,stringifyPrimitive:()=>qo,unwrapMessage:()=>Nr});u();function DE(t){return t}function RE(t){return t}function kE(t){}function xE(t){throw new Error}function LE(t){}function Pr(t){let e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,o])=>e.indexOf(+r)===-1).map(([r,o])=>o)}function Zo(t,e="|"){return t.map(n=>qo(n)).join(e)}function Bs(t,e){return typeof e=="bigint"?e.toString():e}function Cr(t){return{get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function Dr(t){return t==null}function Rr(t){let e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function qs(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,a=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return a%s/10**o}function se(t,e,n){Object.defineProperty(t,e,{get(){{let o=n();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function Vs(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function $E(t,e){return e?e.reduce((n,r)=>n?.[r],t):t}function ME(t){let e=Object.keys(t),n=e.map(r=>t[r]);return Promise.all(n).then(r=>{let o={};for(let a=0;a<e.length;a++)o[e[a]]=r[a];return o})}function zE(t=10){let e="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<t;r++)n+=e[Math.floor(Math.random()*e.length)];return n}function gn(t){return JSON.stringify(t)}var Bo=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Yn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Ws=Cr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Kn(t){if(Yn(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let n=e.prototype;return!(Yn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function UE(t){let e=0;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}var FE=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}`)}},Hs=new Set(["string","number","symbol"]),Zu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function zt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function We(t,e,n){let r=new t._zod.constr(e??t._zod.def);return(!e||n?.parent)&&(r._zod.parent=t),r}function U(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 jE(t){let e;return new Proxy({},{get(n,r,o){return e??(e=t()),Reflect.get(e,r,o)},set(n,r,o,a){return e??(e=t()),Reflect.set(e,r,o,a)},has(n,r){return e??(e=t()),Reflect.has(e,r)},deleteProperty(n,r){return e??(e=t()),Reflect.deleteProperty(e,r)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,r){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,r)},defineProperty(n,r,o){return e??(e=t()),Reflect.defineProperty(e,r,o)}})}function qo(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Ys(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Ks={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]},Bu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function GE(t,e){let n={},r=t._zod.def;for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(n[o]=r.shape[o])}return We(t,{...t._zod.def,shape:n,checks:[]})}function ZE(t,e){let n={...t._zod.def.shape},r=t._zod.def;for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete n[o]}return We(t,{...t._zod.def,shape:n,checks:[]})}function BE(t,e){if(!Kn(e))throw new Error("Invalid input to extend: expected a plain object");let n={...t._zod.def,get shape(){let r={...t._zod.def.shape,...e};return Vs(this,"shape",r),r},checks:[]};return We(t,n)}function qE(t,e){return We(t,{...t._zod.def,get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Vs(this,"shape",n),n},catchall:e._zod.def.catchall,checks:[]})}function VE(t,e,n){let r=e._zod.def.shape,o={...r};if(n)for(let a in n){if(!(a in r))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=t?new t({type:"optional",innerType:r[a]}):r[a])}else for(let a in r)o[a]=t?new t({type:"optional",innerType:r[a]}):r[a];return We(e,{...e._zod.def,shape:o,checks:[]})}function WE(t,e,n){let r=e._zod.def.shape,o={...r};if(n)for(let a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new t({type:"nonoptional",innerType:r[a]}))}else for(let a in r)o[a]=new t({type:"nonoptional",innerType:r[a]});return We(e,{...e._zod.def,shape:o,checks:[]})}function yn(t,e=0){for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function gt(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Nr(t){return typeof t=="string"?t:t?.message}function st(t,e,n){let r={...t,path:t.path??[]};if(!t.message){let o=Nr(t.inst?._zod.def?.error?.(t))??Nr(e?.error?.(t))??Nr(n.customError?.(t))??Nr(n.localeError?.(t))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,e?.reportInput||delete r.input,r}function qu(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function kr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Js(...t){let[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}function HE(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Zs=class{constructor(...e){}};var Vu=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Bs,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Vo=b("$ZodError",Vu),xr=b("$ZodError",Vu,{Parent:Error});function Xs(t,e=n=>n.message){let n={},r=[];for(let o of t.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}function Qs(t,e){let n=e||function(a){return a.message},r={_errors:[]},o=a=>{for(let s of a.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let i=r,l=0;for(;l<s.path.length;){let d=s.path[l];l===s.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(n(s))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}};return o(t),r}var ei=t=>(e,n,r,o)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},s=e._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new Ot;if(s.issues.length){let i=new(o?.Err??t)(s.issues.map(l=>st(l,a,Ve())));throw Bo(i,o?.callee),i}return s.value},ti=ei(xr),ni=t=>async(e,n,r,o)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},s=e._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let i=new(o?.Err??t)(s.issues.map(l=>st(l,a,Ve())));throw Bo(i,o?.callee),i}return s.value},ri=ni(xr),oi=t=>(e,n,r)=>{let o=r?{...r,async:!1}:{async:!1},a=e._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Ot;return a.issues.length?{success:!1,error:new(t??Vo)(a.issues.map(s=>st(s,o,Ve())))}:{success:!0,data:a.value}},En=oi(xr),ai=t=>async(e,n,r)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},a=e._zod.run({value:n,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new t(a.issues.map(s=>st(s,o,Ve())))}:{success:!0,data:a.value}},Tn=ai(xr);u();u();u();var Wu=/^[cC][^\s-]{8,}$/,Hu=/^[0-9a-z]+$/,Yu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ku=/^[0-9a-vA-V]{20}$/,Ju=/^[A-Za-z0-9]{27}$/,Xu=/^[a-zA-Z0-9_-]{21}$/,Qu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var eh=/^([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})$/,si=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)$/;var th=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var KE="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function nh(){return new RegExp(KE,"u")}var rh=/^(?:(?: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])$/,oh=/^(([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})$/,ah=/^((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])$/,sh=/^(([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])$/,ih=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ii=/^[A-Za-z0-9_-]*$/,ch=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var lh=/^\+(?:[0-9]){6,14}[0-9]$/,dh="(?:(?:\\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])))",uh=new RegExp(`^${dh}$`);function hh(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 ph(t){return new RegExp(`^${hh(t)}$`)}function mh(t){let e=hh({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-]\\d{2}:\\d{2})");let r=`${e}(?:${n.join("|")})`;return new RegExp(`^${dh}T(?:${r})$`)}var fh=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var _h=/^\d+$/,gh=/^-?\d+(?:\.\d+)?/i,yh=/true|false/i,Eh=/null/i;var Th=/^[^A-Z]*$/,bh=/^[^a-z]*$/;var Ie=b("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),wh={number:"number",bigint:"bigint",object:"date"},ci=b("$ZodCheckLessThan",(t,e)=>{Ie.init(t,e);let n=wh[typeof e.value];t._zod.onattach.push(r=>{let o=r._zod.bag,a=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),li=b("$ZodCheckGreaterThan",(t,e)=>{Ie.init(t,e);let n=wh[typeof e.value];t._zod.onattach.push(r=>{let o=r._zod.bag,a=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),vh=b("$ZodCheckMultipleOf",(t,e)=>{Ie.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):qs(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Ih=b("$ZodCheckNumberFormat",(t,e)=>{Ie.init(t,e),e.format=e.format||"float64";let n=e.format?.includes("int"),r=n?"int":"number",[o,a]=Ks[e.format];t._zod.onattach.push(s=>{let i=s._zod.bag;i.format=e.format,i.minimum=o,i.maximum=a,n&&(i.pattern=_h)}),t._zod.check=s=>{let i=s.value;if(n){if(!Number.isInteger(i)){s.issues.push({expected:r,format:e.format,code:"invalid_type",input:i,inst:t});return}if(!Number.isSafeInteger(i)){i>0?s.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort}):s.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});return}}i<o&&s.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),i>a&&s.issues.push({origin:"number",input:i,code:"too_big",maximum:a,inst:t})}});var Ah=b("$ZodCheckMaxLength",(t,e)=>{var n;Ie.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Dr(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{let o=r.value;if(o.length<=e.maximum)return;let s=kr(o);r.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Sh=b("$ZodCheckMinLength",(t,e)=>{var n;Ie.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Dr(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{let o=r.value;if(o.length>=e.minimum)return;let s=kr(o);r.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Oh=b("$ZodCheckLengthEquals",(t,e)=>{var n;Ie.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Dr(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=r=>{let o=r.value,a=o.length;if(a===e.length)return;let s=kr(o),i=a>e.length;r.issues.push({origin:s,...i?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),Lr=b("$ZodCheckStringFormat",(t,e)=>{var n,r;Ie.init(t,e),t._zod.onattach.push(o=>{let a=o._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),Nh=b("$ZodCheckRegex",(t,e)=>{Lr.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Ph=b("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Th),Lr.init(t,e)}),Ch=b("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=bh),Lr.init(t,e)}),Dh=b("$ZodCheckIncludes",(t,e)=>{Ie.init(t,e);let n=zt(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(o=>{let a=o._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),Rh=b("$ZodCheckStartsWith",(t,e)=>{Ie.init(t,e);let n=new RegExp(`^${zt(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),kh=b("$ZodCheckEndsWith",(t,e)=>{Ie.init(t,e);let n=new RegExp(`.*${zt(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}});var xh=b("$ZodCheckOverwrite",(t,e)=>{Ie.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});u();var Ho=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 r=e.split(`
10
+ deps: ${n}}`};var QO={keyword:"dependencies",type:"object",schemaType:"object",error:Tt.error,code(t){let[e,n]=eN(t);O_(t,e),N_(t,n)}};function eN({schema:t}){let e={},n={};for(let r in t){if(r==="__proto__")continue;let o=Array.isArray(t[r])?e:n;o[r]=t[r]}return[e,n]}function O_(t,e=t.schema){let{gen:n,data:r,it:o}=t;if(Object.keys(e).length===0)return;let a=n.let("missing");for(let s in e){let i=e[s];if(i.length===0)continue;let l=(0,No.propertyInData)(n,r,s,o.opts.ownProperties);t.setParams({property:s,depsCount:i.length,deps:i.join(", ")}),o.allErrors?n.if(l,()=>{for(let d of i)(0,No.checkReportMissingProp)(t,d)}):(n.if((0,Ud._)`${l} && (${(0,No.checkMissingProp)(t,i,a)})`),(0,No.reportMissingProp)(t,a),n.else())}}Tt.validatePropertyDeps=O_;function N_(t,e=t.schema){let{gen:n,data:r,keyword:o,it:a}=t,s=n.name("valid");for(let i in e)(0,XO.alwaysValidSchema)(a,e[i])||(n.if((0,No.propertyInData)(n,r,i,a.opts.ownProperties),()=>{let l=t.subschema({keyword:o,schemaProp:i},s);t.mergeValidEvaluated(l,s)},()=>n.var(s,!0)),t.ok(s))}Tt.validateSchemaDeps=N_;Tt.default=QO});var D_=N(Fd=>{"use strict";u();Object.defineProperty(Fd,"__esModule",{value:!0});var C_=q(),tN=Q(),nN={message:"property name must be valid",params:({params:t})=>(0,C_._)`{propertyName: ${t.propertyName}}`},rN={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:nN,code(t){let{gen:e,schema:n,data:r,it:o}=t;if((0,tN.alwaysValidSchema)(o,n))return;let a=e.name("valid");e.forIn("key",r,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},a),e.if((0,C_.not)(a),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(a)}};Fd.default=rN});var Gd=N(jd=>{"use strict";u();Object.defineProperty(jd,"__esModule",{value:!0});var ds=nt(),ht=q(),oN=Ct(),us=Q(),aN={message:"must NOT have additional properties",params:({params:t})=>(0,ht._)`{additionalProperty: ${t.additionalProperty}}`},sN={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:aN,code(t){let{gen:e,schema:n,parentSchema:r,data:o,errsCount:a,it:s}=t;if(!a)throw new Error("ajv implementation error");let{allErrors:i,opts:l}=s;if(s.props=!0,l.removeAdditional!=="all"&&(0,us.alwaysValidSchema)(s,n))return;let d=(0,ds.allSchemaProperties)(r.properties),h=(0,ds.allSchemaProperties)(r.patternProperties);p(),t.ok((0,ht._)`${a} === ${oN.default.errors}`);function p(){e.forIn("key",o,T=>{!d.length&&!h.length?m(T):e.if(g(T),()=>m(T))})}function g(T){let w;if(d.length>8){let I=(0,us.schemaRefOrVal)(s,r.properties,"properties");w=(0,ds.isOwnProperty)(e,I,T)}else d.length?w=(0,ht.or)(...d.map(I=>(0,ht._)`${T} === ${I}`)):w=ht.nil;return h.length&&(w=(0,ht.or)(w,...h.map(I=>(0,ht._)`${(0,ds.usePattern)(t,I)}.test(${T})`))),(0,ht.not)(w)}function f(T){e.code((0,ht._)`delete ${o}[${T}]`)}function m(T){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){f(T);return}if(n===!1){t.setParams({additionalProperty:T}),t.error(),i||e.break();return}if(typeof n=="object"&&!(0,us.alwaysValidSchema)(s,n)){let w=e.name("valid");l.removeAdditional==="failing"?(y(T,w,!1),e.if((0,ht.not)(w),()=>{t.reset(),f(T)})):(y(T,w),i||e.if((0,ht.not)(w),()=>e.break()))}}function y(T,w,I){let S={keyword:"additionalProperties",dataProp:T,dataPropType:us.Type.Str};I===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(S,w)}}};jd.default=sN});var k_=N(Bd=>{"use strict";u();Object.defineProperty(Bd,"__esModule",{value:!0});var iN=mo(),R_=nt(),Zd=Q(),x_=Gd(),cN={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:n,parentSchema:r,data:o,it:a}=t;a.opts.removeAdditional==="all"&&r.additionalProperties===void 0&&x_.default.code(new iN.KeywordCxt(a,x_.default,"additionalProperties"));let s=(0,R_.allSchemaProperties)(n);for(let p of s)a.definedProperties.add(p);a.opts.unevaluated&&s.length&&a.props!==!0&&(a.props=Zd.mergeEvaluated.props(e,(0,Zd.toHash)(s),a.props));let i=s.filter(p=>!(0,Zd.alwaysValidSchema)(a,n[p]));if(i.length===0)return;let l=e.name("valid");for(let p of i)d(p)?h(p):(e.if((0,R_.propertyInData)(e,o,p,a.opts.ownProperties)),h(p),a.allErrors||e.else().var(l,!0),e.endIf()),t.it.definedProperties.add(p),t.ok(l);function d(p){return a.opts.useDefaults&&!a.compositeRule&&n[p].default!==void 0}function h(p){t.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};Bd.default=cN});var z_=N(qd=>{"use strict";u();Object.defineProperty(qd,"__esModule",{value:!0});var L_=nt(),hs=q(),$_=Q(),M_=Q(),lN={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:n,data:r,parentSchema:o,it:a}=t,{opts:s}=a,i=(0,L_.allSchemaProperties)(n),l=i.filter(y=>(0,$_.alwaysValidSchema)(a,n[y]));if(i.length===0||l.length===i.length&&(!a.opts.unevaluated||a.props===!0))return;let d=s.strictSchema&&!s.allowMatchingProperties&&o.properties,h=e.name("valid");a.props!==!0&&!(a.props instanceof hs.Name)&&(a.props=(0,M_.evaluatedPropsToName)(e,a.props));let{props:p}=a;g();function g(){for(let y of i)d&&f(y),a.allErrors?m(y):(e.var(h,!0),m(y),e.if(h))}function f(y){for(let T in d)new RegExp(y).test(T)&&(0,$_.checkStrictMode)(a,`property ${T} matches pattern ${y} (use allowMatchingProperties)`)}function m(y){e.forIn("key",r,T=>{e.if((0,hs._)`${(0,L_.usePattern)(t,y)}.test(${T})`,()=>{let w=l.includes(y);w||t.subschema({keyword:"patternProperties",schemaProp:y,dataProp:T,dataPropType:M_.Type.Str},h),a.opts.unevaluated&&p!==!0?e.assign((0,hs._)`${p}[${T}]`,!0):!w&&!a.allErrors&&e.if((0,hs.not)(h),()=>e.break())})})}}};qd.default=lN});var U_=N(Vd=>{"use strict";u();Object.defineProperty(Vd,"__esModule",{value:!0});var dN=Q(),uN={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:n,it:r}=t;if((0,dN.alwaysValidSchema)(r,n)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Vd.default=uN});var F_=N(Wd=>{"use strict";u();Object.defineProperty(Wd,"__esModule",{value:!0});var hN=nt(),pN={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hN.validateUnion,error:{message:"must match a schema in anyOf"}};Wd.default=pN});var j_=N(Hd=>{"use strict";u();Object.defineProperty(Hd,"__esModule",{value:!0});var ps=q(),mN=Q(),fN={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,ps._)`{passingSchemas: ${t.passing}}`},_N={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:fN,code(t){let{gen:e,schema:n,parentSchema:r,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");if(o.opts.discriminator&&r.discriminator)return;let a=n,s=e.let("valid",!1),i=e.let("passing",null),l=e.name("_valid");t.setParams({passing:i}),e.block(d),t.result(s,()=>t.reset(),()=>t.error(!0));function d(){a.forEach((h,p)=>{let g;(0,mN.alwaysValidSchema)(o,h)?e.var(l,!0):g=t.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l),p>0&&e.if((0,ps._)`${l} && ${s}`).assign(s,!1).assign(i,(0,ps._)`[${i}, ${p}]`).else(),e.if(l,()=>{e.assign(s,!0),e.assign(i,p),g&&t.mergeEvaluated(g,ps.Name)})})}}};Hd.default=_N});var G_=N(Yd=>{"use strict";u();Object.defineProperty(Yd,"__esModule",{value:!0});var gN=Q(),yN={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:n,it:r}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");let o=e.name("valid");n.forEach((a,s)=>{if((0,gN.alwaysValidSchema)(r,a))return;let i=t.subschema({keyword:"allOf",schemaProp:s},o);t.ok(o),t.mergeEvaluated(i)})}};Yd.default=yN});var q_=N(Kd=>{"use strict";u();Object.defineProperty(Kd,"__esModule",{value:!0});var ms=q(),B_=Q(),EN={message:({params:t})=>(0,ms.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,ms._)`{failingKeyword: ${t.ifClause}}`},TN={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:EN,code(t){let{gen:e,parentSchema:n,it:r}=t;n.then===void 0&&n.else===void 0&&(0,B_.checkStrictMode)(r,'"if" without "then" and "else" is ignored');let o=Z_(r,"then"),a=Z_(r,"else");if(!o&&!a)return;let s=e.let("valid",!0),i=e.name("_valid");if(l(),t.reset(),o&&a){let h=e.let("ifClause");t.setParams({ifClause:h}),e.if(i,d("then",h),d("else",h))}else o?e.if(i,d("then")):e.if((0,ms.not)(i),d("else"));t.pass(s,()=>t.error(!0));function l(){let h=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},i);t.mergeEvaluated(h)}function d(h,p){return()=>{let g=t.subschema({keyword:h},i);e.assign(s,i),t.mergeValidEvaluated(g,s),p?e.assign(p,(0,ms._)`${h}`):t.setParams({ifClause:h})}}}};function Z_(t,e){let n=t.schema[e];return n!==void 0&&!(0,B_.alwaysValidSchema)(t,n)}Kd.default=TN});var V_=N(Jd=>{"use strict";u();Object.defineProperty(Jd,"__esModule",{value:!0});var bN=Q(),wN={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:n}){e.if===void 0&&(0,bN.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};Jd.default=wN});var W_=N(Xd=>{"use strict";u();Object.defineProperty(Xd,"__esModule",{value:!0});var vN=kd(),IN=v_(),AN=Ld(),SN=A_(),ON=S_(),NN=P_(),PN=D_(),CN=Gd(),DN=k_(),RN=z_(),xN=U_(),kN=F_(),LN=j_(),$N=G_(),MN=q_(),zN=V_();function UN(t=!1){let e=[xN.default,kN.default,LN.default,$N.default,MN.default,zN.default,PN.default,CN.default,NN.default,DN.default,RN.default];return t?e.push(IN.default,SN.default):e.push(vN.default,AN.default),e.push(ON.default),e}Xd.default=UN});var H_=N(Qd=>{"use strict";u();Object.defineProperty(Qd,"__esModule",{value:!0});var ye=q(),FN={message:({schemaCode:t})=>(0,ye.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ye._)`{format: ${t}}`},jN={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:FN,code(t,e){let{gen:n,data:r,$data:o,schema:a,schemaCode:s,it:i}=t,{opts:l,errSchemaPath:d,schemaEnv:h,self:p}=i;if(!l.validateFormats)return;o?g():f();function g(){let m=n.scopeValue("formats",{ref:p.formats,code:l.code.formats}),y=n.const("fDef",(0,ye._)`${m}[${s}]`),T=n.let("fType"),w=n.let("format");n.if((0,ye._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>n.assign(T,(0,ye._)`${y}.type || "string"`).assign(w,(0,ye._)`${y}.validate`),()=>n.assign(T,(0,ye._)`"string"`).assign(w,y)),t.fail$data((0,ye.or)(I(),S()));function I(){return l.strictSchema===!1?ye.nil:(0,ye._)`${s} && !${w}`}function S(){let D=h.$async?(0,ye._)`(${y}.async ? await ${w}(${r}) : ${w}(${r}))`:(0,ye._)`${w}(${r})`,M=(0,ye._)`(typeof ${w} == "function" ? ${D} : ${w}.test(${r}))`;return(0,ye._)`${w} && ${w} !== true && ${T} === ${e} && !${M}`}}function f(){let m=p.formats[a];if(!m){I();return}if(m===!0)return;let[y,T,w]=S(m);y===e&&t.pass(D());function I(){if(l.strictSchema===!1){p.logger.warn(M());return}throw new Error(M());function M(){return`unknown format "${a}" ignored in schema at path "${d}"`}}function S(M){let xe=M instanceof RegExp?(0,ye.regexpCode)(M):l.code.formats?(0,ye._)`${l.code.formats}${(0,ye.getProperty)(a)}`:void 0,Ye=n.scopeValue("formats",{key:a,ref:M,code:xe});return typeof M=="object"&&!(M instanceof RegExp)?[M.type||"string",M.validate,(0,ye._)`${Ye}.validate`]:["string",M,Ye]}function D(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!h.$async)throw new Error("async format in sync schema");return(0,ye._)`await ${w}(${r})`}return typeof T=="function"?(0,ye._)`${w}(${r})`:(0,ye._)`${w}.test(${r})`}}}};Qd.default=jN});var Y_=N(eu=>{"use strict";u();Object.defineProperty(eu,"__esModule",{value:!0});var GN=H_(),ZN=[GN.default];eu.default=ZN});var K_=N(gr=>{"use strict";u();Object.defineProperty(gr,"__esModule",{value:!0});gr.contentVocabulary=gr.metadataVocabulary=void 0;gr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];gr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var X_=N(tu=>{"use strict";u();Object.defineProperty(tu,"__esModule",{value:!0});var BN=a_(),qN=E_(),VN=W_(),WN=Y_(),J_=K_(),HN=[BN.default,qN.default,(0,VN.default)(),WN.default,J_.metadataVocabulary,J_.contentVocabulary];tu.default=HN});var eg=N(fs=>{"use strict";u();Object.defineProperty(fs,"__esModule",{value:!0});fs.DiscrError=void 0;var Q_;(function(t){t.Tag="tag",t.Mapping="mapping"})(Q_||(fs.DiscrError=Q_={}))});var ng=N(ru=>{"use strict";u();Object.defineProperty(ru,"__esModule",{value:!0});var yr=q(),nu=eg(),tg=Xa(),YN=fo(),KN=Q(),JN={message:({params:{discrError:t,tagName:e}})=>t===nu.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:n}})=>(0,yr._)`{error: ${t}, tag: ${n}, tagValue: ${e}}`},XN={keyword:"discriminator",type:"object",schemaType:"object",error:JN,code(t){let{gen:e,data:n,schema:r,parentSchema:o,it:a}=t,{oneOf:s}=o;if(!a.opts.discriminator)throw new Error("discriminator: requires discriminator option");let i=r.propertyName;if(typeof i!="string")throw new Error("discriminator: requires propertyName");if(r.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let l=e.let("valid",!1),d=e.const("tag",(0,yr._)`${n}${(0,yr.getProperty)(i)}`);e.if((0,yr._)`typeof ${d} == "string"`,()=>h(),()=>t.error(!1,{discrError:nu.DiscrError.Tag,tag:d,tagName:i})),t.ok(l);function h(){let f=g();e.if(!1);for(let m in f)e.elseIf((0,yr._)`${d} === ${m}`),e.assign(l,p(f[m]));e.else(),t.error(!1,{discrError:nu.DiscrError.Mapping,tag:d,tagName:i}),e.endIf()}function p(f){let m=e.name("valid"),y=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(y,yr.Name),m}function g(){var f;let m={},y=w(o),T=!0;for(let D=0;D<s.length;D++){let M=s[D];if(M?.$ref&&!(0,KN.schemaHasRulesButRef)(M,a.self.RULES)){let Ye=M.$ref;if(M=tg.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,Ye),M instanceof tg.SchemaEnv&&(M=M.schema),M===void 0)throw new YN.default(a.opts.uriResolver,a.baseId,Ye)}let xe=(f=M?.properties)===null||f===void 0?void 0:f[i];if(typeof xe!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${i}"`);T=T&&(y||w(M)),I(xe,D)}if(!T)throw new Error(`discriminator: "${i}" must be required`);return m;function w({required:D}){return Array.isArray(D)&&D.includes(i)}function I(D,M){if(D.const)S(D.const,M);else if(D.enum)for(let xe of D.enum)S(xe,M);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function S(D,M){if(typeof D!="string"||D in m)throw new Error(`discriminator: "${i}" values must be unique strings`);m[D]=M}}}};ru.default=XN});var rg=N((hz,QN)=>{QN.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 au=N((ue,ou)=>{"use strict";u();Object.defineProperty(ue,"__esModule",{value:!0});ue.MissingRefError=ue.ValidationError=ue.CodeGen=ue.Name=ue.nil=ue.stringify=ue.str=ue._=ue.KeywordCxt=ue.Ajv=void 0;var eP=Qf(),tP=X_(),nP=ng(),og=rg(),rP=["/properties"],_s="http://json-schema.org/draft-07/schema",Er=class extends eP.default{_addVocabularies(){super._addVocabularies(),tP.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(nP.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(og,rP):og;this.addMetaSchema(e,_s,!1),this.refs["http://json-schema.org/schema"]=_s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_s)?_s:void 0)}};ue.Ajv=Er;ou.exports=ue=Er;ou.exports.Ajv=Er;Object.defineProperty(ue,"__esModule",{value:!0});ue.default=Er;var oP=mo();Object.defineProperty(ue,"KeywordCxt",{enumerable:!0,get:function(){return oP.KeywordCxt}});var Tr=q();Object.defineProperty(ue,"_",{enumerable:!0,get:function(){return Tr._}});Object.defineProperty(ue,"str",{enumerable:!0,get:function(){return Tr.str}});Object.defineProperty(ue,"stringify",{enumerable:!0,get:function(){return Tr.stringify}});Object.defineProperty(ue,"nil",{enumerable:!0,get:function(){return Tr.nil}});Object.defineProperty(ue,"Name",{enumerable:!0,get:function(){return Tr.Name}});Object.defineProperty(ue,"CodeGen",{enumerable:!0,get:function(){return Tr.CodeGen}});var aP=Ka();Object.defineProperty(ue,"ValidationError",{enumerable:!0,get:function(){return aP.default}});var sP=fo();Object.defineProperty(ue,"MissingRefError",{enumerable:!0,get:function(){return sP.default}})});var hg=N(wt=>{"use strict";u();Object.defineProperty(wt,"__esModule",{value:!0});wt.formatNames=wt.fastFormats=wt.fullFormats=void 0;function bt(t,e){return{validate:t,compare:e}}wt.fullFormats={date:bt(cg,lu),time:bt(iu(!0),du),"date-time":bt(ag(!0),dg),"iso-time":bt(iu(),lg),"iso-date-time":bt(ag(),ug),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:hP,"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:EP,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:pP,int32:{type:"number",validate:_P},int64:{type:"number",validate:gP},float:{type:"number",validate:ig},double:{type:"number",validate:ig},password:!0,binary:!0};wt.fastFormats={...wt.fullFormats,date:bt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,lu),time:bt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,du),"date-time":bt(/^\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,dg),"iso-time":bt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,lg),"iso-date-time":bt(/^\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,ug),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};wt.formatNames=Object.keys(wt.fullFormats);function iP(t){return t%4===0&&(t%100!==0||t%400===0)}var cP=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,lP=[0,31,28,31,30,31,30,31,31,30,31,30,31];function cg(t){let e=cP.exec(t);if(!e)return!1;let n=+e[1],r=+e[2],o=+e[3];return r>=1&&r<=12&&o>=1&&o<=(r===2&&iP(n)?29:lP[r])}function lu(t,e){if(t&&e)return t>e?1:t<e?-1:0}var su=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function iu(t){return function(n){let r=su.exec(n);if(!r)return!1;let o=+r[1],a=+r[2],s=+r[3],i=r[4],l=r[5]==="-"?-1:1,d=+(r[6]||0),h=+(r[7]||0);if(d>23||h>59||t&&!i)return!1;if(o<=23&&a<=59&&s<60)return!0;let p=a-h*l,g=o-d*l-(p<0?1:0);return(g===23||g===-1)&&(p===59||p===-1)&&s<61}}function du(t,e){if(!(t&&e))return;let n=new Date("2020-01-01T"+t).valueOf(),r=new Date("2020-01-01T"+e).valueOf();if(n&&r)return n-r}function lg(t,e){if(!(t&&e))return;let n=su.exec(t),r=su.exec(e);if(n&&r)return t=n[1]+n[2]+n[3],e=r[1]+r[2]+r[3],t>e?1:t<e?-1:0}var cu=/t|\s/i;function ag(t){let e=iu(t);return function(r){let o=r.split(cu);return o.length===2&&cg(o[0])&&e(o[1])}}function dg(t,e){if(!(t&&e))return;let n=new Date(t).valueOf(),r=new Date(e).valueOf();if(n&&r)return n-r}function ug(t,e){if(!(t&&e))return;let[n,r]=t.split(cu),[o,a]=e.split(cu),s=lu(n,o);if(s!==void 0)return s||du(r,a)}var dP=/\/|:/,uP=/^(?:[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 hP(t){return dP.test(t)&&uP.test(t)}var sg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function pP(t){return sg.lastIndex=0,sg.test(t)}var mP=-(2**31),fP=2**31-1;function _P(t){return Number.isInteger(t)&&t<=fP&&t>=mP}function gP(t){return Number.isInteger(t)}function ig(){return!0}var yP=/[^\\]\\Z/;function EP(t){if(yP.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var pg=N(br=>{"use strict";u();Object.defineProperty(br,"__esModule",{value:!0});br.formatLimitDefinition=void 0;var TP=au(),pt=q(),Jt=pt.operators,gs={formatMaximum:{okStr:"<=",ok:Jt.LTE,fail:Jt.GT},formatMinimum:{okStr:">=",ok:Jt.GTE,fail:Jt.LT},formatExclusiveMaximum:{okStr:"<",ok:Jt.LT,fail:Jt.GTE},formatExclusiveMinimum:{okStr:">",ok:Jt.GT,fail:Jt.LTE}},bP={message:({keyword:t,schemaCode:e})=>(0,pt.str)`should be ${gs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,pt._)`{comparison: ${gs[t].okStr}, limit: ${e}}`};br.formatLimitDefinition={keyword:Object.keys(gs),type:"string",schemaType:"string",$data:!0,error:bP,code(t){let{gen:e,data:n,schemaCode:r,keyword:o,it:a}=t,{opts:s,self:i}=a;if(!s.validateFormats)return;let l=new TP.KeywordCxt(a,i.RULES.all.format.definition,"format");l.$data?d():h();function d(){let g=e.scopeValue("formats",{ref:i.formats,code:s.code.formats}),f=e.const("fmt",(0,pt._)`${g}[${l.schemaCode}]`);t.fail$data((0,pt.or)((0,pt._)`typeof ${f} != "object"`,(0,pt._)`${f} instanceof RegExp`,(0,pt._)`typeof ${f}.compare != "function"`,p(f)))}function h(){let g=l.schema,f=i.formats[g];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${g}" does not define "compare" function`);let m=e.scopeValue("formats",{key:g,ref:f,code:s.code.formats?(0,pt._)`${s.code.formats}${(0,pt.getProperty)(g)}`:void 0});t.fail$data(p(m))}function p(g){return(0,pt._)`${g}.compare(${n}, ${r}) ${gs[o].fail} 0`}},dependencies:["format"]};var wP=t=>(t.addKeyword(br.formatLimitDefinition),t);br.default=wP});var gg=N((Po,_g)=>{"use strict";u();Object.defineProperty(Po,"__esModule",{value:!0});var wr=hg(),vP=pg(),uu=q(),mg=new uu.Name("fullFormats"),IP=new uu.Name("fastFormats"),hu=(t,e={keywords:!0})=>{if(Array.isArray(e))return fg(t,e,wr.fullFormats,mg),t;let[n,r]=e.mode==="fast"?[wr.fastFormats,IP]:[wr.fullFormats,mg],o=e.formats||wr.formatNames;return fg(t,o,n,r),e.keywords&&(0,vP.default)(t),t};hu.get=(t,e="full")=>{let r=(e==="fast"?wr.fastFormats:wr.fullFormats)[t];if(!r)throw new Error(`Unknown format "${t}"`);return r};function fg(t,e,n,r){var o,a;(o=(a=t.opts.code).formats)!==null&&o!==void 0||(a.formats=(0,uu._)`require("ajv-formats/dist/formats").${r}`);for(let s of e)t.addFormat(s,n[s])}_g.exports=Po=hu;Object.defineProperty(Po,"__esModule",{value:!0});Po.default=hu});u();import{appendFileSync as cy,existsSync as Lo,mkdirSync as ly,renameSync as Nu,statSync as Ls,unlinkSync as $s}from"fs";import $o from"path";var Ms=null;function hC(t){Ms=t}var Ar={debug:0,info:1,notice:2,warning:3,error:4,critical:5,alert:6,emergency:7},dy=t=>t!==void 0&&["1","true","on","yes"].includes(t.trim().toLowerCase()),uy=()=>(process.env.MCP_LOG_LEVEL??"").trim().toLowerCase()==="verbose",hy=()=>uy()||dy(process.env.MCP_LOG_GQL),py=()=>{if(hy())return Ar.debug;let t=process.env.MCP_LOG_LEVEL?.trim().toLowerCase();return t&&t in Ar?Ar[t]:Ar.info},my=50*1024*1024,fy=5,Pu=1,_y=6e4,Cu=(t,e)=>{let n=t?parseInt(t,10):NaN;return Number.isFinite(n)&&n>0?n:e},gy=()=>{let t=process.env.MCP_LOG_MAX_AGE_DAYS;if(t===void 0)return Pu*864e5;let e=Number(t);return Number.isFinite(e)&&e>=0?e*864e5:Pu*864e5};function yy(){if(process.env.MCP_LOG_DIR)return $o.resolve(process.env.MCP_LOG_DIR);let t=process.env.WORKSPACE_ROOT||process.cwd();return $o.join(t,`.${ko}`,"logs")}function Ey(){return $o.join(yy(),`${ko}.log`)}var Du=!1,zs=0;function Ty(t,e){try{let n=`${t}.${e}`;Lo(n)&&$s(n);for(let r=e-1;r>=1;r--){let o=`${t}.${r}`;Lo(o)&&Nu(o,`${t}.${r+1}`)}Nu(t,`${t}.1`)}catch{}}function by(t,e){zs=Date.now();let n=gy();if(n<=0)return;let r=zs-n;for(let o=1;o<=e;o++){let a=`${t}.${o}`;try{Lo(a)&&Ls(a).mtimeMs<r&&$s(a)}catch{}}try{Lo(t)&&Ls(t).mtimeMs<r&&$s(t)}catch{}}function wy(t){let e=Cu(process.env.MCP_LOG_MAX_FILES,fy);Date.now()-zs>=_y&&by(t,e);let n;try{n=Ls(t).size}catch{return}n>=Cu(process.env.MCP_LOG_MAX_BYTES,my)&&Ty(t,e)}function vy(t,e){if(!(Du||process.env.MCP_LOG_FILE==="off"))try{let n=Ey();ly($o.dirname(n),{recursive:!0}),wy(n),cy(n,`${new Date().toISOString()} [${t.toUpperCase()}] ${e}
11
+ `)}catch{Du=!0}}function xt(t,e,...n){if(Ar[t]<py())return;let r=`[${ko}] ${e} ${n.length>0?JSON.stringify(n):""}`;if(vy(t,r),Ms)try{Ms.server.sendLoggingMessage({level:t,data:r}).catch(o=>{console.error(`[${t.toUpperCase()}] ${r}`)});return}catch{}console.error(`[${t.toUpperCase()}] ${r}`)}var pC={debug:(t,...e)=>xt("debug",t,...e),info:(t,...e)=>xt("info",t,...e),notice:(t,...e)=>xt("notice",t,...e),warn:(t,...e)=>xt("warning",t,...e),error:(t,...e)=>xt("error",t,...e),critical:(t,...e)=>xt("critical",t,...e)};u();var Us=Ou,Mo=null;function jn(){if(Mo)return Mo;let t=(process.env.ZION_ENV??process.env.MCP_ENV)?.trim().toLowerCase(),e=Su;if(t){if(!Us[t])throw new Error(`Unknown environment "${t}". Known: ${Object.keys(Us).join(", ")}.`);e=t}let n=Us[e];return Mo={name:e,authEndpoint:process.env.BACKEND_AUTH_ENDPOINT||n.authEndpoint,apiBaseUrl:process.env.BACKEND_API_BASE||n.apiBaseUrl,zeroApiUrlTemplate:process.env.ZERO_API_URL_TEMPLATE||n.zeroApiUrlTemplate,logApiUrlTemplate:process.env.LOG_API_URL_TEMPLATE||n.logApiUrlTemplate,editorBaseUrl:process.env.EDITOR_BASE_URL||n.editorBaseUrl},Mo}var Ru=!1;function yC(){if(Ru)return;Ru=!0;let t=jn();xt("info",`Backend environment: ${t.name} (api=${t.apiBaseUrl})`)}u();u();u();u();var c={};ks(c,{BRAND:()=>Yy,DIRTY:()=>en,EMPTY_PATH:()=>Oy,INVALID:()=>z,NEVER:()=>RE,OK:()=>Pe,ParseStatus:()=>ve,Schema:()=>B,ZodAny:()=>$t,ZodArray:()=>St,ZodBigInt:()=>nn,ZodBoolean:()=>rn,ZodBranded:()=>Or,ZodCatch:()=>fn,ZodDate:()=>on,ZodDefault:()=>mn,ZodDiscriminatedUnion:()=>Fo,ZodEffects:()=>Je,ZodEnum:()=>hn,ZodError:()=>ze,ZodFirstPartyTypeKind:()=>A,ZodFunction:()=>Go,ZodIntersection:()=>ln,ZodIssueCode:()=>v,ZodLazy:()=>dn,ZodLiteral:()=>un,ZodMap:()=>Wn,ZodNaN:()=>Yn,ZodNativeEnum:()=>pn,ZodNever:()=>at,ZodNull:()=>sn,ZodNullable:()=>_t,ZodNumber:()=>tn,ZodObject:()=>Fe,ZodOptional:()=>Ue,ZodParsedType:()=>P,ZodPipeline:()=>Nr,ZodPromise:()=>Mt,ZodReadonly:()=>_n,ZodRecord:()=>jo,ZodSchema:()=>B,ZodSet:()=>Hn,ZodString:()=>Lt,ZodSymbol:()=>qn,ZodTransformer:()=>Je,ZodTuple:()=>ft,ZodType:()=>B,ZodUndefined:()=>an,ZodUnion:()=>cn,ZodUnknown:()=>At,ZodVoid:()=>Vn,addIssueToContext:()=>O,any:()=>oE,array:()=>cE,bigint:()=>Qy,boolean:()=>Zu,coerce:()=>DE,custom:()=>Fu,date:()=>eE,datetimeRegex:()=>zu,defaultErrorMap:()=>vt,discriminatedUnion:()=>uE,effect:()=>vE,enum:()=>TE,function:()=>gE,getErrorMap:()=>Gn,getParsedType:()=>mt,instanceof:()=>Jy,intersection:()=>hE,isAborted:()=>zo,isAsync:()=>Zn,isDirty:()=>Uo,isValid:()=>kt,late:()=>Ky,lazy:()=>yE,literal:()=>EE,makeIssue:()=>Sr,map:()=>fE,nan:()=>Xy,nativeEnum:()=>bE,never:()=>sE,null:()=>rE,nullable:()=>AE,number:()=>Gu,object:()=>Zs,objectUtil:()=>Fs,oboolean:()=>CE,onumber:()=>PE,optional:()=>IE,ostring:()=>NE,pipeline:()=>OE,preprocess:()=>SE,promise:()=>wE,quotelessJson:()=>Iy,record:()=>mE,set:()=>_E,setErrorMap:()=>Sy,strictObject:()=>lE,string:()=>ju,symbol:()=>tE,transformer:()=>vE,tuple:()=>pE,undefined:()=>nE,union:()=>dE,unknown:()=>aE,util:()=>H,void:()=>iE});u();u();u();u();u();var H;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function n(o){throw new Error}t.assertNever=n,t.arrayToEnum=o=>{let a={};for(let s of o)a[s]=s;return a},t.getValidEnumValues=o=>{let a=t.objectKeys(o).filter(i=>typeof o[o[i]]!="number"),s={};for(let i of a)s[i]=o[i];return t.objectValues(s)},t.objectValues=o=>t.objectKeys(o).map(function(a){return o[a]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let a=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&a.push(s);return a},t.find=(o,a)=>{for(let s of o)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function r(o,a=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(o,a)=>typeof a=="bigint"?a.toString():a})(H||(H={}));var Fs;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Fs||(Fs={}));var P=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mt=t=>{switch(typeof t){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(t)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(t)?P.array:t===null?P.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?P.promise:typeof Map<"u"&&t instanceof Map?P.map:typeof Set<"u"&&t instanceof Set?P.set:typeof Date<"u"&&t instanceof Date?P.date:P.object;default:return P.unknown}};var v=H.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Iy=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),ze=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(a){return a.message},r={_errors:[]},o=a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let i=r,l=0;for(;l<s.path.length;){let d=s.path[l];l===s.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(n(s))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}};return o(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let o of this.issues)if(o.path.length>0){let a=o.path[0];n[a]=n[a]||[],n[a].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};ze.create=t=>new ze(t);var Ay=(t,e)=>{let n;switch(t.code){case v.invalid_type:t.received===P.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case v.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,H.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:n=`Unrecognized key(s) in object: ${H.joinValues(t.keys,", ")}`;break;case v.invalid_union:n="Invalid input";break;case v.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${H.joinValues(t.options)}`;break;case v.invalid_enum_value:n=`Invalid enum value. Expected ${H.joinValues(t.options)}, received '${t.received}'`;break;case v.invalid_arguments:n="Invalid function arguments";break;case v.invalid_return_type:n="Invalid function return type";break;case v.invalid_date:n="Invalid date";break;case v.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:H.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case v.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case v.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case v.custom:n="Invalid input";break;case v.invalid_intersection_types:n="Intersection results could not be merged";break;case v.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case v.not_finite:n="Number must be finite";break;default:n=e.defaultError,H.assertNever(t)}return{message:n}},vt=Ay;var xu=vt;function Sy(t){xu=t}function Gn(){return xu}u();var Sr=t=>{let{data:e,path:n,errorMaps:r,issueData:o}=t,a=[...n,...o.path||[]],s={...o,path:a};if(o.message!==void 0)return{...o,path:a,message:o.message};let i="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)i=d(s,{data:e,defaultError:i}).message;return{...o,path:a,message:i}},Oy=[];function O(t,e){let n=Gn(),r=Sr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===vt?void 0:vt].filter(o=>!!o)});t.common.issues.push(r)}var ve=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let o of n){if(o.status==="aborted")return z;o.status==="dirty"&&e.dirty(),r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let o of n){let a=await o.key,s=await o.value;r.push({key:a,value:s})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let o of n){let{key:a,value:s}=o;if(a.status==="aborted"||s.status==="aborted")return z;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(r[a.value]=s.value)}return{status:e.value,value:r}}},z=Object.freeze({status:"aborted"}),en=t=>({status:"dirty",value:t}),Pe=t=>({status:"valid",value:t}),zo=t=>t.status==="aborted",Uo=t=>t.status==="dirty",kt=t=>t.status==="valid",Zn=t=>typeof Promise<"u"&&t instanceof Promise;u();u();var R;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(R||(R={}));var Ke=class{constructor(e,n,r,o){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ku=(t,e)=>{if(kt(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new ze(t.common.issues);return this._error=n,this._error}}};function G(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:o}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(s,i)=>{let{message:l}=t;return s.code==="invalid_enum_value"?{message:l??i.defaultError}:typeof i.data>"u"?{message:l??r??i.defaultError}:s.code!=="invalid_type"?{message:i.defaultError}:{message:l??n??i.defaultError}},description:o}}var B=class{get description(){return this._def.description}_getType(e){return mt(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:mt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ve,ctx:{common:e.parent.common,data:e.data,parsedType:mt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Zn(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mt(e)},o=this._parseSync({data:e,path:r.path,parent:r});return ku(r,o)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mt(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return kt(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>kt(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mt(e)},o=this._parse({data:e,path:r.path,parent:r}),a=await(Zn(o)?o:Promise.resolve(o));return ku(r,a)}refine(e,n){let r=o=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(o):n;return this._refinement((o,a)=>{let s=e(o),i=()=>a.addIssue({code:v.custom,...r(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(i(),!1)):s?!0:(i(),!1)})}refinement(e,n){return this._refinement((r,o)=>e(r)?!0:(o.addIssue(typeof n=="function"?n(r,o):n),!1))}_refinement(e){return new Je({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ue.create(this,this._def)}nullable(){return _t.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return St.create(this)}promise(){return Mt.create(this,this._def)}or(e){return cn.create([this,e],this._def)}and(e){return ln.create(this,e,this._def)}transform(e){return new Je({...G(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new mn({...G(this._def),innerType:this,defaultValue:n,typeName:A.ZodDefault})}brand(){return new Or({typeName:A.ZodBranded,type:this,...G(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new fn({...G(this._def),innerType:this,catchValue:n,typeName:A.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Nr.create(this,e)}readonly(){return _n.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ny=/^c[^\s-]{8,}$/i,Py=/^[0-9a-z]+$/,Cy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Dy=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Ry=/^[a-z0-9_-]{21}$/i,xy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ky=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ly=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$y="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",js,My=/^(?:(?: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])$/,zy=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Uy=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Fy=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$u="((\\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])))",Zy=new RegExp(`^${$u}$`);function Mu(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function By(t){return new RegExp(`^${Mu(t)}$`)}function zu(t){let e=`${$u}T${Mu(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function qy(t,e){return!!((e==="v4"||!e)&&My.test(t)||(e==="v6"||!e)&&Uy.test(t))}function Vy(t,e){if(!xy.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),o=JSON.parse(atob(r));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Wy(t,e){return!!((e==="v4"||!e)&&zy.test(t)||(e==="v6"||!e)&&Fy.test(t))}var Lt=class t extends B{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==P.string){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_type,expected:P.string,received:a.parsedType}),z}let r=new ve,o;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(o=this._getOrReturnCtx(e,o),O(o,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(o=this._getOrReturnCtx(e,o),O(o,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,i=e.data.length<a.value;(s||i)&&(o=this._getOrReturnCtx(e,o),s?O(o,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&O(o,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Ly.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"email",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")js||(js=new RegExp($y,"u")),js.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"emoji",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Dy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"uuid",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Ry.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"nanoid",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Ny.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"cuid",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Py.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"cuid2",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Cy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"ulid",code:v.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),O(o,{validation:"url",code:v.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"regex",code:v.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?zu(a).test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?Zy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?By(a).test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{code:v.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?ky.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"duration",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?qy(e.data,a.version)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"ip",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?Vy(e.data,a.alg)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"jwt",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?Wy(e.data,a.version)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"cidr",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?jy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"base64",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?Gy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"base64url",code:v.invalid_string,message:a.message}),r.dirty()):H.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(o=>e.test(o),{validation:n,code:v.invalid_string,...R.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...R.errToObj(e)})}url(e){return this._addCheck({kind:"url",...R.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...R.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...R.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...R.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...R.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...R.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...R.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...R.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...R.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...R.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...R.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...R.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...R.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...R.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...R.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...R.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...R.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...R.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...R.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...R.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...R.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...R.errToObj(n)})}nonempty(e){return this.min(1,R.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Lt.create=t=>new Lt({checks:[],typeName:A.ZodString,coerce:t?.coerce??!1,...G(t)});function Hy(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,a=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return a%s/10**o}var tn=class t extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==P.number){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_type,expected:P.number,received:a.parsedType}),z}let r,o=new ve;for(let a of this._def.checks)a.kind==="int"?H.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),O(r,{code:v.invalid_type,expected:"integer",received:"float",message:a.message}),o.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),o.dirty()):a.kind==="multipleOf"?Hy(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),O(r,{code:v.not_finite,message:a.message}),o.dirty()):H.assertNever(a);return{status:o.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,R.toString(n))}gt(e,n){return this.setLimit("min",e,!1,R.toString(n))}lte(e,n){return this.setLimit("max",e,!0,R.toString(n))}lt(e,n){return this.setLimit("max",e,!1,R.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:R.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:R.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:R.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&H.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};tn.create=t=>new tn({checks:[],typeName:A.ZodNumber,coerce:t?.coerce||!1,...G(t)});var nn=class t extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==P.bigint)return this._getInvalidInput(e);let r,o=new ve;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),o.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),O(r,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),o.dirty()):H.assertNever(a);return{status:o.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return O(n,{code:v.invalid_type,expected:P.bigint,received:n.parsedType}),z}gte(e,n){return this.setLimit("min",e,!0,R.toString(n))}gt(e,n){return this.setLimit("min",e,!1,R.toString(n))}lte(e,n){return this.setLimit("max",e,!0,R.toString(n))}lt(e,n){return this.setLimit("max",e,!1,R.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:R.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:R.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};nn.create=t=>new nn({checks:[],typeName:A.ZodBigInt,coerce:t?.coerce??!1,...G(t)});var rn=class extends B{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==P.boolean){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.boolean,received:r.parsedType}),z}return Pe(e.data)}};rn.create=t=>new rn({typeName:A.ZodBoolean,coerce:t?.coerce||!1,...G(t)});var on=class t extends B{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==P.date){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_type,expected:P.date,received:a.parsedType}),z}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_date}),z}let r=new ve,o;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(o=this._getOrReturnCtx(e,o),O(o,{code:v.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(o=this._getOrReturnCtx(e,o),O(o,{code:v.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):H.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:R.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:R.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};on.create=t=>new on({checks:[],coerce:t?.coerce||!1,typeName:A.ZodDate,...G(t)});var qn=class extends B{_parse(e){if(this._getType(e)!==P.symbol){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.symbol,received:r.parsedType}),z}return Pe(e.data)}};qn.create=t=>new qn({typeName:A.ZodSymbol,...G(t)});var an=class extends B{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.undefined,received:r.parsedType}),z}return Pe(e.data)}};an.create=t=>new an({typeName:A.ZodUndefined,...G(t)});var sn=class extends B{_parse(e){if(this._getType(e)!==P.null){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.null,received:r.parsedType}),z}return Pe(e.data)}};sn.create=t=>new sn({typeName:A.ZodNull,...G(t)});var $t=class extends B{constructor(){super(...arguments),this._any=!0}_parse(e){return Pe(e.data)}};$t.create=t=>new $t({typeName:A.ZodAny,...G(t)});var At=class extends B{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Pe(e.data)}};At.create=t=>new At({typeName:A.ZodUnknown,...G(t)});var at=class extends B{_parse(e){let n=this._getOrReturnCtx(e);return O(n,{code:v.invalid_type,expected:P.never,received:n.parsedType}),z}};at.create=t=>new at({typeName:A.ZodNever,...G(t)});var Vn=class extends B{_parse(e){if(this._getType(e)!==P.undefined){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.void,received:r.parsedType}),z}return Pe(e.data)}};Vn.create=t=>new Vn({typeName:A.ZodVoid,...G(t)});var St=class t extends B{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),o=this._def;if(n.parsedType!==P.array)return O(n,{code:v.invalid_type,expected:P.array,received:n.parsedType}),z;if(o.exactLength!==null){let s=n.data.length>o.exactLength.value,i=n.data.length<o.exactLength.value;(s||i)&&(O(n,{code:s?v.too_big:v.too_small,minimum:i?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty())}if(o.minLength!==null&&n.data.length<o.minLength.value&&(O(n,{code:v.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()),o.maxLength!==null&&n.data.length>o.maxLength.value&&(O(n,{code:v.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,i)=>o.type._parseAsync(new Ke(n,s,n.path,i)))).then(s=>ve.mergeArray(r,s));let a=[...n.data].map((s,i)=>o.type._parseSync(new Ke(n,s,n.path,i)));return ve.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:R.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:R.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:R.toString(n)}})}nonempty(e){return this.min(1,e)}};St.create=(t,e)=>new St({type:t,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...G(e)});function Bn(t){if(t instanceof Fe){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Ue.create(Bn(r))}return new Fe({...t._def,shape:()=>e})}else return t instanceof St?new St({...t._def,type:Bn(t.element)}):t instanceof Ue?Ue.create(Bn(t.unwrap())):t instanceof _t?_t.create(Bn(t.unwrap())):t instanceof ft?ft.create(t.items.map(e=>Bn(e))):t}var Fe=class t extends B{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=H.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==P.object){let d=this._getOrReturnCtx(e);return O(d,{code:v.invalid_type,expected:P.object,received:d.parsedType}),z}let{status:r,ctx:o}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof at&&this._def.unknownKeys==="strip"))for(let d in o.data)s.includes(d)||i.push(d);let l=[];for(let d of s){let h=a[d],p=o.data[d];l.push({key:{status:"valid",value:d},value:h._parse(new Ke(o,p,o.path,d)),alwaysSet:d in o.data})}if(this._def.catchall instanceof at){let d=this._def.unknownKeys;if(d==="passthrough")for(let h of i)l.push({key:{status:"valid",value:h},value:{status:"valid",value:o.data[h]}});else if(d==="strict")i.length>0&&(O(o,{code:v.unrecognized_keys,keys:i}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let h of i){let p=o.data[h];l.push({key:{status:"valid",value:h},value:d._parse(new Ke(o,p,o.path,h)),alwaysSet:h in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let d=[];for(let h of l){let p=await h.key,g=await h.value;d.push({key:p,value:g,alwaysSet:h.alwaysSet})}return d}).then(d=>ve.mergeObjectSync(r,d)):ve.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return R.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let o=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:R.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of H.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of H.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Bn(this)}partial(e){let n={};for(let r of H.objectKeys(this.shape)){let o=this.shape[r];e&&!e[r]?n[r]=o:n[r]=o.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of H.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Ue;)a=a._def.innerType;n[r]=a}return new t({...this._def,shape:()=>n})}keyof(){return Uu(H.objectKeys(this.shape))}};Fe.create=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strip",catchall:at.create(),typeName:A.ZodObject,...G(e)});Fe.strictCreate=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strict",catchall:at.create(),typeName:A.ZodObject,...G(e)});Fe.lazycreate=(t,e)=>new Fe({shape:t,unknownKeys:"strip",catchall:at.create(),typeName:A.ZodObject,...G(e)});var cn=class extends B{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function o(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(i=>new ze(i.ctx.common.issues));return O(n,{code:v.invalid_union,unionErrors:s}),z}if(n.common.async)return Promise.all(r.map(async a=>{let s={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(o);{let a,s=[];for(let l of r){let d={...n,common:{...n.common,issues:[]},parent:null},h=l._parseSync({data:n.data,path:n.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(l=>new ze(l));return O(n,{code:v.invalid_union,unionErrors:i}),z}}get options(){return this._def.options}};cn.create=(t,e)=>new cn({options:t,typeName:A.ZodUnion,...G(e)});var It=t=>t instanceof dn?It(t.schema):t instanceof Je?It(t.innerType()):t instanceof un?[t.value]:t instanceof hn?t.options:t instanceof pn?H.objectValues(t.enum):t instanceof mn?It(t._def.innerType):t instanceof an?[void 0]:t instanceof sn?[null]:t instanceof Ue?[void 0,...It(t.unwrap())]:t instanceof _t?[null,...It(t.unwrap())]:t instanceof Or||t instanceof _n?It(t.unwrap()):t instanceof fn?It(t._def.innerType):[],Fo=class t extends B{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==P.object)return O(n,{code:v.invalid_type,expected:P.object,received:n.parsedType}),z;let r=this.discriminator,o=n.data[r],a=this.optionsMap.get(o);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(O(n,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let o=new Map;for(let a of n){let s=It(a.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of s){if(o.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);o.set(i,a)}}return new t({typeName:A.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:o,...G(r)})}};function Gs(t,e){let n=mt(t),r=mt(e);if(t===e)return{valid:!0,data:t};if(n===P.object&&r===P.object){let o=H.objectKeys(e),a=H.objectKeys(t).filter(i=>o.indexOf(i)!==-1),s={...t,...e};for(let i of a){let l=Gs(t[i],e[i]);if(!l.valid)return{valid:!1};s[i]=l.data}return{valid:!0,data:s}}else if(n===P.array&&r===P.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let a=0;a<t.length;a++){let s=t[a],i=e[a],l=Gs(s,i);if(!l.valid)return{valid:!1};o.push(l.data)}return{valid:!0,data:o}}else return n===P.date&&r===P.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ln=class extends B{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=(a,s)=>{if(zo(a)||zo(s))return z;let i=Gs(a.value,s.value);return i.valid?((Uo(a)||Uo(s))&&n.dirty(),{status:n.value,value:i.data}):(O(r,{code:v.invalid_intersection_types}),z)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,s])=>o(a,s)):o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ln.create=(t,e,n)=>new ln({left:t,right:e,typeName:A.ZodIntersection,...G(n)});var ft=class t extends B{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.array)return O(r,{code:v.invalid_type,expected:P.array,received:r.parsedType}),z;if(r.data.length<this._def.items.length)return O(r,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z;!this._def.rest&&r.data.length>this._def.items.length&&(O(r,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let a=[...r.data].map((s,i)=>{let l=this._def.items[i]||this._def.rest;return l?l._parse(new Ke(r,s,r.path,i)):null}).filter(s=>!!s);return r.common.async?Promise.all(a).then(s=>ve.mergeArray(n,s)):ve.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};ft.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ft({items:t,typeName:A.ZodTuple,rest:null,...G(e)})};var jo=class t extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.object)return O(r,{code:v.invalid_type,expected:P.object,received:r.parsedType}),z;let o=[],a=this._def.keyType,s=this._def.valueType;for(let i in r.data)o.push({key:a._parse(new Ke(r,i,r.path,i)),value:s._parse(new Ke(r,r.data[i],r.path,i)),alwaysSet:i in r.data});return r.common.async?ve.mergeObjectAsync(n,o):ve.mergeObjectSync(n,o)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof B?new t({keyType:e,valueType:n,typeName:A.ZodRecord,...G(r)}):new t({keyType:Lt.create(),valueType:e,typeName:A.ZodRecord,...G(n)})}},Wn=class extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.map)return O(r,{code:v.invalid_type,expected:P.map,received:r.parsedType}),z;let o=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map(([i,l],d)=>({key:o._parse(new Ke(r,i,r.path,[d,"key"])),value:a._parse(new Ke(r,l,r.path,[d,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let l of s){let d=await l.key,h=await l.value;if(d.status==="aborted"||h.status==="aborted")return z;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),i.set(d.value,h.value)}return{status:n.value,value:i}})}else{let i=new Map;for(let l of s){let d=l.key,h=l.value;if(d.status==="aborted"||h.status==="aborted")return z;(d.status==="dirty"||h.status==="dirty")&&n.dirty(),i.set(d.value,h.value)}return{status:n.value,value:i}}}};Wn.create=(t,e,n)=>new Wn({valueType:e,keyType:t,typeName:A.ZodMap,...G(n)});var Hn=class t extends B{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==P.set)return O(r,{code:v.invalid_type,expected:P.set,received:r.parsedType}),z;let o=this._def;o.minSize!==null&&r.data.size<o.minSize.value&&(O(r,{code:v.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),n.dirty()),o.maxSize!==null&&r.data.size>o.maxSize.value&&(O(r,{code:v.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),n.dirty());let a=this._def.valueType;function s(l){let d=new Set;for(let h of l){if(h.status==="aborted")return z;h.status==="dirty"&&n.dirty(),d.add(h.value)}return{status:n.value,value:d}}let i=[...r.data.values()].map((l,d)=>a._parse(new Ke(r,l,r.path,d)));return r.common.async?Promise.all(i).then(l=>s(l)):s(i)}min(e,n){return new t({...this._def,minSize:{value:e,message:R.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:R.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Hn.create=(t,e)=>new Hn({valueType:t,minSize:null,maxSize:null,typeName:A.ZodSet,...G(e)});var Go=class t extends B{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==P.function)return O(n,{code:v.invalid_type,expected:P.function,received:n.parsedType}),z;function r(i,l){return Sr({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Gn(),vt].filter(d=>!!d),issueData:{code:v.invalid_arguments,argumentsError:l}})}function o(i,l){return Sr({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Gn(),vt].filter(d=>!!d),issueData:{code:v.invalid_return_type,returnTypeError:l}})}let a={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof Mt){let i=this;return Pe(async function(...l){let d=new ze([]),h=await i._def.args.parseAsync(l,a).catch(f=>{throw d.addIssue(r(l,f)),d}),p=await Reflect.apply(s,this,h);return await i._def.returns._def.type.parseAsync(p,a).catch(f=>{throw d.addIssue(o(p,f)),d})})}else{let i=this;return Pe(function(...l){let d=i._def.args.safeParse(l,a);if(!d.success)throw new ze([r(l,d.error)]);let h=Reflect.apply(s,this,d.data),p=i._def.returns.safeParse(h,a);if(!p.success)throw new ze([o(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:ft.create(e).rest(At.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||ft.create([]).rest(At.create()),returns:n||At.create(),typeName:A.ZodFunction,...G(r)})}},dn=class extends B{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};dn.create=(t,e)=>new dn({getter:t,typeName:A.ZodLazy,...G(e)});var un=class extends B{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return O(n,{received:n.data,code:v.invalid_literal,expected:this._def.value}),z}return{status:"valid",value:e.data}}get value(){return this._def.value}};un.create=(t,e)=>new un({value:t,typeName:A.ZodLiteral,...G(e)});function Uu(t,e){return new hn({values:t,typeName:A.ZodEnum,...G(e)})}var hn=class t extends B{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return O(n,{expected:H.joinValues(r),received:n.parsedType,code:v.invalid_type}),z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return O(n,{received:n.data,code:v.invalid_enum_value,options:r}),z}return Pe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};hn.create=Uu;var pn=class extends B{_parse(e){let n=H.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==P.string&&r.parsedType!==P.number){let o=H.objectValues(n);return O(r,{expected:H.joinValues(o),received:r.parsedType,code:v.invalid_type}),z}if(this._cache||(this._cache=new Set(H.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=H.objectValues(n);return O(r,{received:r.data,code:v.invalid_enum_value,options:o}),z}return Pe(e.data)}get enum(){return this._def.values}};pn.create=(t,e)=>new pn({values:t,typeName:A.ZodNativeEnum,...G(e)});var Mt=class extends B{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==P.promise&&n.common.async===!1)return O(n,{code:v.invalid_type,expected:P.promise,received:n.parsedType}),z;let r=n.parsedType===P.promise?n.data:Promise.resolve(n.data);return Pe(r.then(o=>this._def.type.parseAsync(o,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Mt.create=(t,e)=>new Mt({type:t,typeName:A.ZodPromise,...G(e)});var Je=class extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),o=this._def.effect||null,a={addIssue:s=>{O(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),o.type==="preprocess"){let s=o.transform(r.data,a);if(r.common.async)return Promise.resolve(s).then(async i=>{if(n.value==="aborted")return z;let l=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});return l.status==="aborted"?z:l.status==="dirty"?en(l.value):n.value==="dirty"?en(l.value):l});{if(n.value==="aborted")return z;let i=this._def.schema._parseSync({data:s,path:r.path,parent:r});return i.status==="aborted"?z:i.status==="dirty"?en(i.value):n.value==="dirty"?en(i.value):i}}if(o.type==="refinement"){let s=i=>{let l=o.refinement(i,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?z:(i.status==="dirty"&&n.dirty(),s(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>i.status==="aborted"?z:(i.status==="dirty"&&n.dirty(),s(i.value).then(()=>({status:n.value,value:i.value}))))}if(o.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!kt(s))return z;let i=o.transform(s.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>kt(s)?Promise.resolve(o.transform(s.value,a)).then(i=>({status:n.value,value:i})):z);H.assertNever(o)}};Je.create=(t,e,n)=>new Je({schema:t,typeName:A.ZodEffects,effect:e,...G(n)});Je.createWithPreprocess=(t,e,n)=>new Je({schema:e,effect:{type:"preprocess",transform:t},typeName:A.ZodEffects,...G(n)});var Ue=class extends B{_parse(e){return this._getType(e)===P.undefined?Pe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ue.create=(t,e)=>new Ue({innerType:t,typeName:A.ZodOptional,...G(e)});var _t=class extends B{_parse(e){return this._getType(e)===P.null?Pe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};_t.create=(t,e)=>new _t({innerType:t,typeName:A.ZodNullable,...G(e)});var mn=class extends B{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===P.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};mn.create=(t,e)=>new mn({innerType:t,typeName:A.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...G(e)});var fn=class extends B{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Zn(o)?o.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ze(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ze(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};fn.create=(t,e)=>new fn({innerType:t,typeName:A.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...G(e)});var Yn=class extends B{_parse(e){if(this._getType(e)!==P.nan){let r=this._getOrReturnCtx(e);return O(r,{code:v.invalid_type,expected:P.nan,received:r.parsedType}),z}return{status:"valid",value:e.data}}};Yn.create=t=>new Yn({typeName:A.ZodNaN,...G(t)});var Yy=Symbol("zod_brand"),Or=class extends B{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Nr=class t extends B{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?z:a.status==="dirty"?(n.dirty(),en(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?z:o.status==="dirty"?(n.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:A.ZodPipeline})}},_n=class extends B{_parse(e){let n=this._def.innerType._parse(e),r=o=>(kt(o)&&(o.value=Object.freeze(o.value)),o);return Zn(n)?n.then(o=>r(o)):r(n)}unwrap(){return this._def.innerType}};_n.create=(t,e)=>new _n({innerType:t,typeName:A.ZodReadonly,...G(e)});function Lu(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Fu(t,e={},n){return t?$t.create().superRefine((r,o)=>{let a=t(r);if(a instanceof Promise)return a.then(s=>{if(!s){let i=Lu(e,r),l=i.fatal??n??!0;o.addIssue({code:"custom",...i,fatal:l})}});if(!a){let s=Lu(e,r),i=s.fatal??n??!0;o.addIssue({code:"custom",...s,fatal:i})}}):$t.create()}var Ky={object:Fe.lazycreate},A;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(A||(A={}));var Jy=(t,e={message:`Input not instance of ${t.name}`})=>Fu(n=>n instanceof t,e),ju=Lt.create,Gu=tn.create,Xy=Yn.create,Qy=nn.create,Zu=rn.create,eE=on.create,tE=qn.create,nE=an.create,rE=sn.create,oE=$t.create,aE=At.create,sE=at.create,iE=Vn.create,cE=St.create,Zs=Fe.create,lE=Fe.strictCreate,dE=cn.create,uE=Fo.create,hE=ln.create,pE=ft.create,mE=jo.create,fE=Wn.create,_E=Hn.create,gE=Go.create,yE=dn.create,EE=un.create,TE=hn.create,bE=pn.create,wE=Mt.create,vE=Je.create,IE=Ue.create,AE=_t.create,SE=Je.createWithPreprocess,OE=Nr.create,NE=()=>ju().optional(),PE=()=>Gu().optional(),CE=()=>Zu().optional(),DE={string:(t=>Lt.create({...t,coerce:!0})),number:(t=>tn.create({...t,coerce:!0})),boolean:(t=>rn.create({...t,coerce:!0})),bigint:(t=>nn.create({...t,coerce:!0})),date:(t=>on.create({...t,coerce:!0}))};var RE=z;u();u();u();var xE=Object.freeze({status:"aborted"});function b(t,e,n){function r(i,l){var d;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(d=i._zod).traits??(d.traits=new Set),i._zod.traits.add(t),e(i,l);for(let h in s.prototype)h in i||Object.defineProperty(i,h,{value:s.prototype[h].bind(i)});i._zod.constr=s,i._zod.def=l}let o=n?.Parent??Object;class a extends o{}Object.defineProperty(a,"name",{value:t});function s(i){var l;let d=n?.Parent?new a:this;r(d,i),(l=d._zod).deferred??(l.deferred=[]);for(let h of d._zod.deferred)h();return d}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:i=>n?.Parent&&i instanceof n.Parent?!0:i?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var kE=Symbol("zod_brand"),Ot=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Zo={};function Ve(t){return t&&Object.assign(Zo,t),Zo}u();u();var Y={};ks(Y,{BIGINT_FORMAT_RANGES:()=>qu,Class:()=>qs,NUMBER_FORMAT_RANGES:()=>Xs,aborted:()=>yn,allowsEval:()=>Ys,assert:()=>UE,assertEqual:()=>LE,assertIs:()=>ME,assertNever:()=>zE,assertNotEqual:()=>$E,assignProp:()=>Hs,cached:()=>Dr,captureStackTrace:()=>qo,cleanEnum:()=>XE,cleanRegex:()=>xr,clone:()=>We,createTransparentProxy:()=>qE,defineLazy:()=>se,esc:()=>gn,escapeRegex:()=>zt,extend:()=>HE,finalizeIssue:()=>st,floatSafeRemainder:()=>Ws,getElementAtPath:()=>FE,getEnumValues:()=>Cr,getLengthableOrigin:()=>kr,getParsedType:()=>BE,getSizableOrigin:()=>Vu,isObject:()=>Kn,isPlainObject:()=>Jn,issue:()=>Qs,joinValues:()=>Bo,jsonStringifyReplacer:()=>Vs,merge:()=>YE,normalizeParams:()=>U,nullish:()=>Rr,numKeys:()=>ZE,omit:()=>WE,optionalKeys:()=>Js,partial:()=>KE,pick:()=>VE,prefixIssues:()=>gt,primitiveTypes:()=>Bu,promiseAllObject:()=>jE,propertyKeyTypes:()=>Ks,randomString:()=>GE,required:()=>JE,stringifyPrimitive:()=>Vo,unwrapMessage:()=>Pr});u();function LE(t){return t}function $E(t){return t}function ME(t){}function zE(t){throw new Error}function UE(t){}function Cr(t){let e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,o])=>e.indexOf(+r)===-1).map(([r,o])=>o)}function Bo(t,e="|"){return t.map(n=>Vo(n)).join(e)}function Vs(t,e){return typeof e=="bigint"?e.toString():e}function Dr(t){return{get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function Rr(t){return t==null}function xr(t){let e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function Ws(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,o=n>r?n:r,a=Number.parseInt(t.toFixed(o).replace(".","")),s=Number.parseInt(e.toFixed(o).replace(".",""));return a%s/10**o}function se(t,e,n){Object.defineProperty(t,e,{get(){{let o=n();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function Hs(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function FE(t,e){return e?e.reduce((n,r)=>n?.[r],t):t}function jE(t){let e=Object.keys(t),n=e.map(r=>t[r]);return Promise.all(n).then(r=>{let o={};for(let a=0;a<e.length;a++)o[e[a]]=r[a];return o})}function GE(t=10){let e="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<t;r++)n+=e[Math.floor(Math.random()*e.length)];return n}function gn(t){return JSON.stringify(t)}var qo=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Kn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Ys=Dr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Jn(t){if(Kn(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let n=e.prototype;return!(Kn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ZE(t){let e=0;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}var BE=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}`)}},Ks=new Set(["string","number","symbol"]),Bu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function zt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function We(t,e,n){let r=new t._zod.constr(e??t._zod.def);return(!e||n?.parent)&&(r._zod.parent=t),r}function U(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 qE(t){let e;return new Proxy({},{get(n,r,o){return e??(e=t()),Reflect.get(e,r,o)},set(n,r,o,a){return e??(e=t()),Reflect.set(e,r,o,a)},has(n,r){return e??(e=t()),Reflect.has(e,r)},deleteProperty(n,r){return e??(e=t()),Reflect.deleteProperty(e,r)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,r){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,r)},defineProperty(n,r,o){return e??(e=t()),Reflect.defineProperty(e,r,o)}})}function Vo(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Js(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Xs={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]},qu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function VE(t,e){let n={},r=t._zod.def;for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(n[o]=r.shape[o])}return We(t,{...t._zod.def,shape:n,checks:[]})}function WE(t,e){let n={...t._zod.def.shape},r=t._zod.def;for(let o in e){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete n[o]}return We(t,{...t._zod.def,shape:n,checks:[]})}function HE(t,e){if(!Jn(e))throw new Error("Invalid input to extend: expected a plain object");let n={...t._zod.def,get shape(){let r={...t._zod.def.shape,...e};return Hs(this,"shape",r),r},checks:[]};return We(t,n)}function YE(t,e){return We(t,{...t._zod.def,get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Hs(this,"shape",n),n},catchall:e._zod.def.catchall,checks:[]})}function KE(t,e,n){let r=e._zod.def.shape,o={...r};if(n)for(let a in n){if(!(a in r))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=t?new t({type:"optional",innerType:r[a]}):r[a])}else for(let a in r)o[a]=t?new t({type:"optional",innerType:r[a]}):r[a];return We(e,{...e._zod.def,shape:o,checks:[]})}function JE(t,e,n){let r=e._zod.def.shape,o={...r};if(n)for(let a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new t({type:"nonoptional",innerType:r[a]}))}else for(let a in r)o[a]=new t({type:"nonoptional",innerType:r[a]});return We(e,{...e._zod.def,shape:o,checks:[]})}function yn(t,e=0){for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function gt(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function Pr(t){return typeof t=="string"?t:t?.message}function st(t,e,n){let r={...t,path:t.path??[]};if(!t.message){let o=Pr(t.inst?._zod.def?.error?.(t))??Pr(e?.error?.(t))??Pr(n.customError?.(t))??Pr(n.localeError?.(t))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,e?.reportInput||delete r.input,r}function Vu(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function kr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Qs(...t){let[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}function XE(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var qs=class{constructor(...e){}};var Wu=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Vs,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Wo=b("$ZodError",Wu),Lr=b("$ZodError",Wu,{Parent:Error});function ei(t,e=n=>n.message){let n={},r=[];for(let o of t.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}function ti(t,e){let n=e||function(a){return a.message},r={_errors:[]},o=a=>{for(let s of a.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let i=r,l=0;for(;l<s.path.length;){let d=s.path[l];l===s.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(n(s))):i[d]=i[d]||{_errors:[]},i=i[d],l++}}};return o(t),r}var ni=t=>(e,n,r,o)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},s=e._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new Ot;if(s.issues.length){let i=new(o?.Err??t)(s.issues.map(l=>st(l,a,Ve())));throw qo(i,o?.callee),i}return s.value},ri=ni(Lr),oi=t=>async(e,n,r,o)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},s=e._zod.run({value:n,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let i=new(o?.Err??t)(s.issues.map(l=>st(l,a,Ve())));throw qo(i,o?.callee),i}return s.value},ai=oi(Lr),si=t=>(e,n,r)=>{let o=r?{...r,async:!1}:{async:!1},a=e._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Ot;return a.issues.length?{success:!1,error:new(t??Wo)(a.issues.map(s=>st(s,o,Ve())))}:{success:!0,data:a.value}},En=si(Lr),ii=t=>async(e,n,r)=>{let o=r?Object.assign(r,{async:!0}):{async:!0},a=e._zod.run({value:n,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new t(a.issues.map(s=>st(s,o,Ve())))}:{success:!0,data:a.value}},Tn=ii(Lr);u();u();u();var Hu=/^[cC][^\s-]{8,}$/,Yu=/^[0-9a-z]+$/,Ku=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ju=/^[0-9a-vA-V]{20}$/,Xu=/^[A-Za-z0-9]{27}$/,Qu=/^[a-zA-Z0-9_-]{21}$/,eh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var th=/^([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})$/,ci=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)$/;var nh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var eT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function rh(){return new RegExp(eT,"u")}var oh=/^(?:(?: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])$/,ah=/^(([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})$/,sh=/^((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])$/,ih=/^(([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])$/,ch=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,li=/^[A-Za-z0-9_-]*$/,lh=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var dh=/^\+(?:[0-9]){6,14}[0-9]$/,uh="(?:(?:\\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])))",hh=new RegExp(`^${uh}$`);function ph(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 mh(t){return new RegExp(`^${ph(t)}$`)}function fh(t){let e=ph({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-]\\d{2}:\\d{2})");let r=`${e}(?:${n.join("|")})`;return new RegExp(`^${uh}T(?:${r})$`)}var _h=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var gh=/^\d+$/,yh=/^-?\d+(?:\.\d+)?/i,Eh=/true|false/i,Th=/null/i;var bh=/^[^A-Z]*$/,wh=/^[^a-z]*$/;var Ie=b("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),vh={number:"number",bigint:"bigint",object:"date"},di=b("$ZodCheckLessThan",(t,e)=>{Ie.init(t,e);let n=vh[typeof e.value];t._zod.onattach.push(r=>{let o=r._zod.bag,a=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<a&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ui=b("$ZodCheckGreaterThan",(t,e)=>{Ie.init(t,e);let n=vh[typeof e.value];t._zod.onattach.push(r=>{let o=r._zod.bag,a=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>a&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Ih=b("$ZodCheckMultipleOf",(t,e)=>{Ie.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):Ws(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Ah=b("$ZodCheckNumberFormat",(t,e)=>{Ie.init(t,e),e.format=e.format||"float64";let n=e.format?.includes("int"),r=n?"int":"number",[o,a]=Xs[e.format];t._zod.onattach.push(s=>{let i=s._zod.bag;i.format=e.format,i.minimum=o,i.maximum=a,n&&(i.pattern=gh)}),t._zod.check=s=>{let i=s.value;if(n){if(!Number.isInteger(i)){s.issues.push({expected:r,format:e.format,code:"invalid_type",input:i,inst:t});return}if(!Number.isSafeInteger(i)){i>0?s.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort}):s.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,continue:!e.abort});return}}i<o&&s.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),i>a&&s.issues.push({origin:"number",input:i,code:"too_big",maximum:a,inst:t})}});var Sh=b("$ZodCheckMaxLength",(t,e)=>{var n;Ie.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Rr(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{let o=r.value;if(o.length<=e.maximum)return;let s=kr(o);r.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Oh=b("$ZodCheckMinLength",(t,e)=>{var n;Ie.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Rr(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{let o=r.value;if(o.length>=e.minimum)return;let s=kr(o);r.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Nh=b("$ZodCheckLengthEquals",(t,e)=>{var n;Ie.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!Rr(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=r=>{let o=r.value,a=o.length;if(a===e.length)return;let s=kr(o),i=a>e.length;r.issues.push({origin:s,...i?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),$r=b("$ZodCheckStringFormat",(t,e)=>{var n,r;Ie.init(t,e),t._zod.onattach.push(o=>{let a=o._zod.bag;a.format=e.format,e.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),Ph=b("$ZodCheckRegex",(t,e)=>{$r.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Ch=b("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=bh),$r.init(t,e)}),Dh=b("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=wh),$r.init(t,e)}),Rh=b("$ZodCheckIncludes",(t,e)=>{Ie.init(t,e);let n=zt(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(o=>{let a=o._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),xh=b("$ZodCheckStartsWith",(t,e)=>{Ie.init(t,e);let n=new RegExp(`^${zt(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),kh=b("$ZodCheckEndsWith",(t,e)=>{Ie.init(t,e);let n=new RegExp(`.*${zt(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}});var Lh=b("$ZodCheckOverwrite",(t,e)=>{Ie.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});u();var Yo=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 r=e.split(`
12
12
  `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),a=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of a)this.content.push(s)}compile(){let e=Function,n=this?.args,o=[...(this?.content??[""]).map(a=>` ${a}`)];return new e(...n,o.join(`
13
- `))}};u();var $h={major:4,minor:0,patch:0};var re=b("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=$h;let r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(let o of r)for(let a of o._zod.onattach)a(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,i)=>{let l=yn(a),d;for(let h of s){if(h._zod.def.when){if(!h._zod.def.when(a))continue}else if(l)continue;let p=a.issues.length,g=h._zod.check(a);if(g instanceof Promise&&i?.async===!1)throw new Ot;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await g,a.issues.length!==p&&(l||(l=yn(a,p)))});else{if(a.issues.length===p)continue;l||(l=yn(a,p))}}return d?d.then(()=>a):a};t._zod.run=(a,s)=>{let i=t._zod.parse(a,s);if(i instanceof Promise){if(s.async===!1)throw new Ot;return i.then(l=>o(l,r,s))}return o(i,r,s)}}t["~standard"]={validate:o=>{try{let a=En(t,o);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Tn(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),$r=b("$ZodString",(t,e)=>{re.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??fh(t._zod.bag),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),ie=b("$ZodStringFormat",(t,e)=>{Lr.init(t,e),$r.init(t,e)}),ui=b("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=eh),ie.init(t,e)}),hi=b("$ZodUUID",(t,e)=>{if(e.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=si(r))}else e.pattern??(e.pattern=si());ie.init(t,e)}),pi=b("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=th),ie.init(t,e)}),mi=b("$ZodURL",(t,e)=>{ie.init(t,e),t._zod.check=n=>{try{let r=n.value,o=new URL(r),a=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ch.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),!r.endsWith("/")&&a.endsWith("/")?n.value=a.slice(0,-1):n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),fi=b("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=nh()),ie.init(t,e)}),_i=b("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Xu),ie.init(t,e)}),gi=b("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Wu),ie.init(t,e)}),yi=b("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Hu),ie.init(t,e)}),Ei=b("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Yu),ie.init(t,e)}),Ti=b("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Ku),ie.init(t,e)}),bi=b("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Ju),ie.init(t,e)}),Vh=b("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=mh(e)),ie.init(t,e)}),Wh=b("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=uh),ie.init(t,e)}),Hh=b("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=ph(e)),ie.init(t,e)}),Yh=b("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Qu),ie.init(t,e)}),wi=b("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=rh),ie.init(t,e),t._zod.onattach.push(n=>{let r=n._zod.bag;r.format="ipv4"})}),vi=b("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=oh),ie.init(t,e),t._zod.onattach.push(n=>{let r=n._zod.bag;r.format="ipv6"}),t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),Ii=b("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=ah),ie.init(t,e)}),Ai=b("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=sh),ie.init(t,e),t._zod.check=n=>{let[r,o]=n.value.split("/");try{if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function Kh(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Si=b("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=ih),ie.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),t._zod.check=n=>{Kh(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function JE(t){if(!ii.test(t))return!1;let e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Kh(n)}var Oi=b("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=ii),ie.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),t._zod.check=n=>{JE(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Ni=b("$ZodE164",(t,e)=>{e.pattern??(e.pattern=lh),ie.init(t,e)});function XE(t,e=null){try{let n=t.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var Pi=b("$ZodJWT",(t,e)=>{ie.init(t,e),t._zod.check=n=>{XE(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}});var Ko=b("$ZodNumber",(t,e)=>{re.init(t,e),t._zod.pattern=t._zod.bag.pattern??gh,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let a=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...a?{received:a}:{}}),n}}),Ci=b("$ZodNumber",(t,e)=>{Ih.init(t,e),Ko.init(t,e)}),Di=b("$ZodBoolean",(t,e)=>{re.init(t,e),t._zod.pattern=yh,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),n}});var Ri=b("$ZodNull",(t,e)=>{re.init(t,e),t._zod.pattern=Eh,t._zod.values=new Set([null]),t._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),n}});var ki=b("$ZodUnknown",(t,e)=>{re.init(t,e),t._zod.parse=n=>n}),xi=b("$ZodNever",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function Mh(t,e,n){t.issues.length&&e.issues.push(...gt(n,t.issues)),e.value[n]=t.value}var Li=b("$ZodArray",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=Array(o.length);let a=[];for(let s=0;s<o.length;s++){let i=o[s],l=e.element._zod.run({value:i,issues:[]},r);l instanceof Promise?a.push(l.then(d=>Mh(d,n,s))):Mh(l,n,s)}return a.length?Promise.all(a).then(()=>n):n}});function Yo(t,e,n){t.issues.length&&e.issues.push(...gt(n,t.issues)),e.value[n]=t.value}function zh(t,e,n,r){t.issues.length?r[n]===void 0?n in r?e.value[n]=void 0:e.value[n]=t.value:e.issues.push(...gt(n,t.issues)):t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}var Jo=b("$ZodObject",(t,e)=>{re.init(t,e);let n=Cr(()=>{let p=Object.keys(e.shape);for(let f of p)if(!(e.shape[f]instanceof re))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);let g=Ys(e.shape);return{shape:e.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(g)}});se(t._zod,"propValues",()=>{let p=e.shape,g={};for(let f in p){let m=p[f]._zod;if(m.values){g[f]??(g[f]=new Set);for(let y of m.values)g[f].add(y)}}return g});let r=p=>{let g=new Ho(["shape","payload","ctx"]),f=n.value,m=I=>{let S=gn(I);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};g.write("const input = payload.value;");let y=Object.create(null),T=0;for(let I of f.keys)y[I]=`key_${T++}`;g.write("const newResult = {}");for(let I of f.keys)if(f.optionalKeys.has(I)){let S=y[I];g.write(`const ${S} = ${m(I)};`);let D=gn(I);g.write(`
13
+ `))}};u();var Mh={major:4,minor:0,patch:0};var re=b("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Mh;let r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(let o of r)for(let a of o._zod.onattach)a(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,i)=>{let l=yn(a),d;for(let h of s){if(h._zod.def.when){if(!h._zod.def.when(a))continue}else if(l)continue;let p=a.issues.length,g=h._zod.check(a);if(g instanceof Promise&&i?.async===!1)throw new Ot;if(d||g instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await g,a.issues.length!==p&&(l||(l=yn(a,p)))});else{if(a.issues.length===p)continue;l||(l=yn(a,p))}}return d?d.then(()=>a):a};t._zod.run=(a,s)=>{let i=t._zod.parse(a,s);if(i instanceof Promise){if(s.async===!1)throw new Ot;return i.then(l=>o(l,r,s))}return o(i,r,s)}}t["~standard"]={validate:o=>{try{let a=En(t,o);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Tn(t,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Mr=b("$ZodString",(t,e)=>{re.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??_h(t._zod.bag),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),ie=b("$ZodStringFormat",(t,e)=>{$r.init(t,e),Mr.init(t,e)}),pi=b("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=th),ie.init(t,e)}),mi=b("$ZodUUID",(t,e)=>{if(e.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=ci(r))}else e.pattern??(e.pattern=ci());ie.init(t,e)}),fi=b("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=nh),ie.init(t,e)}),_i=b("$ZodURL",(t,e)=>{ie.init(t,e),t._zod.check=n=>{try{let r=n.value,o=new URL(r),a=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:lh.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),!r.endsWith("/")&&a.endsWith("/")?n.value=a.slice(0,-1):n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),gi=b("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=rh()),ie.init(t,e)}),yi=b("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Qu),ie.init(t,e)}),Ei=b("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Hu),ie.init(t,e)}),Ti=b("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Yu),ie.init(t,e)}),bi=b("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Ku),ie.init(t,e)}),wi=b("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Ju),ie.init(t,e)}),vi=b("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Xu),ie.init(t,e)}),Wh=b("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=fh(e)),ie.init(t,e)}),Hh=b("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=hh),ie.init(t,e)}),Yh=b("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=mh(e)),ie.init(t,e)}),Kh=b("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=eh),ie.init(t,e)}),Ii=b("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=oh),ie.init(t,e),t._zod.onattach.push(n=>{let r=n._zod.bag;r.format="ipv4"})}),Ai=b("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=ah),ie.init(t,e),t._zod.onattach.push(n=>{let r=n._zod.bag;r.format="ipv6"}),t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),Si=b("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=sh),ie.init(t,e)}),Oi=b("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=ih),ie.init(t,e),t._zod.check=n=>{let[r,o]=n.value.split("/");try{if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function Jh(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Ni=b("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=ch),ie.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),t._zod.check=n=>{Jh(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function tT(t){if(!li.test(t))return!1;let e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return Jh(n)}var Pi=b("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=li),ie.init(t,e),t._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),t._zod.check=n=>{tT(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Ci=b("$ZodE164",(t,e)=>{e.pattern??(e.pattern=dh),ie.init(t,e)});function nT(t,e=null){try{let n=t.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var Di=b("$ZodJWT",(t,e)=>{ie.init(t,e),t._zod.check=n=>{nT(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}});var Jo=b("$ZodNumber",(t,e)=>{re.init(t,e),t._zod.pattern=t._zod.bag.pattern??yh,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let a=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...a?{received:a}:{}}),n}}),Ri=b("$ZodNumber",(t,e)=>{Ah.init(t,e),Jo.init(t,e)}),xi=b("$ZodBoolean",(t,e)=>{re.init(t,e),t._zod.pattern=Eh,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),n}});var ki=b("$ZodNull",(t,e)=>{re.init(t,e),t._zod.pattern=Th,t._zod.values=new Set([null]),t._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),n}});var Li=b("$ZodUnknown",(t,e)=>{re.init(t,e),t._zod.parse=n=>n}),$i=b("$ZodNever",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function zh(t,e,n){t.issues.length&&e.issues.push(...gt(n,t.issues)),e.value[n]=t.value}var Mi=b("$ZodArray",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=Array(o.length);let a=[];for(let s=0;s<o.length;s++){let i=o[s],l=e.element._zod.run({value:i,issues:[]},r);l instanceof Promise?a.push(l.then(d=>zh(d,n,s))):zh(l,n,s)}return a.length?Promise.all(a).then(()=>n):n}});function Ko(t,e,n){t.issues.length&&e.issues.push(...gt(n,t.issues)),e.value[n]=t.value}function Uh(t,e,n,r){t.issues.length?r[n]===void 0?n in r?e.value[n]=void 0:e.value[n]=t.value:e.issues.push(...gt(n,t.issues)):t.value===void 0?n in r&&(e.value[n]=void 0):e.value[n]=t.value}var Xo=b("$ZodObject",(t,e)=>{re.init(t,e);let n=Dr(()=>{let p=Object.keys(e.shape);for(let f of p)if(!(e.shape[f]instanceof re))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);let g=Js(e.shape);return{shape:e.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(g)}});se(t._zod,"propValues",()=>{let p=e.shape,g={};for(let f in p){let m=p[f]._zod;if(m.values){g[f]??(g[f]=new Set);for(let y of m.values)g[f].add(y)}}return g});let r=p=>{let g=new Yo(["shape","payload","ctx"]),f=n.value,m=I=>{let S=gn(I);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};g.write("const input = payload.value;");let y=Object.create(null),T=0;for(let I of f.keys)y[I]=`key_${T++}`;g.write("const newResult = {}");for(let I of f.keys)if(f.optionalKeys.has(I)){let S=y[I];g.write(`const ${S} = ${m(I)};`);let D=gn(I);g.write(`
14
14
  if (${S}.issues.length) {
15
15
  if (input[${D}] === undefined) {
16
16
  if (${D} in input) {
@@ -33,14 +33,14 @@ import{d as ko,e as Un,h as Au,i as Su}from"./chunk-ZGX656ZG.js";import{c as N,d
33
33
  if (${S}.issues.length) payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
34
34
  ...iss,
35
35
  path: iss.path ? [${gn(I)}, ...iss.path] : [${gn(I)}]
36
- })));`),g.write(`newResult[${gn(I)}] = ${S}.value`)}g.write("payload.value = newResult;"),g.write("return payload;");let w=g.compile();return(I,S)=>w(p,I,S)},o,a=Yn,s=!Go.jitless,l=s&&Ws.value,d=e.catchall,h;t._zod.parse=(p,g)=>{h??(h=n.value);let f=p.value;if(!a(f))return p.issues.push({expected:"object",code:"invalid_type",input:f,inst:t}),p;let m=[];if(s&&l&&g?.async===!1&&g.jitless!==!0)o||(o=r(e.shape)),p=o(p,g);else{p.value={};let S=h.shape;for(let D of h.keys){let M=S[D],ke=M._zod.run({value:f[D],issues:[]},g),Ye=M._zod.optin==="optional"&&M._zod.optout==="optional";ke instanceof Promise?m.push(ke.then(zn=>Ye?zh(zn,p,D,f):Yo(zn,p,D))):Ye?zh(ke,p,D,f):Yo(ke,p,D)}}if(!d)return m.length?Promise.all(m).then(()=>p):p;let y=[],T=h.keySet,w=d._zod,I=w.def.type;for(let S of Object.keys(f)){if(T.has(S))continue;if(I==="never"){y.push(S);continue}let D=w.run({value:f[S],issues:[]},g);D instanceof Promise?m.push(D.then(M=>Yo(M,p,S))):Yo(D,p,S)}return y.length&&p.issues.push({code:"unrecognized_keys",keys:y,input:f,inst:t}),m.length?Promise.all(m).then(()=>p):p}});function Uh(t,e,n,r){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(o=>o.issues.map(a=>st(a,r,Ve())))}),e}var Xo=b("$ZodUnion",(t,e)=>{re.init(t,e),se(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),se(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),se(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),se(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){let n=e.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>Rr(r.source)).join("|")})$`)}}),t._zod.parse=(n,r)=>{let o=!1,a=[];for(let s of e.options){let i=s._zod.run({value:n.value,issues:[]},r);if(i instanceof Promise)a.push(i),o=!0;else{if(i.issues.length===0)return i;a.push(i)}}return o?Promise.all(a).then(s=>Uh(s,n,t,r)):Uh(a,n,t,r)}}),$i=b("$ZodDiscriminatedUnion",(t,e)=>{Xo.init(t,e);let n=t._zod.parse;se(t._zod,"propValues",()=>{let o={};for(let a of e.options){let s=a._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let[i,l]of Object.entries(s)){o[i]||(o[i]=new Set);for(let d of l)o[i].add(d)}}return o});let r=Cr(()=>{let o=e.options,a=new Map;for(let s of o){let i=s._zod.propValues[e.discriminator];if(!i||i.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let l of i){if(a.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);a.set(l,s)}}return a});t._zod.parse=(o,a)=>{let s=o.value;if(!Yn(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let i=r.value.get(s?.[e.discriminator]);return i?i._zod.run(o,a):e.unionFallback?n(o,a):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[e.discriminator],inst:t}),o)}}),Mi=b("$ZodIntersection",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>{let o=n.value,a=e.left._zod.run({value:o,issues:[]},r),s=e.right._zod.run({value:o,issues:[]},r);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([l,d])=>Fh(n,l,d)):Fh(n,a,s)}});function di(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(Kn(t)&&Kn(e)){let n=Object.keys(e),r=Object.keys(t).filter(a=>n.indexOf(a)!==-1),o={...t,...e};for(let a of r){let s=di(t[a],e[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};o[a]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<t.length;r++){let o=t[r],a=e[r],s=di(o,a);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Fh(t,e,n){if(e.issues.length&&t.issues.push(...e.issues),n.issues.length&&t.issues.push(...n.issues),yn(t))return t;let r=di(e.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return t.value=r.data,t}var zi=b("$ZodRecord",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!Kn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;let a=[];if(e.keyType._zod.values){let s=e.keyType._zod.values;n.value={};for(let l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){let d=e.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?a.push(d.then(h=>{h.issues.length&&n.issues.push(...gt(l,h.issues)),n.value[l]=h.value})):(d.issues.length&&n.issues.push(...gt(l,d.issues)),n.value[l]=d.value)}let i;for(let l in o)s.has(l)||(i=i??[],i.push(l));i&&i.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:i})}else{n.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let i=e.keyType._zod.run({value:s,issues:[]},r);if(i instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(i.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:i.issues.map(d=>st(d,r,Ve())),input:s,path:[s],inst:t}),n.value[i.value]=i.value;continue}let l=e.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?a.push(l.then(d=>{d.issues.length&&n.issues.push(...gt(s,d.issues)),n.value[i.value]=d.value})):(l.issues.length&&n.issues.push(...gt(s,l.issues)),n.value[i.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}});var Ui=b("$ZodEnum",(t,e)=>{re.init(t,e);let n=Pr(e.entries);t._zod.values=new Set(n),t._zod.pattern=new RegExp(`^(${n.filter(r=>Hs.has(typeof r)).map(r=>typeof r=="string"?zt(r):r.toString()).join("|")})$`),t._zod.parse=(r,o)=>{let a=r.value;return t._zod.values.has(a)||r.issues.push({code:"invalid_value",values:n,input:a,inst:t}),r}}),Fi=b("$ZodLiteral",(t,e)=>{re.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?zt(n):n?n.toString():String(n)).join("|")})$`),t._zod.parse=(n,r)=>{let o=n.value;return t._zod.values.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}});var ji=b("$ZodTransform",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>{let o=e.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new Ot;return n.value=o,n}}),Gi=b("$ZodOptional",(t,e)=>{re.init(t,e),t._zod.optin="optional",t._zod.optout="optional",se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),se(t._zod,"pattern",()=>{let n=e.innerType._zod.pattern;return n?new RegExp(`^(${Rr(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(n,r):n.value===void 0?n:e.innerType._zod.run(n,r)}),Zi=b("$ZodNullable",(t,e)=>{re.init(t,e),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),se(t._zod,"pattern",()=>{let n=e.innerType._zod.pattern;return n?new RegExp(`^(${Rr(n.source)}|null)$`):void 0}),se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),Bi=b("$ZodDefault",(t,e)=>{re.init(t,e),t._zod.optin="optional",se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=e.defaultValue,n;let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(a=>jh(a,e)):jh(o,e)}});function jh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var qi=b("$ZodPrefault",(t,e)=>{re.init(t,e),t._zod.optin="optional",se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),Vi=b("$ZodNonOptional",(t,e)=>{re.init(t,e),se(t._zod,"values",()=>{let n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(a=>Gh(a,t)):Gh(o,t)}});function Gh(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 Wi=b("$ZodCatch",(t,e)=>{re.init(t,e),t._zod.optin="optional",se(t._zod,"optout",()=>e.innerType._zod.optout),se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(a=>(n.value=a.value,a.issues.length&&(n.value=e.catchValue({...n,error:{issues:a.issues.map(s=>st(s,r,Ve()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(a=>st(a,r,Ve()))},input:n.value}),n.issues=[]),n)}});var Hi=b("$ZodPipe",(t,e)=>{re.init(t,e),se(t._zod,"values",()=>e.in._zod.values),se(t._zod,"optin",()=>e.in._zod.optin),se(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(n,r)=>{let o=e.in._zod.run(n,r);return o instanceof Promise?o.then(a=>Zh(a,e,r)):Zh(o,e,r)}});function Zh(t,e,n){return yn(t)?t:e.out._zod.run({value:t.value,issues:t.issues},n)}var Yi=b("$ZodReadonly",(t,e)=>{re.init(t,e),se(t._zod,"propValues",()=>e.innerType._zod.propValues),se(t._zod,"values",()=>e.innerType._zod.values),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(Bh):Bh(o)}});function Bh(t){return t.value=Object.freeze(t.value),t}var Ki=b("$ZodCustom",(t,e)=>{Ie.init(t,e),re.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{let r=n.value,o=e.fn(r);if(o instanceof Promise)return o.then(a=>qh(a,n,r,t));qh(o,n,r,t)}});function qh(t,e,n,r){if(!t){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),e.issues.push(Js(o))}}u();var QE=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},eT=()=>{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"}};function e(r){return t[r]??null}let n={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",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"};return r=>{switch(r.code){case"invalid_type":return`Invalid input: expected ${r.expected}, received ${QE(r.input)}`;case"invalid_value":return r.values.length===1?`Invalid input: expected ${qo(r.values[0])}`:`Invalid option: expected one of ${Zo(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Too big: expected ${r.origin??"value"} to have ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=e(r.origin);return a?`Too small: expected ${r.origin} to have ${o}${r.minimum.toString()} ${a.unit}`:`Too small: expected ${r.origin} to be ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${Zo(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function Jh(){return{localeError:eT()}}u();var tT=Symbol("ZodOutput"),nT=Symbol("ZodInput"),Mr=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...n){let r=n[0];if(this._map.set(e,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){let n=e._zod.parent;if(n){let r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Xh(){return new Mr}var Ut=Xh();u();function Ji(t,e){return new t({type:"string",...U(e)})}function Xi(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...U(e)})}function Qo(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...U(e)})}function Qi(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...U(e)})}function ec(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(e)})}function tc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(e)})}function nc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(e)})}function rc(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...U(e)})}function oc(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...U(e)})}function ac(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(e)})}function sc(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...U(e)})}function ic(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(e)})}function cc(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...U(e)})}function lc(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...U(e)})}function dc(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(e)})}function uc(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(e)})}function hc(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(e)})}function pc(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(e)})}function mc(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(e)})}function fc(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...U(e)})}function _c(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...U(e)})}function gc(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...U(e)})}function yc(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...U(e)})}function Qh(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(e)})}function ep(t,e){return new t({type:"string",format:"date",check:"string_format",...U(e)})}function tp(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...U(e)})}function np(t,e){return new t({type:"string",format:"duration",check:"string_format",...U(e)})}function Ec(t,e){return new t({type:"number",checks:[],...U(e)})}function Tc(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...U(e)})}function bc(t,e){return new t({type:"boolean",...U(e)})}function wc(t,e){return new t({type:"null",...U(e)})}function vc(t){return new t({type:"unknown"})}function Ic(t,e){return new t({type:"never",...U(e)})}function ea(t,e){return new ci({check:"less_than",...U(e),value:t,inclusive:!1})}function zr(t,e){return new ci({check:"less_than",...U(e),value:t,inclusive:!0})}function ta(t,e){return new li({check:"greater_than",...U(e),value:t,inclusive:!1})}function Ur(t,e){return new li({check:"greater_than",...U(e),value:t,inclusive:!0})}function na(t,e){return new vh({check:"multiple_of",...U(e),value:t})}function ra(t,e){return new Ah({check:"max_length",...U(e),maximum:t})}function Jn(t,e){return new Sh({check:"min_length",...U(e),minimum:t})}function oa(t,e){return new Oh({check:"length_equals",...U(e),length:t})}function Ac(t,e){return new Nh({check:"string_format",format:"regex",...U(e),pattern:t})}function Sc(t){return new Ph({check:"string_format",format:"lowercase",...U(t)})}function Oc(t){return new Ch({check:"string_format",format:"uppercase",...U(t)})}function Nc(t,e){return new Dh({check:"string_format",format:"includes",...U(e),includes:t})}function Pc(t,e){return new Rh({check:"string_format",format:"starts_with",...U(e),prefix:t})}function Cc(t,e){return new kh({check:"string_format",format:"ends_with",...U(e),suffix:t})}function bn(t){return new xh({check:"overwrite",tx:t})}function Dc(t){return bn(e=>e.normalize(t))}function Rc(){return bn(t=>t.trim())}function kc(){return bn(t=>t.toLowerCase())}function xc(){return bn(t=>t.toUpperCase())}function rp(t,e,n){return new t({type:"array",element:e,...U(n)})}function Lc(t,e,n){let r=U(n);return r.abort??(r.abort=!0),new t({type:"custom",check:"custom",fn:e,...r})}function $c(t,e,n){return new t({type:"custom",check:"custom",fn:e,...U(n)})}u();var aa=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ut,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(e,i);let l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{let p={...n,schemaPath:[...n.schemaPath,e],path:n.path},g=e._zod.parent;if(g)i.ref=g,this.process(g,p),this.seen.get(g).isParent=!0;else{let f=i.schema;switch(o.type){case"string":{let m=f;m.type="string";let{minimum:y,maximum:T,format:w,patterns:I,contentEncoding:S}=e._zod.bag;if(typeof y=="number"&&(m.minLength=y),typeof T=="number"&&(m.maxLength=T),w&&(m.format=a[w]??w,m.format===""&&delete m.format),S&&(m.contentEncoding=S),I&&I.size>0){let D=[...I];D.length===1?m.pattern=D[0].source:D.length>1&&(i.schema.allOf=[...D.map(M=>({...this.target==="draft-7"?{type:"string"}:{},pattern:M.source}))])}break}case"number":{let m=f,{minimum:y,maximum:T,format:w,multipleOf:I,exclusiveMaximum:S,exclusiveMinimum:D}=e._zod.bag;typeof w=="string"&&w.includes("int")?m.type="integer":m.type="number",typeof D=="number"&&(m.exclusiveMinimum=D),typeof y=="number"&&(m.minimum=y,typeof D=="number"&&(D>=y?delete m.minimum:delete m.exclusiveMinimum)),typeof S=="number"&&(m.exclusiveMaximum=S),typeof T=="number"&&(m.maximum=T,typeof S=="number"&&(S<=T?delete m.maximum:delete m.exclusiveMaximum)),typeof I=="number"&&(m.multipleOf=I);break}case"boolean":{let m=f;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{f.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{f.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=f,{minimum:y,maximum:T}=e._zod.bag;typeof y=="number"&&(m.minItems=y),typeof T=="number"&&(m.maxItems=T),m.type="array",m.items=this.process(o.element,{...p,path:[...p.path,"items"]});break}case"object":{let m=f;m.type="object",m.properties={};let y=o.shape;for(let I in y)m.properties[I]=this.process(y[I],{...p,path:[...p.path,"properties",I]});let T=new Set(Object.keys(y)),w=new Set([...T].filter(I=>{let S=o.shape[I]._zod;return this.io==="input"?S.optin===void 0:S.optout===void 0}));w.size>0&&(m.required=Array.from(w)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...p,path:[...p.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=f;m.anyOf=o.options.map((y,T)=>this.process(y,{...p,path:[...p.path,"anyOf",T]}));break}case"intersection":{let m=f,y=this.process(o.left,{...p,path:[...p.path,"allOf",0]}),T=this.process(o.right,{...p,path:[...p.path,"allOf",1]}),w=S=>"allOf"in S&&Object.keys(S).length===1,I=[...w(y)?y.allOf:[y],...w(T)?T.allOf:[T]];m.allOf=I;break}case"tuple":{let m=f;m.type="array";let y=o.items.map((I,S)=>this.process(I,{...p,path:[...p.path,"prefixItems",S]}));if(this.target==="draft-2020-12"?m.prefixItems=y:m.items=y,o.rest){let I=this.process(o.rest,{...p,path:[...p.path,"items"]});this.target==="draft-2020-12"?m.items=I:m.additionalItems=I}o.rest&&(m.items=this.process(o.rest,{...p,path:[...p.path,"items"]}));let{minimum:T,maximum:w}=e._zod.bag;typeof T=="number"&&(m.minItems=T),typeof w=="number"&&(m.maxItems=w);break}case"record":{let m=f;m.type="object",m.propertyNames=this.process(o.keyType,{...p,path:[...p.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...p,path:[...p.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=f,y=Pr(o.entries);y.every(T=>typeof T=="number")&&(m.type="number"),y.every(T=>typeof T=="string")&&(m.type="string"),m.enum=y;break}case"literal":{let m=f,y=[];for(let T of o.values)if(T===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof T=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");y.push(Number(T))}else y.push(T);if(y.length!==0)if(y.length===1){let T=y[0];m.type=T===null?"null":typeof T,m.const=T}else y.every(T=>typeof T=="number")&&(m.type="number"),y.every(T=>typeof T=="string")&&(m.type="string"),y.every(T=>typeof T=="boolean")&&(m.type="string"),y.every(T=>T===null)&&(m.type="null"),m.enum=y;break}case"file":{let m=f,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:T,maximum:w,mime:I}=e._zod.bag;T!==void 0&&(y.minLength=T),w!==void 0&&(y.maxLength=w),I?I.length===1?(y.contentMediaType=I[0],Object.assign(m,y)):m.anyOf=I.map(S=>({...y,contentMediaType:S})):Object.assign(m,y);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,p);f.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,p),i.ref=o.innerType;break}case"success":{let m=f;m.type="boolean";break}case"default":{this.process(o.innerType,p),i.ref=o.innerType,f.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,p),i.ref=o.innerType,this.io==="input"&&(f._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,p),i.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}f.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=f,y=e._zod.pattern;if(!y)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=y.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,p),i.ref=m;break}case"readonly":{this.process(o.innerType,p),i.ref=o.innerType,f.readOnly=!0;break}case"promise":{this.process(o.innerType,p),i.ref=o.innerType;break}case"optional":{this.process(o.innerType,p),i.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,p),i.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let d=this.metadataRegistry.get(e);return d&&Object.assign(i.schema,d),this.io==="input"&&Ee(e)&&(delete i.schema.examples,delete i.schema.default),this.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,this.seen.get(e).schema}emit(e,n){let r={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let a=h=>{let p=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let y=r.external.registry.get(h[0])?.id,T=r.external.uri??(I=>I);if(y)return{ref:T(y)};let w=h[1].defId??h[1].schema.id??`schema${this.counter++}`;return h[1].defId=w,{defId:w,ref:`${T("__shared")}#/${p}/${w}`}}if(h[1]===o)return{ref:"#"};let f=`#/${p}/`,m=h[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:f+m}},s=h=>{if(h[1].schema.$ref)return;let p=h[1],{ref:g,defId:f}=a(h);p.def={...p.schema},f&&(p.defId=f);let m=p.schema;for(let y in m)delete m[y];m.$ref=g};if(r.cycles==="throw")for(let h of this.seen.entries()){let p=h[1];if(p.cycle)throw new Error(`Cycle detected: #/${p.cycle?.join("/")}/<root>
36
+ })));`),g.write(`newResult[${gn(I)}] = ${S}.value`)}g.write("payload.value = newResult;"),g.write("return payload;");let w=g.compile();return(I,S)=>w(p,I,S)},o,a=Kn,s=!Zo.jitless,l=s&&Ys.value,d=e.catchall,h;t._zod.parse=(p,g)=>{h??(h=n.value);let f=p.value;if(!a(f))return p.issues.push({expected:"object",code:"invalid_type",input:f,inst:t}),p;let m=[];if(s&&l&&g?.async===!1&&g.jitless!==!0)o||(o=r(e.shape)),p=o(p,g);else{p.value={};let S=h.shape;for(let D of h.keys){let M=S[D],xe=M._zod.run({value:f[D],issues:[]},g),Ye=M._zod.optin==="optional"&&M._zod.optout==="optional";xe instanceof Promise?m.push(xe.then(Un=>Ye?Uh(Un,p,D,f):Ko(Un,p,D))):Ye?Uh(xe,p,D,f):Ko(xe,p,D)}}if(!d)return m.length?Promise.all(m).then(()=>p):p;let y=[],T=h.keySet,w=d._zod,I=w.def.type;for(let S of Object.keys(f)){if(T.has(S))continue;if(I==="never"){y.push(S);continue}let D=w.run({value:f[S],issues:[]},g);D instanceof Promise?m.push(D.then(M=>Ko(M,p,S))):Ko(D,p,S)}return y.length&&p.issues.push({code:"unrecognized_keys",keys:y,input:f,inst:t}),m.length?Promise.all(m).then(()=>p):p}});function Fh(t,e,n,r){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(o=>o.issues.map(a=>st(a,r,Ve())))}),e}var Qo=b("$ZodUnion",(t,e)=>{re.init(t,e),se(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),se(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),se(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),se(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){let n=e.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>xr(r.source)).join("|")})$`)}}),t._zod.parse=(n,r)=>{let o=!1,a=[];for(let s of e.options){let i=s._zod.run({value:n.value,issues:[]},r);if(i instanceof Promise)a.push(i),o=!0;else{if(i.issues.length===0)return i;a.push(i)}}return o?Promise.all(a).then(s=>Fh(s,n,t,r)):Fh(a,n,t,r)}}),zi=b("$ZodDiscriminatedUnion",(t,e)=>{Qo.init(t,e);let n=t._zod.parse;se(t._zod,"propValues",()=>{let o={};for(let a of e.options){let s=a._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let[i,l]of Object.entries(s)){o[i]||(o[i]=new Set);for(let d of l)o[i].add(d)}}return o});let r=Dr(()=>{let o=e.options,a=new Map;for(let s of o){let i=s._zod.propValues[e.discriminator];if(!i||i.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let l of i){if(a.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);a.set(l,s)}}return a});t._zod.parse=(o,a)=>{let s=o.value;if(!Kn(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),o;let i=r.value.get(s?.[e.discriminator]);return i?i._zod.run(o,a):e.unionFallback?n(o,a):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[e.discriminator],inst:t}),o)}}),Ui=b("$ZodIntersection",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>{let o=n.value,a=e.left._zod.run({value:o,issues:[]},r),s=e.right._zod.run({value:o,issues:[]},r);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([l,d])=>jh(n,l,d)):jh(n,a,s)}});function hi(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(Jn(t)&&Jn(e)){let n=Object.keys(e),r=Object.keys(t).filter(a=>n.indexOf(a)!==-1),o={...t,...e};for(let a of r){let s=hi(t[a],e[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};o[a]=s.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<t.length;r++){let o=t[r],a=e[r],s=hi(o,a);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jh(t,e,n){if(e.issues.length&&t.issues.push(...e.issues),n.issues.length&&t.issues.push(...n.issues),yn(t))return t;let r=hi(e.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return t.value=r.data,t}var Fi=b("$ZodRecord",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!Jn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;let a=[];if(e.keyType._zod.values){let s=e.keyType._zod.values;n.value={};for(let l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){let d=e.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?a.push(d.then(h=>{h.issues.length&&n.issues.push(...gt(l,h.issues)),n.value[l]=h.value})):(d.issues.length&&n.issues.push(...gt(l,d.issues)),n.value[l]=d.value)}let i;for(let l in o)s.has(l)||(i=i??[],i.push(l));i&&i.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:i})}else{n.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let i=e.keyType._zod.run({value:s,issues:[]},r);if(i instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(i.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:i.issues.map(d=>st(d,r,Ve())),input:s,path:[s],inst:t}),n.value[i.value]=i.value;continue}let l=e.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?a.push(l.then(d=>{d.issues.length&&n.issues.push(...gt(s,d.issues)),n.value[i.value]=d.value})):(l.issues.length&&n.issues.push(...gt(s,l.issues)),n.value[i.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}});var ji=b("$ZodEnum",(t,e)=>{re.init(t,e);let n=Cr(e.entries);t._zod.values=new Set(n),t._zod.pattern=new RegExp(`^(${n.filter(r=>Ks.has(typeof r)).map(r=>typeof r=="string"?zt(r):r.toString()).join("|")})$`),t._zod.parse=(r,o)=>{let a=r.value;return t._zod.values.has(a)||r.issues.push({code:"invalid_value",values:n,input:a,inst:t}),r}}),Gi=b("$ZodLiteral",(t,e)=>{re.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?zt(n):n?n.toString():String(n)).join("|")})$`),t._zod.parse=(n,r)=>{let o=n.value;return t._zod.values.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}});var Zi=b("$ZodTransform",(t,e)=>{re.init(t,e),t._zod.parse=(n,r)=>{let o=e.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new Ot;return n.value=o,n}}),Bi=b("$ZodOptional",(t,e)=>{re.init(t,e),t._zod.optin="optional",t._zod.optout="optional",se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),se(t._zod,"pattern",()=>{let n=e.innerType._zod.pattern;return n?new RegExp(`^(${xr(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(n,r):n.value===void 0?n:e.innerType._zod.run(n,r)}),qi=b("$ZodNullable",(t,e)=>{re.init(t,e),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),se(t._zod,"pattern",()=>{let n=e.innerType._zod.pattern;return n?new RegExp(`^(${xr(n.source)}|null)$`):void 0}),se(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),Vi=b("$ZodDefault",(t,e)=>{re.init(t,e),t._zod.optin="optional",se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=e.defaultValue,n;let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(a=>Gh(a,e)):Gh(o,e)}});function Gh(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Wi=b("$ZodPrefault",(t,e)=>{re.init(t,e),t._zod.optin="optional",se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),Hi=b("$ZodNonOptional",(t,e)=>{re.init(t,e),se(t._zod,"values",()=>{let n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(a=>Zh(a,t)):Zh(o,t)}});function Zh(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 Yi=b("$ZodCatch",(t,e)=>{re.init(t,e),t._zod.optin="optional",se(t._zod,"optout",()=>e.innerType._zod.optout),se(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(a=>(n.value=a.value,a.issues.length&&(n.value=e.catchValue({...n,error:{issues:a.issues.map(s=>st(s,r,Ve()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(a=>st(a,r,Ve()))},input:n.value}),n.issues=[]),n)}});var Ki=b("$ZodPipe",(t,e)=>{re.init(t,e),se(t._zod,"values",()=>e.in._zod.values),se(t._zod,"optin",()=>e.in._zod.optin),se(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(n,r)=>{let o=e.in._zod.run(n,r);return o instanceof Promise?o.then(a=>Bh(a,e,r)):Bh(o,e,r)}});function Bh(t,e,n){return yn(t)?t:e.out._zod.run({value:t.value,issues:t.issues},n)}var Ji=b("$ZodReadonly",(t,e)=>{re.init(t,e),se(t._zod,"propValues",()=>e.innerType._zod.propValues),se(t._zod,"values",()=>e.innerType._zod.values),se(t._zod,"optin",()=>e.innerType._zod.optin),se(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(qh):qh(o)}});function qh(t){return t.value=Object.freeze(t.value),t}var Xi=b("$ZodCustom",(t,e)=>{Ie.init(t,e),re.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{let r=n.value,o=e.fn(r);if(o instanceof Promise)return o.then(a=>Vh(a,n,r,t));Vh(o,n,r,t)}});function Vh(t,e,n,r){if(!t){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),e.issues.push(Qs(o))}}u();var rT=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},oT=()=>{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"}};function e(r){return t[r]??null}let n={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",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"};return r=>{switch(r.code){case"invalid_type":return`Invalid input: expected ${r.expected}, received ${rT(r.input)}`;case"invalid_value":return r.values.length===1?`Invalid input: expected ${Vo(r.values[0])}`:`Invalid option: expected one of ${Bo(r.values,"|")}`;case"too_big":{let o=r.inclusive?"<=":"<",a=e(r.origin);return a?`Too big: expected ${r.origin??"value"} to have ${o}${r.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${o}${r.maximum.toString()}`}case"too_small":{let o=r.inclusive?">=":">",a=e(r.origin);return a?`Too small: expected ${r.origin} to have ${o}${r.minimum.toString()} ${a.unit}`:`Too small: expected ${r.origin} to be ${o}${r.minimum.toString()}`}case"invalid_format":{let o=r;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${n[o.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${Bo(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function Xh(){return{localeError:oT()}}u();var aT=Symbol("ZodOutput"),sT=Symbol("ZodInput"),zr=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...n){let r=n[0];if(this._map.set(e,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){let n=e._zod.parent;if(n){let r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Qh(){return new zr}var Ut=Qh();u();function Qi(t,e){return new t({type:"string",...U(e)})}function ec(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...U(e)})}function ea(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...U(e)})}function tc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...U(e)})}function nc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(e)})}function rc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(e)})}function oc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(e)})}function ac(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...U(e)})}function sc(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...U(e)})}function ic(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(e)})}function cc(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...U(e)})}function lc(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(e)})}function dc(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...U(e)})}function uc(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...U(e)})}function hc(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(e)})}function pc(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(e)})}function mc(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(e)})}function fc(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(e)})}function _c(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(e)})}function gc(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...U(e)})}function yc(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...U(e)})}function Ec(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...U(e)})}function Tc(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...U(e)})}function ep(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(e)})}function tp(t,e){return new t({type:"string",format:"date",check:"string_format",...U(e)})}function np(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...U(e)})}function rp(t,e){return new t({type:"string",format:"duration",check:"string_format",...U(e)})}function bc(t,e){return new t({type:"number",checks:[],...U(e)})}function wc(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...U(e)})}function vc(t,e){return new t({type:"boolean",...U(e)})}function Ic(t,e){return new t({type:"null",...U(e)})}function Ac(t){return new t({type:"unknown"})}function Sc(t,e){return new t({type:"never",...U(e)})}function ta(t,e){return new di({check:"less_than",...U(e),value:t,inclusive:!1})}function Ur(t,e){return new di({check:"less_than",...U(e),value:t,inclusive:!0})}function na(t,e){return new ui({check:"greater_than",...U(e),value:t,inclusive:!1})}function Fr(t,e){return new ui({check:"greater_than",...U(e),value:t,inclusive:!0})}function ra(t,e){return new Ih({check:"multiple_of",...U(e),value:t})}function oa(t,e){return new Sh({check:"max_length",...U(e),maximum:t})}function Xn(t,e){return new Oh({check:"min_length",...U(e),minimum:t})}function aa(t,e){return new Nh({check:"length_equals",...U(e),length:t})}function Oc(t,e){return new Ph({check:"string_format",format:"regex",...U(e),pattern:t})}function Nc(t){return new Ch({check:"string_format",format:"lowercase",...U(t)})}function Pc(t){return new Dh({check:"string_format",format:"uppercase",...U(t)})}function Cc(t,e){return new Rh({check:"string_format",format:"includes",...U(e),includes:t})}function Dc(t,e){return new xh({check:"string_format",format:"starts_with",...U(e),prefix:t})}function Rc(t,e){return new kh({check:"string_format",format:"ends_with",...U(e),suffix:t})}function bn(t){return new Lh({check:"overwrite",tx:t})}function xc(t){return bn(e=>e.normalize(t))}function kc(){return bn(t=>t.trim())}function Lc(){return bn(t=>t.toLowerCase())}function $c(){return bn(t=>t.toUpperCase())}function op(t,e,n){return new t({type:"array",element:e,...U(n)})}function Mc(t,e,n){let r=U(n);return r.abort??(r.abort=!0),new t({type:"custom",check:"custom",fn:e,...r})}function zc(t,e,n){return new t({type:"custom",check:"custom",fn:e,...U(n)})}u();var sa=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Ut,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(e,i);let l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{let p={...n,schemaPath:[...n.schemaPath,e],path:n.path},g=e._zod.parent;if(g)i.ref=g,this.process(g,p),this.seen.get(g).isParent=!0;else{let f=i.schema;switch(o.type){case"string":{let m=f;m.type="string";let{minimum:y,maximum:T,format:w,patterns:I,contentEncoding:S}=e._zod.bag;if(typeof y=="number"&&(m.minLength=y),typeof T=="number"&&(m.maxLength=T),w&&(m.format=a[w]??w,m.format===""&&delete m.format),S&&(m.contentEncoding=S),I&&I.size>0){let D=[...I];D.length===1?m.pattern=D[0].source:D.length>1&&(i.schema.allOf=[...D.map(M=>({...this.target==="draft-7"?{type:"string"}:{},pattern:M.source}))])}break}case"number":{let m=f,{minimum:y,maximum:T,format:w,multipleOf:I,exclusiveMaximum:S,exclusiveMinimum:D}=e._zod.bag;typeof w=="string"&&w.includes("int")?m.type="integer":m.type="number",typeof D=="number"&&(m.exclusiveMinimum=D),typeof y=="number"&&(m.minimum=y,typeof D=="number"&&(D>=y?delete m.minimum:delete m.exclusiveMinimum)),typeof S=="number"&&(m.exclusiveMaximum=S),typeof T=="number"&&(m.maximum=T,typeof S=="number"&&(S<=T?delete m.maximum:delete m.exclusiveMaximum)),typeof I=="number"&&(m.multipleOf=I);break}case"boolean":{let m=f;m.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{f.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{f.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let m=f,{minimum:y,maximum:T}=e._zod.bag;typeof y=="number"&&(m.minItems=y),typeof T=="number"&&(m.maxItems=T),m.type="array",m.items=this.process(o.element,{...p,path:[...p.path,"items"]});break}case"object":{let m=f;m.type="object",m.properties={};let y=o.shape;for(let I in y)m.properties[I]=this.process(y[I],{...p,path:[...p.path,"properties",I]});let T=new Set(Object.keys(y)),w=new Set([...T].filter(I=>{let S=o.shape[I]._zod;return this.io==="input"?S.optin===void 0:S.optout===void 0}));w.size>0&&(m.required=Array.from(w)),o.catchall?._zod.def.type==="never"?m.additionalProperties=!1:o.catchall?o.catchall&&(m.additionalProperties=this.process(o.catchall,{...p,path:[...p.path,"additionalProperties"]})):this.io==="output"&&(m.additionalProperties=!1);break}case"union":{let m=f;m.anyOf=o.options.map((y,T)=>this.process(y,{...p,path:[...p.path,"anyOf",T]}));break}case"intersection":{let m=f,y=this.process(o.left,{...p,path:[...p.path,"allOf",0]}),T=this.process(o.right,{...p,path:[...p.path,"allOf",1]}),w=S=>"allOf"in S&&Object.keys(S).length===1,I=[...w(y)?y.allOf:[y],...w(T)?T.allOf:[T]];m.allOf=I;break}case"tuple":{let m=f;m.type="array";let y=o.items.map((I,S)=>this.process(I,{...p,path:[...p.path,"prefixItems",S]}));if(this.target==="draft-2020-12"?m.prefixItems=y:m.items=y,o.rest){let I=this.process(o.rest,{...p,path:[...p.path,"items"]});this.target==="draft-2020-12"?m.items=I:m.additionalItems=I}o.rest&&(m.items=this.process(o.rest,{...p,path:[...p.path,"items"]}));let{minimum:T,maximum:w}=e._zod.bag;typeof T=="number"&&(m.minItems=T),typeof w=="number"&&(m.maxItems=w);break}case"record":{let m=f;m.type="object",m.propertyNames=this.process(o.keyType,{...p,path:[...p.path,"propertyNames"]}),m.additionalProperties=this.process(o.valueType,{...p,path:[...p.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let m=f,y=Cr(o.entries);y.every(T=>typeof T=="number")&&(m.type="number"),y.every(T=>typeof T=="string")&&(m.type="string"),m.enum=y;break}case"literal":{let m=f,y=[];for(let T of o.values)if(T===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof T=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");y.push(Number(T))}else y.push(T);if(y.length!==0)if(y.length===1){let T=y[0];m.type=T===null?"null":typeof T,m.const=T}else y.every(T=>typeof T=="number")&&(m.type="number"),y.every(T=>typeof T=="string")&&(m.type="string"),y.every(T=>typeof T=="boolean")&&(m.type="string"),y.every(T=>T===null)&&(m.type="null"),m.enum=y;break}case"file":{let m=f,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:T,maximum:w,mime:I}=e._zod.bag;T!==void 0&&(y.minLength=T),w!==void 0&&(y.maxLength=w),I?I.length===1?(y.contentMediaType=I[0],Object.assign(m,y)):m.anyOf=I.map(S=>({...y,contentMediaType:S})):Object.assign(m,y);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let m=this.process(o.innerType,p);f.anyOf=[m,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,p),i.ref=o.innerType;break}case"success":{let m=f;m.type="boolean";break}case"default":{this.process(o.innerType,p),i.ref=o.innerType,f.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,p),i.ref=o.innerType,this.io==="input"&&(f._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,p),i.ref=o.innerType;let m;try{m=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}f.default=m;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let m=f,y=e._zod.pattern;if(!y)throw new Error("Pattern not found in template literal");m.type="string",m.pattern=y.source;break}case"pipe":{let m=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(m,p),i.ref=m;break}case"readonly":{this.process(o.innerType,p),i.ref=o.innerType,f.readOnly=!0;break}case"promise":{this.process(o.innerType,p),i.ref=o.innerType;break}case"optional":{this.process(o.innerType,p),i.ref=o.innerType;break}case"lazy":{let m=e._zod.innerType;this.process(m,p),i.ref=m;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let d=this.metadataRegistry.get(e);return d&&Object.assign(i.schema,d),this.io==="input"&&Ee(e)&&(delete i.schema.examples,delete i.schema.default),this.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,this.seen.get(e).schema}emit(e,n){let r={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let a=h=>{let p=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){let y=r.external.registry.get(h[0])?.id,T=r.external.uri??(I=>I);if(y)return{ref:T(y)};let w=h[1].defId??h[1].schema.id??`schema${this.counter++}`;return h[1].defId=w,{defId:w,ref:`${T("__shared")}#/${p}/${w}`}}if(h[1]===o)return{ref:"#"};let f=`#/${p}/`,m=h[1].schema.id??`__schema${this.counter++}`;return{defId:m,ref:f+m}},s=h=>{if(h[1].schema.$ref)return;let p=h[1],{ref:g,defId:f}=a(h);p.def={...p.schema},f&&(p.defId=f);let m=p.schema;for(let y in m)delete m[y];m.$ref=g};if(r.cycles==="throw")for(let h of this.seen.entries()){let p=h[1];if(p.cycle)throw new Error(`Cycle detected: #/${p.cycle?.join("/")}/<root>
37
37
 
38
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let h of this.seen.entries()){let p=h[1];if(e===h[0]){s(h);continue}if(r.external){let f=r.external.registry.get(h[0])?.id;if(e!==h[0]&&f){s(h);continue}}if(this.metadataRegistry.get(h[0])?.id){s(h);continue}if(p.cycle){s(h);continue}if(p.count>1&&r.reused==="ref"){s(h);continue}}let i=(h,p)=>{let g=this.seen.get(h),f=g.def??g.schema,m={...f};if(g.ref===null)return;let y=g.ref;if(g.ref=null,y){i(y,p);let T=this.seen.get(y).schema;T.$ref&&p.target==="draft-7"?(f.allOf=f.allOf??[],f.allOf.push(T)):(Object.assign(f,T),Object.assign(f,m))}g.isParent||this.override({zodSchema:h,jsonSchema:f,path:g.path??[]})};for(let h of[...this.seen.entries()].reverse())i(h[0],{target:this.target});let l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),r.external?.uri){let h=r.external.registry.get(e)?.id;if(!h)throw new Error("Schema is missing an `id` property");l.$id=r.external.uri(h)}Object.assign(l,o.def);let d=r.external?.defs??{};for(let h of this.seen.entries()){let p=h[1];p.def&&p.defId&&(d[p.defId]=p.def)}r.external||Object.keys(d).length>0&&(this.target==="draft-2020-12"?l.$defs=d:l.definitions=d);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}};function Mc(t,e){if(t instanceof Mr){let r=new aa(e),o={};for(let i of t._idmap.entries()){let[l,d]=i;r.process(d)}let a={},s={registry:t,uri:e?.uri,defs:o};for(let i of t._idmap.entries()){let[l,d]=i;a[l]=r.emit(d,{...e,external:s})}if(Object.keys(o).length>0){let i=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[i]:o}}return{schemas:a}}let n=new aa(e);return n.process(t),n.emit(t,e)}function Ee(t,e){let n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Ee(o.element,n);case"object":{for(let a in o.shape)if(Ee(o.shape[a],n))return!0;return!1}case"union":{for(let a of o.options)if(Ee(a,n))return!0;return!1}case"intersection":return Ee(o.left,n)||Ee(o.right,n);case"tuple":{for(let a of o.items)if(Ee(a,n))return!0;return!!(o.rest&&Ee(o.rest,n))}case"record":return Ee(o.keyType,n)||Ee(o.valueType,n);case"map":return Ee(o.keyType,n)||Ee(o.valueType,n);case"set":return Ee(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ee(o.innerType,n);case"lazy":return Ee(o.getter(),n);case"default":return Ee(o.innerType,n);case"prefault":return Ee(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return Ee(o.in,n)||Ee(o.out,n);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}u();u();var MT=b("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");re.init(t,e),t.def=e,t.parse=(n,r)=>ti(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>En(t,n,r),t.parseAsync=async(n,r)=>ri(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>Tn(t,n,r),t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),t.clone=(n,r)=>We(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t))});var zT=b("ZodMiniObject",(t,e)=>{Jo.init(t,e),MT.init(t,e),Y.defineLazy(t,"shape",()=>e.shape)});function zc(t,e){let n={type:"object",get shape(){return Y.assignProp(this,"shape",{...t}),this.shape},...Y.normalizeParams(e)};return new zT(n)}function Xe(t){return!!t._zod}function vn(t){let e=Object.values(t);if(e.length===0)return zc({});let n=e.every(Xe),r=e.every(o=>!Xe(o));if(n)return zc(t);if(r)return js(t);throw new Error("Mixed Zod versions detected in object shape.")}function Ft(t,e){return Xe(t)?En(t,e):t.safeParse(e)}async function sa(t,e){return Xe(t)?await Tn(t,e):await t.safeParseAsync(e)}function jt(t){if(!t)return;let e;if(Xe(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Xn(t){if(t){if(typeof t=="object"){let e=t,n=t;if(!e._def&&!n._zod){let r=Object.values(t);if(r.length>0&&r.every(o=>typeof o=="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse=="function")))return vn(t)}}if(Xe(t)){let n=t._zod?.def;if(n&&(n.type==="object"||n.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function ia(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function ap(t){return t.description}function sp(t){if(Xe(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function ca(t){if(Xe(t)){let a=t._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let r=t.value;if(r!==void 0)return r}u();u();u();u();var Fr={};Rs(Fr,{ZodISODate:()=>cp,ZodISODateTime:()=>ip,ZodISODuration:()=>dp,ZodISOTime:()=>lp,date:()=>Fc,datetime:()=>Uc,duration:()=>Gc,time:()=>jc});u();var ip=b("ZodISODateTime",(t,e)=>{Vh.init(t,e),he.init(t,e)});function Uc(t){return Qh(ip,t)}var cp=b("ZodISODate",(t,e)=>{Wh.init(t,e),he.init(t,e)});function Fc(t){return ep(cp,t)}var lp=b("ZodISOTime",(t,e)=>{Hh.init(t,e),he.init(t,e)});function jc(t){return tp(lp,t)}var dp=b("ZodISODuration",(t,e)=>{Yh.init(t,e),he.init(t,e)});function Gc(t){return np(dp,t)}u();u();var up=(t,e)=>{Vo.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>Qs(t,n)},flatten:{value:n=>Xs(t,n)},addIssue:{value:n=>t.issues.push(n)},addIssues:{value:n=>t.issues.push(...n)},isEmpty:{get(){return t.issues.length===0}}})},_R=b("ZodError",up),jr=b("ZodError",up,{Parent:Error});var hp=ei(jr),pp=ni(jr),mp=oi(jr),fp=ai(jr);var _e=b("ZodType",(t,e)=>(re.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),t.clone=(n,r)=>We(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>hp(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>mp(t,n,r),t.parseAsync=async(n,r)=>pp(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>fp(t,n,r),t.spa=t.safeParseAsync,t.refine=(n,r)=>t.check(Lb(n,r)),t.superRefine=n=>t.check($b(n)),t.overwrite=n=>t.check(bn(n)),t.optional=()=>me(t),t.nullable=()=>yp(t),t.nullish=()=>me(yp(t)),t.nonoptional=n=>Nb(t,n),t.array=()=>K(t),t.or=n=>le([t,n]),t.and=n=>da(t,n),t.transform=n=>Bc(t,Ip(n)),t.default=n=>Ab(t,n),t.prefault=n=>Ob(t,n),t.catch=n=>Cb(t,n),t.pipe=n=>Bc(t,n),t.readonly=()=>kb(t),t.describe=n=>{let r=t.clone();return Ut.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return Ut.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Ut.get(t);let r=t.clone();return Ut.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Ep=b("_ZodString",(t,e)=>{$r.init(t,e),_e.init(t,e);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(Ac(...r)),t.includes=(...r)=>t.check(Nc(...r)),t.startsWith=(...r)=>t.check(Pc(...r)),t.endsWith=(...r)=>t.check(Cc(...r)),t.min=(...r)=>t.check(Jn(...r)),t.max=(...r)=>t.check(ra(...r)),t.length=(...r)=>t.check(oa(...r)),t.nonempty=(...r)=>t.check(Jn(1,...r)),t.lowercase=r=>t.check(Sc(r)),t.uppercase=r=>t.check(Oc(r)),t.trim=()=>t.check(Rc()),t.normalize=(...r)=>t.check(Dc(...r)),t.toLowerCase=()=>t.check(kc()),t.toUpperCase=()=>t.check(xc())}),WT=b("ZodString",(t,e)=>{$r.init(t,e),Ep.init(t,e),t.email=n=>t.check(Xi(HT,n)),t.url=n=>t.check(rc(YT,n)),t.jwt=n=>t.check(yc(db,n)),t.emoji=n=>t.check(oc(KT,n)),t.guid=n=>t.check(Qo(_p,n)),t.uuid=n=>t.check(Qi(la,n)),t.uuidv4=n=>t.check(ec(la,n)),t.uuidv6=n=>t.check(tc(la,n)),t.uuidv7=n=>t.check(nc(la,n)),t.nanoid=n=>t.check(ac(JT,n)),t.guid=n=>t.check(Qo(_p,n)),t.cuid=n=>t.check(sc(XT,n)),t.cuid2=n=>t.check(ic(QT,n)),t.ulid=n=>t.check(cc(eb,n)),t.base64=n=>t.check(fc(ib,n)),t.base64url=n=>t.check(_c(cb,n)),t.xid=n=>t.check(lc(tb,n)),t.ksuid=n=>t.check(dc(nb,n)),t.ipv4=n=>t.check(uc(rb,n)),t.ipv6=n=>t.check(hc(ob,n)),t.cidrv4=n=>t.check(pc(ab,n)),t.cidrv6=n=>t.check(mc(sb,n)),t.e164=n=>t.check(gc(lb,n)),t.datetime=n=>t.check(Uc(n)),t.date=n=>t.check(Fc(n)),t.time=n=>t.check(jc(n)),t.duration=n=>t.check(Gc(n))});function E(t){return Ji(WT,t)}var he=b("ZodStringFormat",(t,e)=>{ie.init(t,e),Ep.init(t,e)}),HT=b("ZodEmail",(t,e)=>{pi.init(t,e),he.init(t,e)});var _p=b("ZodGUID",(t,e)=>{ui.init(t,e),he.init(t,e)});var la=b("ZodUUID",(t,e)=>{hi.init(t,e),he.init(t,e)});var YT=b("ZodURL",(t,e)=>{mi.init(t,e),he.init(t,e)});var KT=b("ZodEmoji",(t,e)=>{fi.init(t,e),he.init(t,e)});var JT=b("ZodNanoID",(t,e)=>{_i.init(t,e),he.init(t,e)});var XT=b("ZodCUID",(t,e)=>{gi.init(t,e),he.init(t,e)});var QT=b("ZodCUID2",(t,e)=>{yi.init(t,e),he.init(t,e)});var eb=b("ZodULID",(t,e)=>{Ei.init(t,e),he.init(t,e)});var tb=b("ZodXID",(t,e)=>{Ti.init(t,e),he.init(t,e)});var nb=b("ZodKSUID",(t,e)=>{bi.init(t,e),he.init(t,e)});var rb=b("ZodIPv4",(t,e)=>{wi.init(t,e),he.init(t,e)});var ob=b("ZodIPv6",(t,e)=>{vi.init(t,e),he.init(t,e)});var ab=b("ZodCIDRv4",(t,e)=>{Ii.init(t,e),he.init(t,e)});var sb=b("ZodCIDRv6",(t,e)=>{Ai.init(t,e),he.init(t,e)});var ib=b("ZodBase64",(t,e)=>{Si.init(t,e),he.init(t,e)});var cb=b("ZodBase64URL",(t,e)=>{Oi.init(t,e),he.init(t,e)});var lb=b("ZodE164",(t,e)=>{Ni.init(t,e),he.init(t,e)});var db=b("ZodJWT",(t,e)=>{Pi.init(t,e),he.init(t,e)});var Tp=b("ZodNumber",(t,e)=>{Ko.init(t,e),_e.init(t,e),t.gt=(r,o)=>t.check(ta(r,o)),t.gte=(r,o)=>t.check(Ur(r,o)),t.min=(r,o)=>t.check(Ur(r,o)),t.lt=(r,o)=>t.check(ea(r,o)),t.lte=(r,o)=>t.check(zr(r,o)),t.max=(r,o)=>t.check(zr(r,o)),t.int=r=>t.check(gp(r)),t.safe=r=>t.check(gp(r)),t.positive=r=>t.check(ta(0,r)),t.nonnegative=r=>t.check(Ur(0,r)),t.negative=r=>t.check(ea(0,r)),t.nonpositive=r=>t.check(zr(0,r)),t.multipleOf=(r,o)=>t.check(na(r,o)),t.step=(r,o)=>t.check(na(r,o)),t.finite=()=>t;let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function ne(t){return Ec(Tp,t)}var ub=b("ZodNumberFormat",(t,e)=>{Ci.init(t,e),Tp.init(t,e)});function gp(t){return Tc(ub,t)}var hb=b("ZodBoolean",(t,e)=>{Di.init(t,e),_e.init(t,e)});function we(t){return bc(hb,t)}var pb=b("ZodNull",(t,e)=>{Ri.init(t,e),_e.init(t,e)});function bp(t){return wc(pb,t)}var mb=b("ZodUnknown",(t,e)=>{ki.init(t,e),_e.init(t,e)});function pe(){return vc(mb)}var fb=b("ZodNever",(t,e)=>{xi.init(t,e),_e.init(t,e)});function _b(t){return Ic(fb,t)}var gb=b("ZodArray",(t,e)=>{Li.init(t,e),_e.init(t,e),t.element=e.element,t.min=(n,r)=>t.check(Jn(n,r)),t.nonempty=n=>t.check(Jn(1,n)),t.max=(n,r)=>t.check(ra(n,r)),t.length=(n,r)=>t.check(oa(n,r)),t.unwrap=()=>t.element});function K(t,e){return rp(gb,t,e)}var wp=b("ZodObject",(t,e)=>{Jo.init(t,e),_e.init(t,e),Y.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>je(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:pe()}),t.loose=()=>t.clone({...t._zod.def,catchall:pe()}),t.strict=()=>t.clone({...t._zod.def,catchall:_b()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>Y.extend(t,n),t.merge=n=>Y.merge(t,n),t.pick=n=>Y.pick(t,n),t.omit=n=>Y.omit(t,n),t.partial=(...n)=>Y.partial(Ap,t,n[0]),t.required=(...n)=>Y.required(Sp,t,n[0])});function C(t,e){let n={type:"object",get shape(){return Y.assignProp(this,"shape",{...t}),this.shape},...Y.normalizeParams(e)};return new wp(n)}function xe(t,e){return new wp({type:"object",get shape(){return Y.assignProp(this,"shape",{...t}),this.shape},catchall:pe(),...Y.normalizeParams(e)})}var vp=b("ZodUnion",(t,e)=>{Xo.init(t,e),_e.init(t,e),t.options=e.options});function le(t,e){return new vp({type:"union",options:t,...Y.normalizeParams(e)})}var yb=b("ZodDiscriminatedUnion",(t,e)=>{vp.init(t,e),$i.init(t,e)});function qc(t,e,n){return new yb({type:"union",options:e,discriminator:t,...Y.normalizeParams(n)})}var Eb=b("ZodIntersection",(t,e)=>{Mi.init(t,e),_e.init(t,e)});function da(t,e){return new Eb({type:"intersection",left:t,right:e})}var Tb=b("ZodRecord",(t,e)=>{zi.init(t,e),_e.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function ce(t,e,n){return new Tb({type:"record",keyType:t,valueType:e,...Y.normalizeParams(n)})}var Zc=b("ZodEnum",(t,e)=>{Ui.init(t,e),_e.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let n=new Set(Object.keys(e.entries));t.extract=(r,o)=>{let a={};for(let s of r)if(n.has(s))a[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Zc({...e,checks:[],...Y.normalizeParams(o),entries:a})},t.exclude=(r,o)=>{let a={...e.entries};for(let s of r)if(n.has(s))delete a[s];else throw new Error(`Key ${s} not found in enum`);return new Zc({...e,checks:[],...Y.normalizeParams(o),entries:a})}});function je(t,e){let n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new Zc({type:"enum",entries:n,...Y.normalizeParams(e)})}var bb=b("ZodLiteral",(t,e)=>{Fi.init(t,e),_e.init(t,e),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 bb({type:"literal",values:Array.isArray(t)?t:[t],...Y.normalizeParams(e)})}var wb=b("ZodTransform",(t,e)=>{ji.init(t,e),_e.init(t,e),t._zod.parse=(n,r)=>{n.addIssue=a=>{if(typeof a=="string")n.issues.push(Y.issue(a,n.value,e));else{let s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!0),n.issues.push(Y.issue(s))}};let o=e.transform(n.value,n);return o instanceof Promise?o.then(a=>(n.value=a,n)):(n.value=o,n)}});function Ip(t){return new wb({type:"transform",transform:t})}var Ap=b("ZodOptional",(t,e)=>{Gi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType});function me(t){return new Ap({type:"optional",innerType:t})}var vb=b("ZodNullable",(t,e)=>{Zi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType});function yp(t){return new vb({type:"nullable",innerType:t})}var Ib=b("ZodDefault",(t,e)=>{Bi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Ab(t,e){return new Ib({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Sb=b("ZodPrefault",(t,e)=>{qi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ob(t,e){return new Sb({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Sp=b("ZodNonOptional",(t,e)=>{Vi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Nb(t,e){return new Sp({type:"nonoptional",innerType:t,...Y.normalizeParams(e)})}var Pb=b("ZodCatch",(t,e)=>{Wi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Cb(t,e){return new Pb({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Db=b("ZodPipe",(t,e)=>{Hi.init(t,e),_e.init(t,e),t.in=e.in,t.out=e.out});function Bc(t,e){return new Db({type:"pipe",in:t,out:e})}var Rb=b("ZodReadonly",(t,e)=>{Yi.init(t,e),_e.init(t,e)});function kb(t){return new Rb({type:"readonly",innerType:t})}var Op=b("ZodCustom",(t,e)=>{Ki.init(t,e),_e.init(t,e)});function xb(t){let e=new Ie({check:"custom"});return e._zod.check=t,e}function Np(t,e){return Lc(Op,t??(()=>!0),e)}function Lb(t,e={}){return $c(Op,t,e)}function $b(t){let e=xb(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Y.issue(r,n.value,e._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),n.issues.push(Y.issue(o))}},t(n.value,n)));return e}function Vc(t,e){return Bc(Ip(t),e)}Ve(Jh());var Hc="2025-11-25";var Pp=[Hc,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Gt="io.modelcontextprotocol/related-task",ha="2.0",Te=Np(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Cp=le([E(),ne().int()]),Dp=E(),xR=xe({ttl:ne().optional(),pollInterval:ne().optional()}),Mb=C({ttl:ne().optional()}),zb=C({taskId:E()}),Yc=xe({progressToken:Cp.optional(),[Gt]:zb.optional()}),He=C({_meta:Yc.optional()}),Gr=He.extend({task:Mb.optional()}),Rp=t=>Gr.safeParse(t).success,Ae=C({method:E(),params:He.loose().optional()}),Qe=C({_meta:Yc.optional()}),et=C({method:E(),params:Qe.loose().optional()}),Se=xe({_meta:Yc.optional()}),pa=le([E(),ne().int()]),kp=C({jsonrpc:x(ha),id:pa,...Ae.shape}).strict(),Kc=t=>kp.safeParse(t).success,xp=C({jsonrpc:x(ha),...et.shape}).strict(),Lp=t=>xp.safeParse(t).success,Jc=C({jsonrpc:x(ha),id:pa,result:Se}).strict(),Zr=t=>Jc.safeParse(t).success;var $;(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"})($||($={}));var Xc=C({jsonrpc:x(ha),id:pa.optional(),error:C({code:ne().int(),message:E(),data:pe().optional()})}).strict();var $p=t=>Xc.safeParse(t).success;var LR=le([kp,xp,Jc,Xc]),$R=le([Jc,Xc]),ma=Se.strict(),Ub=Qe.extend({requestId:pa.optional(),reason:E().optional()}),fa=et.extend({method:x("notifications/cancelled"),params:Ub}),Fb=C({src:E(),mimeType:E().optional(),sizes:K(E()).optional(),theme:je(["light","dark"]).optional()}),Br=C({icons:K(Fb).optional()}),Qn=C({name:E(),title:E().optional()}),Mp=Qn.extend({...Qn.shape,...Br.shape,version:E(),websiteUrl:E().optional(),description:E().optional()}),jb=da(C({applyDefaults:we().optional()}),ce(E(),pe())),Gb=Vc(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,da(C({form:jb.optional(),url:Te.optional()}),ce(E(),pe()).optional())),Zb=xe({list:Te.optional(),cancel:Te.optional(),requests:xe({sampling:xe({createMessage:Te.optional()}).optional(),elicitation:xe({create:Te.optional()}).optional()}).optional()}),Bb=xe({list:Te.optional(),cancel:Te.optional(),requests:xe({tools:xe({call:Te.optional()}).optional()}).optional()}),qb=C({experimental:ce(E(),Te).optional(),sampling:C({context:Te.optional(),tools:Te.optional()}).optional(),elicitation:Gb.optional(),roots:C({listChanged:we().optional()}).optional(),tasks:Zb.optional(),extensions:ce(E(),Te).optional()}),Vb=He.extend({protocolVersion:E(),capabilities:qb,clientInfo:Mp}),Qc=Ae.extend({method:x("initialize"),params:Vb});var Wb=C({experimental:ce(E(),Te).optional(),logging:Te.optional(),completions:Te.optional(),prompts:C({listChanged:we().optional()}).optional(),resources:C({subscribe:we().optional(),listChanged:we().optional()}).optional(),tools:C({listChanged:we().optional()}).optional(),tasks:Bb.optional(),extensions:ce(E(),Te).optional()}),Hb=Se.extend({protocolVersion:E(),capabilities:Wb,serverInfo:Mp,instructions:E().optional()}),el=et.extend({method:x("notifications/initialized"),params:Qe.optional()});var _a=Ae.extend({method:x("ping"),params:He.optional()}),Yb=C({progress:ne(),total:me(ne()),message:me(E())}),Kb=C({...Qe.shape,...Yb.shape,progressToken:Cp}),ga=et.extend({method:x("notifications/progress"),params:Kb}),Jb=He.extend({cursor:Dp.optional()}),qr=Ae.extend({params:Jb.optional()}),Vr=Se.extend({nextCursor:Dp.optional()}),Xb=je(["working","input_required","completed","failed","cancelled"]),Wr=C({taskId:E(),status:Xb,ttl:le([ne(),bp()]),createdAt:E(),lastUpdatedAt:E(),pollInterval:me(ne()),statusMessage:me(E())}),er=Se.extend({task:Wr}),Qb=Qe.merge(Wr),Hr=et.extend({method:x("notifications/tasks/status"),params:Qb}),ya=Ae.extend({method:x("tasks/get"),params:He.extend({taskId:E()})}),Ea=Se.merge(Wr),Ta=Ae.extend({method:x("tasks/result"),params:He.extend({taskId:E()})}),MR=Se.loose(),ba=qr.extend({method:x("tasks/list")}),wa=Vr.extend({tasks:K(Wr)}),va=Ae.extend({method:x("tasks/cancel"),params:He.extend({taskId:E()})}),zp=Se.merge(Wr),Up=C({uri:E(),mimeType:me(E()),_meta:ce(E(),pe()).optional()}),Fp=Up.extend({text:E()}),tl=E().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),jp=Up.extend({blob:tl}),Yr=je(["user","assistant"]),tr=C({audience:K(Yr).optional(),priority:ne().min(0).max(1).optional(),lastModified:Fr.datetime({offset:!0}).optional()}),Gp=C({...Qn.shape,...Br.shape,uri:E(),description:me(E()),mimeType:me(E()),size:me(ne()),annotations:tr.optional(),_meta:me(xe({}))}),ew=C({...Qn.shape,...Br.shape,uriTemplate:E(),description:me(E()),mimeType:me(E()),annotations:tr.optional(),_meta:me(xe({}))}),Ia=qr.extend({method:x("resources/list")}),tw=Vr.extend({resources:K(Gp)}),Aa=qr.extend({method:x("resources/templates/list")}),nw=Vr.extend({resourceTemplates:K(ew)}),nl=He.extend({uri:E()}),rw=nl,Sa=Ae.extend({method:x("resources/read"),params:rw}),ow=Se.extend({contents:K(le([Fp,jp]))}),aw=et.extend({method:x("notifications/resources/list_changed"),params:Qe.optional()}),sw=nl,iw=Ae.extend({method:x("resources/subscribe"),params:sw}),cw=nl,lw=Ae.extend({method:x("resources/unsubscribe"),params:cw}),dw=Qe.extend({uri:E()}),uw=et.extend({method:x("notifications/resources/updated"),params:dw}),hw=C({name:E(),description:me(E()),required:me(we())}),pw=C({...Qn.shape,...Br.shape,description:me(E()),arguments:me(K(hw)),_meta:me(xe({}))}),Oa=qr.extend({method:x("prompts/list")}),mw=Vr.extend({prompts:K(pw)}),fw=He.extend({name:E(),arguments:ce(E(),E()).optional()}),Na=Ae.extend({method:x("prompts/get"),params:fw}),rl=C({type:x("text"),text:E(),annotations:tr.optional(),_meta:ce(E(),pe()).optional()}),ol=C({type:x("image"),data:tl,mimeType:E(),annotations:tr.optional(),_meta:ce(E(),pe()).optional()}),al=C({type:x("audio"),data:tl,mimeType:E(),annotations:tr.optional(),_meta:ce(E(),pe()).optional()}),_w=C({type:x("tool_use"),name:E(),id:E(),input:ce(E(),pe()),_meta:ce(E(),pe()).optional()}),gw=C({type:x("resource"),resource:le([Fp,jp]),annotations:tr.optional(),_meta:ce(E(),pe()).optional()}),yw=Gp.extend({type:x("resource_link")}),sl=le([rl,ol,al,yw,gw]),Ew=C({role:Yr,content:sl}),Tw=Se.extend({description:E().optional(),messages:K(Ew)}),bw=et.extend({method:x("notifications/prompts/list_changed"),params:Qe.optional()}),ww=C({title:E().optional(),readOnlyHint:we().optional(),destructiveHint:we().optional(),idempotentHint:we().optional(),openWorldHint:we().optional()}),vw=C({taskSupport:je(["required","optional","forbidden"]).optional()}),Zp=C({...Qn.shape,...Br.shape,description:E().optional(),inputSchema:C({type:x("object"),properties:ce(E(),Te).optional(),required:K(E()).optional()}).catchall(pe()),outputSchema:C({type:x("object"),properties:ce(E(),Te).optional(),required:K(E()).optional()}).catchall(pe()).optional(),annotations:ww.optional(),execution:vw.optional(),_meta:ce(E(),pe()).optional()}),Pa=qr.extend({method:x("tools/list")}),Iw=Vr.extend({tools:K(Zp)}),Ca=Se.extend({content:K(sl).default([]),structuredContent:ce(E(),pe()).optional(),isError:we().optional()}),zR=Ca.or(Se.extend({toolResult:pe()})),Aw=Gr.extend({name:E(),arguments:ce(E(),pe()).optional()}),nr=Ae.extend({method:x("tools/call"),params:Aw}),Sw=et.extend({method:x("notifications/tools/list_changed"),params:Qe.optional()}),UR=C({autoRefresh:we().default(!0),debounceMs:ne().int().nonnegative().default(300)}),Kr=je(["debug","info","notice","warning","error","critical","alert","emergency"]),Ow=He.extend({level:Kr}),il=Ae.extend({method:x("logging/setLevel"),params:Ow}),Nw=Qe.extend({level:Kr,logger:E().optional(),data:pe()}),Pw=et.extend({method:x("notifications/message"),params:Nw}),Cw=C({name:E().optional()}),Dw=C({hints:K(Cw).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),Rw=C({mode:je(["auto","required","none"]).optional()}),kw=C({type:x("tool_result"),toolUseId:E().describe("The unique identifier for the corresponding tool call."),content:K(sl).default([]),structuredContent:C({}).loose().optional(),isError:we().optional(),_meta:ce(E(),pe()).optional()}),xw=qc("type",[rl,ol,al]),ua=qc("type",[rl,ol,al,_w,kw]),Lw=C({role:Yr,content:le([ua,K(ua)]),_meta:ce(E(),pe()).optional()}),$w=Gr.extend({messages:K(Lw),modelPreferences:Dw.optional(),systemPrompt:E().optional(),includeContext:je(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:K(E()).optional(),metadata:Te.optional(),tools:K(Zp).optional(),toolChoice:Rw.optional()}),Mw=Ae.extend({method:x("sampling/createMessage"),params:$w}),Jr=Se.extend({model:E(),stopReason:me(je(["endTurn","stopSequence","maxTokens"]).or(E())),role:Yr,content:xw}),cl=Se.extend({model:E(),stopReason:me(je(["endTurn","stopSequence","maxTokens","toolUse"]).or(E())),role:Yr,content:le([ua,K(ua)])}),zw=C({type:x("boolean"),title:E().optional(),description:E().optional(),default:we().optional()}),Uw=C({type:x("string"),title:E().optional(),description:E().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:je(["email","uri","date","date-time"]).optional(),default:E().optional()}),Fw=C({type:je(["number","integer"]),title:E().optional(),description:E().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),jw=C({type:x("string"),title:E().optional(),description:E().optional(),enum:K(E()),default:E().optional()}),Gw=C({type:x("string"),title:E().optional(),description:E().optional(),oneOf:K(C({const:E(),title:E()})),default:E().optional()}),Zw=C({type:x("string"),title:E().optional(),description:E().optional(),enum:K(E()),enumNames:K(E()).optional(),default:E().optional()}),Bw=le([jw,Gw]),qw=C({type:x("array"),title:E().optional(),description:E().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:C({type:x("string"),enum:K(E())}),default:K(E()).optional()}),Vw=C({type:x("array"),title:E().optional(),description:E().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:C({anyOf:K(C({const:E(),title:E()}))}),default:K(E()).optional()}),Ww=le([qw,Vw]),Hw=le([Zw,Bw,Ww]),Yw=le([Hw,zw,Uw,Fw]),Kw=Gr.extend({mode:x("form").optional(),message:E(),requestedSchema:C({type:x("object"),properties:ce(E(),Yw),required:K(E()).optional()})}),Jw=Gr.extend({mode:x("url"),message:E(),elicitationId:E(),url:E().url()}),Xw=le([Kw,Jw]),Qw=Ae.extend({method:x("elicitation/create"),params:Xw}),ev=Qe.extend({elicitationId:E()}),tv=et.extend({method:x("notifications/elicitation/complete"),params:ev}),rr=Se.extend({action:je(["accept","decline","cancel"]),content:Vc(t=>t===null?void 0:t,ce(E(),le([E(),ne(),we(),K(E())])).optional())}),nv=C({type:x("ref/resource"),uri:E()});var rv=C({type:x("ref/prompt"),name:E()}),ov=He.extend({ref:le([rv,nv]),argument:C({name:E(),value:E()}),context:C({arguments:ce(E(),E()).optional()}).optional()}),Da=Ae.extend({method:x("completion/complete"),params:ov});function Bp(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function qp(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var av=Se.extend({completion:xe({values:K(E()).max(100),total:me(ne().int()),hasMore:me(we())})}),sv=C({uri:E().startsWith("file://"),name:E().optional(),_meta:ce(E(),pe()).optional()}),iv=Ae.extend({method:x("roots/list"),params:He.optional()}),ll=Se.extend({roots:K(sv)}),cv=et.extend({method:x("notifications/roots/list_changed"),params:Qe.optional()}),FR=le([_a,Qc,Da,il,Na,Oa,Ia,Aa,Sa,iw,lw,nr,Pa,ya,Ta,ba,va]),jR=le([fa,ga,el,cv,Hr]),GR=le([ma,Jr,cl,rr,ll,Ea,wa,er]),ZR=le([_a,Mw,Qw,iv,ya,Ta,ba,va]),BR=le([fa,ga,Pw,uw,aw,Sw,bw,Hr,tv]),qR=le([ma,Hb,av,Tw,mw,tw,nw,ow,Ca,Iw,Ea,wa,er]),k=class t extends Error{constructor(e,n,r){super(`MCP error ${e}: ${n}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,n,r){if(e===$.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new Wc(o.elicitations,n)}return new t(e,n,r)}},Wc=class extends k{constructor(e,n=`URL elicitation${e.length>1?"s":""} required`){super($.UrlElicitationRequired,n,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};u();function Zt(t){return t==="completed"||t==="failed"||t==="cancelled"}u();u();u();var Wp=Symbol("Let zodToJsonSchema decide on which parser to use");var Vp={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Hp=t=>typeof t=="string"?{...Vp,name:t}:{...Vp,...t};u();var Yp=t=>{let e=Hp(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}};u();function dl(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage={...t.errorMessage,[e]:n})}function J(t,e,n,r,o){t[e]=n,dl(t,e,r,o)}u();var Ra=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};u();u();u();function fe(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Ra(e,t.currentPath):e.join("/")}}u();function Kp(t,e){let n={type:"array"};return t.type?._def&&t.type?._def?.typeName!==A.ZodAny&&(n.items=F(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&J(n,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&J(n,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(J(n,"minItems",t.exactLength.value,t.exactLength.message,e),J(n,"maxItems",t.exactLength.value,t.exactLength.message,e)),n}u();function Jp(t,e){let n={type:"integer",format:"int64"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"?r.inclusive?J(n,"minimum",r.value,r.message,e):J(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),J(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?J(n,"maximum",r.value,r.message,e):J(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),J(n,"maximum",r.value,r.message,e));break;case"multipleOf":J(n,"multipleOf",r.value,r.message,e);break}return n}u();function Xp(){return{type:"boolean"}}u();function ka(t,e){return F(t.type._def,e)}u();var Qp=(t,e)=>F(t.innerType._def,e);u();function ul(t,e,n){let r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((o,a)=>ul(t,e,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return lv(t,e)}}var lv=(t,e)=>{let n={type:"integer",format:"unix-time"};if(e.target==="openApi3")return n;for(let r of t.checks)switch(r.kind){case"min":J(n,"minimum",r.value,r.message,e);break;case"max":J(n,"maximum",r.value,r.message,e);break}return n};u();function em(t,e){return{...F(t.innerType._def,e),default:t.defaultValue()}}u();function tm(t,e){return e.effectStrategy==="input"?F(t.schema._def,e):fe(e)}u();function nm(t){return{type:"string",enum:Array.from(t.values)}}u();var dv=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function rm(t,e){let n=[F(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),F(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(a=>!!a),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(a=>{if(dv(a))o.push(...a.allOf),a.unevaluatedProperties===void 0&&(r=void 0);else{let s=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:i,...l}=a;s=l}else r=void 0;o.push(s)}}),o.length?{allOf:o,...r}:void 0}u();function om(t,e){let n=typeof t.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[t.value]}:{type:n==="bigint"?"integer":n,const:t.value}}u();u();u();var hl,it={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(hl===void 0&&(hl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),hl),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function xa(t,e){let n={type:"string"};if(t.checks)for(let r of t.checks)switch(r.kind){case"min":J(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,e);break;case"max":J(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,e);break;case"email":switch(e.emailStrategy){case"format:email":ct(n,"email",r.message,e);break;case"format:idn-email":ct(n,"idn-email",r.message,e);break;case"pattern:zod":Le(n,it.email,r.message,e);break}break;case"url":ct(n,"uri",r.message,e);break;case"uuid":ct(n,"uuid",r.message,e);break;case"regex":Le(n,r.regex,r.message,e);break;case"cuid":Le(n,it.cuid,r.message,e);break;case"cuid2":Le(n,it.cuid2,r.message,e);break;case"startsWith":Le(n,RegExp(`^${pl(r.value,e)}`),r.message,e);break;case"endsWith":Le(n,RegExp(`${pl(r.value,e)}$`),r.message,e);break;case"datetime":ct(n,"date-time",r.message,e);break;case"date":ct(n,"date",r.message,e);break;case"time":ct(n,"time",r.message,e);break;case"duration":ct(n,"duration",r.message,e);break;case"length":J(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,e),J(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,e);break;case"includes":{Le(n,RegExp(pl(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&ct(n,"ipv4",r.message,e),r.version!=="v4"&&ct(n,"ipv6",r.message,e);break}case"base64url":Le(n,it.base64url,r.message,e);break;case"jwt":Le(n,it.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&Le(n,it.ipv4Cidr,r.message,e),r.version!=="v4"&&Le(n,it.ipv6Cidr,r.message,e);break}case"emoji":Le(n,it.emoji(),r.message,e);break;case"ulid":{Le(n,it.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ct(n,"binary",r.message,e);break}case"contentEncoding:base64":{J(n,"contentEncoding","base64",r.message,e);break}case"pattern:zod":{Le(n,it.base64,r.message,e);break}}break}case"nanoid":Le(n,it.nanoid,r.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}function pl(t,e){return e.patternStrategy==="escape"?hv(t):t}var uv=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function hv(t){let e="";for(let n=0;n<t.length;n++)uv.has(t[n])||(e+="\\"),e+=t[n];return e}function ct(t,e,n,r){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&r.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...n&&r.errorMessages&&{errorMessage:{format:n}}})):J(t,"format",e,n,r)}function Le(t,e,n,r){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&r.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:am(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):J(t,"pattern",am(e,r),n,r)}function am(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let n={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=n.i?t.source.toLowerCase():t.source,o="",a=!1,s=!1,i=!1;for(let l=0;l<r.length;l++){if(a){o+=r[l],a=!1;continue}if(n.i){if(s){if(r[l].match(/[a-z]/)){i?(o+=r[l],o+=`${r[l-2]}-${r[l]}`.toUpperCase(),i=!1):r[l+1]==="-"&&r[l+2]?.match(/[a-z]/)?(o+=r[l],i=!0):o+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){o+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(n.m){if(r[l]==="^"){o+=`(^|(?<=[\r
38
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let h of this.seen.entries()){let p=h[1];if(e===h[0]){s(h);continue}if(r.external){let f=r.external.registry.get(h[0])?.id;if(e!==h[0]&&f){s(h);continue}}if(this.metadataRegistry.get(h[0])?.id){s(h);continue}if(p.cycle){s(h);continue}if(p.count>1&&r.reused==="ref"){s(h);continue}}let i=(h,p)=>{let g=this.seen.get(h),f=g.def??g.schema,m={...f};if(g.ref===null)return;let y=g.ref;if(g.ref=null,y){i(y,p);let T=this.seen.get(y).schema;T.$ref&&p.target==="draft-7"?(f.allOf=f.allOf??[],f.allOf.push(T)):(Object.assign(f,T),Object.assign(f,m))}g.isParent||this.override({zodSchema:h,jsonSchema:f,path:g.path??[]})};for(let h of[...this.seen.entries()].reverse())i(h[0],{target:this.target});let l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),r.external?.uri){let h=r.external.registry.get(e)?.id;if(!h)throw new Error("Schema is missing an `id` property");l.$id=r.external.uri(h)}Object.assign(l,o.def);let d=r.external?.defs??{};for(let h of this.seen.entries()){let p=h[1];p.def&&p.defId&&(d[p.defId]=p.def)}r.external||Object.keys(d).length>0&&(this.target==="draft-2020-12"?l.$defs=d:l.definitions=d);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}};function Uc(t,e){if(t instanceof zr){let r=new sa(e),o={};for(let i of t._idmap.entries()){let[l,d]=i;r.process(d)}let a={},s={registry:t,uri:e?.uri,defs:o};for(let i of t._idmap.entries()){let[l,d]=i;a[l]=r.emit(d,{...e,external:s})}if(Object.keys(o).length>0){let i=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[i]:o}}return{schemas:a}}let n=new sa(e);return n.process(t),n.emit(t,e)}function Ee(t,e){let n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Ee(o.element,n);case"object":{for(let a in o.shape)if(Ee(o.shape[a],n))return!0;return!1}case"union":{for(let a of o.options)if(Ee(a,n))return!0;return!1}case"intersection":return Ee(o.left,n)||Ee(o.right,n);case"tuple":{for(let a of o.items)if(Ee(a,n))return!0;return!!(o.rest&&Ee(o.rest,n))}case"record":return Ee(o.keyType,n)||Ee(o.valueType,n);case"map":return Ee(o.keyType,n)||Ee(o.valueType,n);case"set":return Ee(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ee(o.innerType,n);case"lazy":return Ee(o.getter(),n);case"default":return Ee(o.innerType,n);case"prefault":return Ee(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return Ee(o.in,n)||Ee(o.out,n);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}u();u();var jT=b("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");re.init(t,e),t.def=e,t.parse=(n,r)=>ri(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>En(t,n,r),t.parseAsync=async(n,r)=>ai(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>Tn(t,n,r),t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),t.clone=(n,r)=>We(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t))});var GT=b("ZodMiniObject",(t,e)=>{Xo.init(t,e),jT.init(t,e),Y.defineLazy(t,"shape",()=>e.shape)});function Fc(t,e){let n={type:"object",get shape(){return Y.assignProp(this,"shape",{...t}),this.shape},...Y.normalizeParams(e)};return new GT(n)}function Xe(t){return!!t._zod}function vn(t){let e=Object.values(t);if(e.length===0)return Fc({});let n=e.every(Xe),r=e.every(o=>!Xe(o));if(n)return Fc(t);if(r)return Zs(t);throw new Error("Mixed Zod versions detected in object shape.")}function Ft(t,e){return Xe(t)?En(t,e):t.safeParse(e)}async function ia(t,e){return Xe(t)?await Tn(t,e):await t.safeParseAsync(e)}function jt(t){if(!t)return;let e;if(Xe(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Qn(t){if(t){if(typeof t=="object"){let e=t,n=t;if(!e._def&&!n._zod){let r=Object.values(t);if(r.length>0&&r.every(o=>typeof o=="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse=="function")))return vn(t)}}if(Xe(t)){let n=t._zod?.def;if(n&&(n.type==="object"||n.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function ca(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function sp(t){return t.description}function ip(t){if(Xe(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function la(t){if(Xe(t)){let a=t._zod?.def;if(a){if(a.value!==void 0)return a.value;if(Array.isArray(a.values)&&a.values.length>0)return a.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let r=t.value;if(r!==void 0)return r}u();u();u();u();var jr={};ks(jr,{ZodISODate:()=>lp,ZodISODateTime:()=>cp,ZodISODuration:()=>up,ZodISOTime:()=>dp,date:()=>Gc,datetime:()=>jc,duration:()=>Bc,time:()=>Zc});u();var cp=b("ZodISODateTime",(t,e)=>{Wh.init(t,e),he.init(t,e)});function jc(t){return ep(cp,t)}var lp=b("ZodISODate",(t,e)=>{Hh.init(t,e),he.init(t,e)});function Gc(t){return tp(lp,t)}var dp=b("ZodISOTime",(t,e)=>{Yh.init(t,e),he.init(t,e)});function Zc(t){return np(dp,t)}var up=b("ZodISODuration",(t,e)=>{Kh.init(t,e),he.init(t,e)});function Bc(t){return rp(up,t)}u();u();var hp=(t,e)=>{Wo.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>ti(t,n)},flatten:{value:n=>ei(t,n)},addIssue:{value:n=>t.issues.push(n)},addIssues:{value:n=>t.issues.push(...n)},isEmpty:{get(){return t.issues.length===0}}})},vR=b("ZodError",hp),Gr=b("ZodError",hp,{Parent:Error});var pp=ni(Gr),mp=oi(Gr),fp=si(Gr),_p=ii(Gr);var _e=b("ZodType",(t,e)=>(re.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone({...e,checks:[...e.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),t.clone=(n,r)=>We(t,n,r),t.brand=()=>t,t.register=((n,r)=>(n.add(t,r),t)),t.parse=(n,r)=>pp(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>fp(t,n,r),t.parseAsync=async(n,r)=>mp(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>_p(t,n,r),t.spa=t.safeParseAsync,t.refine=(n,r)=>t.check(Ub(n,r)),t.superRefine=n=>t.check(Fb(n)),t.overwrite=n=>t.check(bn(n)),t.optional=()=>me(t),t.nullable=()=>Ep(t),t.nullish=()=>me(Ep(t)),t.nonoptional=n=>Rb(t,n),t.array=()=>K(t),t.or=n=>le([t,n]),t.and=n=>ua(t,n),t.transform=n=>Vc(t,Ap(n)),t.default=n=>Pb(t,n),t.prefault=n=>Db(t,n),t.catch=n=>kb(t,n),t.pipe=n=>Vc(t,n),t.readonly=()=>Mb(t),t.describe=n=>{let r=t.clone();return Ut.add(r,{description:n}),r},Object.defineProperty(t,"description",{get(){return Ut.get(t)?.description},configurable:!0}),t.meta=(...n)=>{if(n.length===0)return Ut.get(t);let r=t.clone();return Ut.add(r,n[0]),r},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Tp=b("_ZodString",(t,e)=>{Mr.init(t,e),_e.init(t,e);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...r)=>t.check(Oc(...r)),t.includes=(...r)=>t.check(Cc(...r)),t.startsWith=(...r)=>t.check(Dc(...r)),t.endsWith=(...r)=>t.check(Rc(...r)),t.min=(...r)=>t.check(Xn(...r)),t.max=(...r)=>t.check(oa(...r)),t.length=(...r)=>t.check(aa(...r)),t.nonempty=(...r)=>t.check(Xn(1,...r)),t.lowercase=r=>t.check(Nc(r)),t.uppercase=r=>t.check(Pc(r)),t.trim=()=>t.check(kc()),t.normalize=(...r)=>t.check(xc(...r)),t.toLowerCase=()=>t.check(Lc()),t.toUpperCase=()=>t.check($c())}),JT=b("ZodString",(t,e)=>{Mr.init(t,e),Tp.init(t,e),t.email=n=>t.check(ec(XT,n)),t.url=n=>t.check(ac(QT,n)),t.jwt=n=>t.check(Tc(mb,n)),t.emoji=n=>t.check(sc(eb,n)),t.guid=n=>t.check(ea(gp,n)),t.uuid=n=>t.check(tc(da,n)),t.uuidv4=n=>t.check(nc(da,n)),t.uuidv6=n=>t.check(rc(da,n)),t.uuidv7=n=>t.check(oc(da,n)),t.nanoid=n=>t.check(ic(tb,n)),t.guid=n=>t.check(ea(gp,n)),t.cuid=n=>t.check(cc(nb,n)),t.cuid2=n=>t.check(lc(rb,n)),t.ulid=n=>t.check(dc(ob,n)),t.base64=n=>t.check(gc(ub,n)),t.base64url=n=>t.check(yc(hb,n)),t.xid=n=>t.check(uc(ab,n)),t.ksuid=n=>t.check(hc(sb,n)),t.ipv4=n=>t.check(pc(ib,n)),t.ipv6=n=>t.check(mc(cb,n)),t.cidrv4=n=>t.check(fc(lb,n)),t.cidrv6=n=>t.check(_c(db,n)),t.e164=n=>t.check(Ec(pb,n)),t.datetime=n=>t.check(jc(n)),t.date=n=>t.check(Gc(n)),t.time=n=>t.check(Zc(n)),t.duration=n=>t.check(Bc(n))});function E(t){return Qi(JT,t)}var he=b("ZodStringFormat",(t,e)=>{ie.init(t,e),Tp.init(t,e)}),XT=b("ZodEmail",(t,e)=>{fi.init(t,e),he.init(t,e)});var gp=b("ZodGUID",(t,e)=>{pi.init(t,e),he.init(t,e)});var da=b("ZodUUID",(t,e)=>{mi.init(t,e),he.init(t,e)});var QT=b("ZodURL",(t,e)=>{_i.init(t,e),he.init(t,e)});var eb=b("ZodEmoji",(t,e)=>{gi.init(t,e),he.init(t,e)});var tb=b("ZodNanoID",(t,e)=>{yi.init(t,e),he.init(t,e)});var nb=b("ZodCUID",(t,e)=>{Ei.init(t,e),he.init(t,e)});var rb=b("ZodCUID2",(t,e)=>{Ti.init(t,e),he.init(t,e)});var ob=b("ZodULID",(t,e)=>{bi.init(t,e),he.init(t,e)});var ab=b("ZodXID",(t,e)=>{wi.init(t,e),he.init(t,e)});var sb=b("ZodKSUID",(t,e)=>{vi.init(t,e),he.init(t,e)});var ib=b("ZodIPv4",(t,e)=>{Ii.init(t,e),he.init(t,e)});var cb=b("ZodIPv6",(t,e)=>{Ai.init(t,e),he.init(t,e)});var lb=b("ZodCIDRv4",(t,e)=>{Si.init(t,e),he.init(t,e)});var db=b("ZodCIDRv6",(t,e)=>{Oi.init(t,e),he.init(t,e)});var ub=b("ZodBase64",(t,e)=>{Ni.init(t,e),he.init(t,e)});var hb=b("ZodBase64URL",(t,e)=>{Pi.init(t,e),he.init(t,e)});var pb=b("ZodE164",(t,e)=>{Ci.init(t,e),he.init(t,e)});var mb=b("ZodJWT",(t,e)=>{Di.init(t,e),he.init(t,e)});var bp=b("ZodNumber",(t,e)=>{Jo.init(t,e),_e.init(t,e),t.gt=(r,o)=>t.check(na(r,o)),t.gte=(r,o)=>t.check(Fr(r,o)),t.min=(r,o)=>t.check(Fr(r,o)),t.lt=(r,o)=>t.check(ta(r,o)),t.lte=(r,o)=>t.check(Ur(r,o)),t.max=(r,o)=>t.check(Ur(r,o)),t.int=r=>t.check(yp(r)),t.safe=r=>t.check(yp(r)),t.positive=r=>t.check(na(0,r)),t.nonnegative=r=>t.check(Fr(0,r)),t.negative=r=>t.check(ta(0,r)),t.nonpositive=r=>t.check(Ur(0,r)),t.multipleOf=(r,o)=>t.check(ra(r,o)),t.step=(r,o)=>t.check(ra(r,o)),t.finite=()=>t;let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function ne(t){return bc(bp,t)}var fb=b("ZodNumberFormat",(t,e)=>{Ri.init(t,e),bp.init(t,e)});function yp(t){return wc(fb,t)}var _b=b("ZodBoolean",(t,e)=>{xi.init(t,e),_e.init(t,e)});function we(t){return vc(_b,t)}var gb=b("ZodNull",(t,e)=>{ki.init(t,e),_e.init(t,e)});function wp(t){return Ic(gb,t)}var yb=b("ZodUnknown",(t,e)=>{Li.init(t,e),_e.init(t,e)});function pe(){return Ac(yb)}var Eb=b("ZodNever",(t,e)=>{$i.init(t,e),_e.init(t,e)});function Tb(t){return Sc(Eb,t)}var bb=b("ZodArray",(t,e)=>{Mi.init(t,e),_e.init(t,e),t.element=e.element,t.min=(n,r)=>t.check(Xn(n,r)),t.nonempty=n=>t.check(Xn(1,n)),t.max=(n,r)=>t.check(oa(n,r)),t.length=(n,r)=>t.check(aa(n,r)),t.unwrap=()=>t.element});function K(t,e){return op(bb,t,e)}var vp=b("ZodObject",(t,e)=>{Xo.init(t,e),_e.init(t,e),Y.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>je(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:pe()}),t.loose=()=>t.clone({...t._zod.def,catchall:pe()}),t.strict=()=>t.clone({...t._zod.def,catchall:Tb()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>Y.extend(t,n),t.merge=n=>Y.merge(t,n),t.pick=n=>Y.pick(t,n),t.omit=n=>Y.omit(t,n),t.partial=(...n)=>Y.partial(Sp,t,n[0]),t.required=(...n)=>Y.required(Op,t,n[0])});function C(t,e){let n={type:"object",get shape(){return Y.assignProp(this,"shape",{...t}),this.shape},...Y.normalizeParams(e)};return new vp(n)}function ke(t,e){return new vp({type:"object",get shape(){return Y.assignProp(this,"shape",{...t}),this.shape},catchall:pe(),...Y.normalizeParams(e)})}var Ip=b("ZodUnion",(t,e)=>{Qo.init(t,e),_e.init(t,e),t.options=e.options});function le(t,e){return new Ip({type:"union",options:t,...Y.normalizeParams(e)})}var wb=b("ZodDiscriminatedUnion",(t,e)=>{Ip.init(t,e),zi.init(t,e)});function Wc(t,e,n){return new wb({type:"union",options:e,discriminator:t,...Y.normalizeParams(n)})}var vb=b("ZodIntersection",(t,e)=>{Ui.init(t,e),_e.init(t,e)});function ua(t,e){return new vb({type:"intersection",left:t,right:e})}var Ib=b("ZodRecord",(t,e)=>{Fi.init(t,e),_e.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function ce(t,e,n){return new Ib({type:"record",keyType:t,valueType:e,...Y.normalizeParams(n)})}var qc=b("ZodEnum",(t,e)=>{ji.init(t,e),_e.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let n=new Set(Object.keys(e.entries));t.extract=(r,o)=>{let a={};for(let s of r)if(n.has(s))a[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new qc({...e,checks:[],...Y.normalizeParams(o),entries:a})},t.exclude=(r,o)=>{let a={...e.entries};for(let s of r)if(n.has(s))delete a[s];else throw new Error(`Key ${s} not found in enum`);return new qc({...e,checks:[],...Y.normalizeParams(o),entries:a})}});function je(t,e){let n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new qc({type:"enum",entries:n,...Y.normalizeParams(e)})}var Ab=b("ZodLiteral",(t,e)=>{Gi.init(t,e),_e.init(t,e),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 Ab({type:"literal",values:Array.isArray(t)?t:[t],...Y.normalizeParams(e)})}var Sb=b("ZodTransform",(t,e)=>{Zi.init(t,e),_e.init(t,e),t._zod.parse=(n,r)=>{n.addIssue=a=>{if(typeof a=="string")n.issues.push(Y.issue(a,n.value,e));else{let s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!0),n.issues.push(Y.issue(s))}};let o=e.transform(n.value,n);return o instanceof Promise?o.then(a=>(n.value=a,n)):(n.value=o,n)}});function Ap(t){return new Sb({type:"transform",transform:t})}var Sp=b("ZodOptional",(t,e)=>{Bi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType});function me(t){return new Sp({type:"optional",innerType:t})}var Ob=b("ZodNullable",(t,e)=>{qi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ep(t){return new Ob({type:"nullable",innerType:t})}var Nb=b("ZodDefault",(t,e)=>{Vi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Pb(t,e){return new Nb({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Cb=b("ZodPrefault",(t,e)=>{Wi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Db(t,e){return new Cb({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Op=b("ZodNonOptional",(t,e)=>{Hi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Rb(t,e){return new Op({type:"nonoptional",innerType:t,...Y.normalizeParams(e)})}var xb=b("ZodCatch",(t,e)=>{Yi.init(t,e),_e.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function kb(t,e){return new xb({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Lb=b("ZodPipe",(t,e)=>{Ki.init(t,e),_e.init(t,e),t.in=e.in,t.out=e.out});function Vc(t,e){return new Lb({type:"pipe",in:t,out:e})}var $b=b("ZodReadonly",(t,e)=>{Ji.init(t,e),_e.init(t,e)});function Mb(t){return new $b({type:"readonly",innerType:t})}var Np=b("ZodCustom",(t,e)=>{Xi.init(t,e),_e.init(t,e)});function zb(t){let e=new Ie({check:"custom"});return e._zod.check=t,e}function Pp(t,e){return Mc(Np,t??(()=>!0),e)}function Ub(t,e={}){return zc(Np,t,e)}function Fb(t){let e=zb(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Y.issue(r,n.value,e._zod.def));else{let o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),n.issues.push(Y.issue(o))}},t(n.value,n)));return e}function Hc(t,e){return Vc(Ap(t),e)}Ve(Xh());var Kc="2025-11-25";var Cp=[Kc,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Gt="io.modelcontextprotocol/related-task",pa="2.0",Te=Pp(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Dp=le([E(),ne().int()]),Rp=E(),jR=ke({ttl:ne().optional(),pollInterval:ne().optional()}),jb=C({ttl:ne().optional()}),Gb=C({taskId:E()}),Jc=ke({progressToken:Dp.optional(),[Gt]:Gb.optional()}),He=C({_meta:Jc.optional()}),Zr=He.extend({task:jb.optional()}),xp=t=>Zr.safeParse(t).success,Ae=C({method:E(),params:He.loose().optional()}),Qe=C({_meta:Jc.optional()}),et=C({method:E(),params:Qe.loose().optional()}),Se=ke({_meta:Jc.optional()}),ma=le([E(),ne().int()]),kp=C({jsonrpc:k(pa),id:ma,...Ae.shape}).strict(),Xc=t=>kp.safeParse(t).success,Lp=C({jsonrpc:k(pa),...et.shape}).strict(),$p=t=>Lp.safeParse(t).success,Qc=C({jsonrpc:k(pa),id:ma,result:Se}).strict(),Br=t=>Qc.safeParse(t).success;var $;(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"})($||($={}));var el=C({jsonrpc:k(pa),id:ma.optional(),error:C({code:ne().int(),message:E(),data:pe().optional()})}).strict();var Mp=t=>el.safeParse(t).success;var GR=le([kp,Lp,Qc,el]),ZR=le([Qc,el]),fa=Se.strict(),Zb=Qe.extend({requestId:ma.optional(),reason:E().optional()}),_a=et.extend({method:k("notifications/cancelled"),params:Zb}),Bb=C({src:E(),mimeType:E().optional(),sizes:K(E()).optional(),theme:je(["light","dark"]).optional()}),qr=C({icons:K(Bb).optional()}),er=C({name:E(),title:E().optional()}),zp=er.extend({...er.shape,...qr.shape,version:E(),websiteUrl:E().optional(),description:E().optional()}),qb=ua(C({applyDefaults:we().optional()}),ce(E(),pe())),Vb=Hc(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,ua(C({form:qb.optional(),url:Te.optional()}),ce(E(),pe()).optional())),Wb=ke({list:Te.optional(),cancel:Te.optional(),requests:ke({sampling:ke({createMessage:Te.optional()}).optional(),elicitation:ke({create:Te.optional()}).optional()}).optional()}),Hb=ke({list:Te.optional(),cancel:Te.optional(),requests:ke({tools:ke({call:Te.optional()}).optional()}).optional()}),Yb=C({experimental:ce(E(),Te).optional(),sampling:C({context:Te.optional(),tools:Te.optional()}).optional(),elicitation:Vb.optional(),roots:C({listChanged:we().optional()}).optional(),tasks:Wb.optional(),extensions:ce(E(),Te).optional()}),Kb=He.extend({protocolVersion:E(),capabilities:Yb,clientInfo:zp}),tl=Ae.extend({method:k("initialize"),params:Kb});var Jb=C({experimental:ce(E(),Te).optional(),logging:Te.optional(),completions:Te.optional(),prompts:C({listChanged:we().optional()}).optional(),resources:C({subscribe:we().optional(),listChanged:we().optional()}).optional(),tools:C({listChanged:we().optional()}).optional(),tasks:Hb.optional(),extensions:ce(E(),Te).optional()}),Xb=Se.extend({protocolVersion:E(),capabilities:Jb,serverInfo:zp,instructions:E().optional()}),nl=et.extend({method:k("notifications/initialized"),params:Qe.optional()});var ga=Ae.extend({method:k("ping"),params:He.optional()}),Qb=C({progress:ne(),total:me(ne()),message:me(E())}),ew=C({...Qe.shape,...Qb.shape,progressToken:Dp}),ya=et.extend({method:k("notifications/progress"),params:ew}),tw=He.extend({cursor:Rp.optional()}),Vr=Ae.extend({params:tw.optional()}),Wr=Se.extend({nextCursor:Rp.optional()}),nw=je(["working","input_required","completed","failed","cancelled"]),Hr=C({taskId:E(),status:nw,ttl:le([ne(),wp()]),createdAt:E(),lastUpdatedAt:E(),pollInterval:me(ne()),statusMessage:me(E())}),tr=Se.extend({task:Hr}),rw=Qe.merge(Hr),Yr=et.extend({method:k("notifications/tasks/status"),params:rw}),Ea=Ae.extend({method:k("tasks/get"),params:He.extend({taskId:E()})}),Ta=Se.merge(Hr),ba=Ae.extend({method:k("tasks/result"),params:He.extend({taskId:E()})}),BR=Se.loose(),wa=Vr.extend({method:k("tasks/list")}),va=Wr.extend({tasks:K(Hr)}),Ia=Ae.extend({method:k("tasks/cancel"),params:He.extend({taskId:E()})}),Up=Se.merge(Hr),Fp=C({uri:E(),mimeType:me(E()),_meta:ce(E(),pe()).optional()}),jp=Fp.extend({text:E()}),rl=E().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Gp=Fp.extend({blob:rl}),Kr=je(["user","assistant"]),nr=C({audience:K(Kr).optional(),priority:ne().min(0).max(1).optional(),lastModified:jr.datetime({offset:!0}).optional()}),Zp=C({...er.shape,...qr.shape,uri:E(),description:me(E()),mimeType:me(E()),size:me(ne()),annotations:nr.optional(),_meta:me(ke({}))}),ow=C({...er.shape,...qr.shape,uriTemplate:E(),description:me(E()),mimeType:me(E()),annotations:nr.optional(),_meta:me(ke({}))}),Aa=Vr.extend({method:k("resources/list")}),aw=Wr.extend({resources:K(Zp)}),Sa=Vr.extend({method:k("resources/templates/list")}),sw=Wr.extend({resourceTemplates:K(ow)}),ol=He.extend({uri:E()}),iw=ol,Oa=Ae.extend({method:k("resources/read"),params:iw}),cw=Se.extend({contents:K(le([jp,Gp]))}),lw=et.extend({method:k("notifications/resources/list_changed"),params:Qe.optional()}),dw=ol,uw=Ae.extend({method:k("resources/subscribe"),params:dw}),hw=ol,pw=Ae.extend({method:k("resources/unsubscribe"),params:hw}),mw=Qe.extend({uri:E()}),fw=et.extend({method:k("notifications/resources/updated"),params:mw}),_w=C({name:E(),description:me(E()),required:me(we())}),gw=C({...er.shape,...qr.shape,description:me(E()),arguments:me(K(_w)),_meta:me(ke({}))}),Na=Vr.extend({method:k("prompts/list")}),yw=Wr.extend({prompts:K(gw)}),Ew=He.extend({name:E(),arguments:ce(E(),E()).optional()}),Pa=Ae.extend({method:k("prompts/get"),params:Ew}),al=C({type:k("text"),text:E(),annotations:nr.optional(),_meta:ce(E(),pe()).optional()}),sl=C({type:k("image"),data:rl,mimeType:E(),annotations:nr.optional(),_meta:ce(E(),pe()).optional()}),il=C({type:k("audio"),data:rl,mimeType:E(),annotations:nr.optional(),_meta:ce(E(),pe()).optional()}),Tw=C({type:k("tool_use"),name:E(),id:E(),input:ce(E(),pe()),_meta:ce(E(),pe()).optional()}),bw=C({type:k("resource"),resource:le([jp,Gp]),annotations:nr.optional(),_meta:ce(E(),pe()).optional()}),ww=Zp.extend({type:k("resource_link")}),cl=le([al,sl,il,ww,bw]),vw=C({role:Kr,content:cl}),Iw=Se.extend({description:E().optional(),messages:K(vw)}),Aw=et.extend({method:k("notifications/prompts/list_changed"),params:Qe.optional()}),Sw=C({title:E().optional(),readOnlyHint:we().optional(),destructiveHint:we().optional(),idempotentHint:we().optional(),openWorldHint:we().optional()}),Ow=C({taskSupport:je(["required","optional","forbidden"]).optional()}),Bp=C({...er.shape,...qr.shape,description:E().optional(),inputSchema:C({type:k("object"),properties:ce(E(),Te).optional(),required:K(E()).optional()}).catchall(pe()),outputSchema:C({type:k("object"),properties:ce(E(),Te).optional(),required:K(E()).optional()}).catchall(pe()).optional(),annotations:Sw.optional(),execution:Ow.optional(),_meta:ce(E(),pe()).optional()}),Ca=Vr.extend({method:k("tools/list")}),Nw=Wr.extend({tools:K(Bp)}),Da=Se.extend({content:K(cl).default([]),structuredContent:ce(E(),pe()).optional(),isError:we().optional()}),qR=Da.or(Se.extend({toolResult:pe()})),Pw=Zr.extend({name:E(),arguments:ce(E(),pe()).optional()}),rr=Ae.extend({method:k("tools/call"),params:Pw}),Cw=et.extend({method:k("notifications/tools/list_changed"),params:Qe.optional()}),VR=C({autoRefresh:we().default(!0),debounceMs:ne().int().nonnegative().default(300)}),Jr=je(["debug","info","notice","warning","error","critical","alert","emergency"]),Dw=He.extend({level:Jr}),ll=Ae.extend({method:k("logging/setLevel"),params:Dw}),Rw=Qe.extend({level:Jr,logger:E().optional(),data:pe()}),xw=et.extend({method:k("notifications/message"),params:Rw}),kw=C({name:E().optional()}),Lw=C({hints:K(kw).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),$w=C({mode:je(["auto","required","none"]).optional()}),Mw=C({type:k("tool_result"),toolUseId:E().describe("The unique identifier for the corresponding tool call."),content:K(cl).default([]),structuredContent:C({}).loose().optional(),isError:we().optional(),_meta:ce(E(),pe()).optional()}),zw=Wc("type",[al,sl,il]),ha=Wc("type",[al,sl,il,Tw,Mw]),Uw=C({role:Kr,content:le([ha,K(ha)]),_meta:ce(E(),pe()).optional()}),Fw=Zr.extend({messages:K(Uw),modelPreferences:Lw.optional(),systemPrompt:E().optional(),includeContext:je(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:K(E()).optional(),metadata:Te.optional(),tools:K(Bp).optional(),toolChoice:$w.optional()}),jw=Ae.extend({method:k("sampling/createMessage"),params:Fw}),Xr=Se.extend({model:E(),stopReason:me(je(["endTurn","stopSequence","maxTokens"]).or(E())),role:Kr,content:zw}),dl=Se.extend({model:E(),stopReason:me(je(["endTurn","stopSequence","maxTokens","toolUse"]).or(E())),role:Kr,content:le([ha,K(ha)])}),Gw=C({type:k("boolean"),title:E().optional(),description:E().optional(),default:we().optional()}),Zw=C({type:k("string"),title:E().optional(),description:E().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:je(["email","uri","date","date-time"]).optional(),default:E().optional()}),Bw=C({type:je(["number","integer"]),title:E().optional(),description:E().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),qw=C({type:k("string"),title:E().optional(),description:E().optional(),enum:K(E()),default:E().optional()}),Vw=C({type:k("string"),title:E().optional(),description:E().optional(),oneOf:K(C({const:E(),title:E()})),default:E().optional()}),Ww=C({type:k("string"),title:E().optional(),description:E().optional(),enum:K(E()),enumNames:K(E()).optional(),default:E().optional()}),Hw=le([qw,Vw]),Yw=C({type:k("array"),title:E().optional(),description:E().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:C({type:k("string"),enum:K(E())}),default:K(E()).optional()}),Kw=C({type:k("array"),title:E().optional(),description:E().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:C({anyOf:K(C({const:E(),title:E()}))}),default:K(E()).optional()}),Jw=le([Yw,Kw]),Xw=le([Ww,Hw,Jw]),Qw=le([Xw,Gw,Zw,Bw]),ev=Zr.extend({mode:k("form").optional(),message:E(),requestedSchema:C({type:k("object"),properties:ce(E(),Qw),required:K(E()).optional()})}),tv=Zr.extend({mode:k("url"),message:E(),elicitationId:E(),url:E().url()}),nv=le([ev,tv]),rv=Ae.extend({method:k("elicitation/create"),params:nv}),ov=Qe.extend({elicitationId:E()}),av=et.extend({method:k("notifications/elicitation/complete"),params:ov}),or=Se.extend({action:je(["accept","decline","cancel"]),content:Hc(t=>t===null?void 0:t,ce(E(),le([E(),ne(),we(),K(E())])).optional())}),sv=C({type:k("ref/resource"),uri:E()});var iv=C({type:k("ref/prompt"),name:E()}),cv=He.extend({ref:le([iv,sv]),argument:C({name:E(),value:E()}),context:C({arguments:ce(E(),E()).optional()}).optional()}),Ra=Ae.extend({method:k("completion/complete"),params:cv});function qp(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Vp(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var lv=Se.extend({completion:ke({values:K(E()).max(100),total:me(ne().int()),hasMore:me(we())})}),dv=C({uri:E().startsWith("file://"),name:E().optional(),_meta:ce(E(),pe()).optional()}),uv=Ae.extend({method:k("roots/list"),params:He.optional()}),ul=Se.extend({roots:K(dv)}),hv=et.extend({method:k("notifications/roots/list_changed"),params:Qe.optional()}),WR=le([ga,tl,Ra,ll,Pa,Na,Aa,Sa,Oa,uw,pw,rr,Ca,Ea,ba,wa,Ia]),HR=le([_a,ya,nl,hv,Yr]),YR=le([fa,Xr,dl,or,ul,Ta,va,tr]),KR=le([ga,jw,rv,uv,Ea,ba,wa,Ia]),JR=le([_a,ya,xw,fw,lw,Cw,Aw,Yr,av]),XR=le([fa,Xb,lv,Iw,yw,aw,sw,cw,Da,Nw,Ta,va,tr]),x=class t extends Error{constructor(e,n,r){super(`MCP error ${e}: ${n}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,n,r){if(e===$.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new Yc(o.elicitations,n)}return new t(e,n,r)}},Yc=class extends x{constructor(e,n=`URL elicitation${e.length>1?"s":""} required`){super($.UrlElicitationRequired,n,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};u();function Zt(t){return t==="completed"||t==="failed"||t==="cancelled"}u();u();u();var Hp=Symbol("Let zodToJsonSchema decide on which parser to use");var Wp={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Yp=t=>typeof t=="string"?{...Wp,name:t}:{...Wp,...t};u();var Kp=t=>{let e=Yp(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}};u();function hl(t,e,n,r){r?.errorMessages&&n&&(t.errorMessage={...t.errorMessage,[e]:n})}function J(t,e,n,r,o){t[e]=n,hl(t,e,r,o)}u();var xa=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};u();u();u();function fe(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?xa(e,t.currentPath):e.join("/")}}u();function Jp(t,e){let n={type:"array"};return t.type?._def&&t.type?._def?.typeName!==A.ZodAny&&(n.items=F(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&J(n,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&J(n,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(J(n,"minItems",t.exactLength.value,t.exactLength.message,e),J(n,"maxItems",t.exactLength.value,t.exactLength.message,e)),n}u();function Xp(t,e){let n={type:"integer",format:"int64"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"min":e.target==="jsonSchema7"?r.inclusive?J(n,"minimum",r.value,r.message,e):J(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),J(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?J(n,"maximum",r.value,r.message,e):J(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),J(n,"maximum",r.value,r.message,e));break;case"multipleOf":J(n,"multipleOf",r.value,r.message,e);break}return n}u();function Qp(){return{type:"boolean"}}u();function ka(t,e){return F(t.type._def,e)}u();var em=(t,e)=>F(t.innerType._def,e);u();function pl(t,e,n){let r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((o,a)=>pl(t,e,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return pv(t,e)}}var pv=(t,e)=>{let n={type:"integer",format:"unix-time"};if(e.target==="openApi3")return n;for(let r of t.checks)switch(r.kind){case"min":J(n,"minimum",r.value,r.message,e);break;case"max":J(n,"maximum",r.value,r.message,e);break}return n};u();function tm(t,e){return{...F(t.innerType._def,e),default:t.defaultValue()}}u();function nm(t,e){return e.effectStrategy==="input"?F(t.schema._def,e):fe(e)}u();function rm(t){return{type:"string",enum:Array.from(t.values)}}u();var mv=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function om(t,e){let n=[F(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),F(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(a=>!!a),r=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return n.forEach(a=>{if(mv(a))o.push(...a.allOf),a.unevaluatedProperties===void 0&&(r=void 0);else{let s=a;if("additionalProperties"in a&&a.additionalProperties===!1){let{additionalProperties:i,...l}=a;s=l}else r=void 0;o.push(s)}}),o.length?{allOf:o,...r}:void 0}u();function am(t,e){let n=typeof t.value;return n!=="bigint"&&n!=="number"&&n!=="boolean"&&n!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:n==="bigint"?"integer":n,enum:[t.value]}:{type:n==="bigint"?"integer":n,const:t.value}}u();u();u();var ml,it={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(ml===void 0&&(ml=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ml),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function La(t,e){let n={type:"string"};if(t.checks)for(let r of t.checks)switch(r.kind){case"min":J(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,e);break;case"max":J(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,e);break;case"email":switch(e.emailStrategy){case"format:email":ct(n,"email",r.message,e);break;case"format:idn-email":ct(n,"idn-email",r.message,e);break;case"pattern:zod":Le(n,it.email,r.message,e);break}break;case"url":ct(n,"uri",r.message,e);break;case"uuid":ct(n,"uuid",r.message,e);break;case"regex":Le(n,r.regex,r.message,e);break;case"cuid":Le(n,it.cuid,r.message,e);break;case"cuid2":Le(n,it.cuid2,r.message,e);break;case"startsWith":Le(n,RegExp(`^${fl(r.value,e)}`),r.message,e);break;case"endsWith":Le(n,RegExp(`${fl(r.value,e)}$`),r.message,e);break;case"datetime":ct(n,"date-time",r.message,e);break;case"date":ct(n,"date",r.message,e);break;case"time":ct(n,"time",r.message,e);break;case"duration":ct(n,"duration",r.message,e);break;case"length":J(n,"minLength",typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,r.message,e),J(n,"maxLength",typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value,r.message,e);break;case"includes":{Le(n,RegExp(fl(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&ct(n,"ipv4",r.message,e),r.version!=="v4"&&ct(n,"ipv6",r.message,e);break}case"base64url":Le(n,it.base64url,r.message,e);break;case"jwt":Le(n,it.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&Le(n,it.ipv4Cidr,r.message,e),r.version!=="v4"&&Le(n,it.ipv6Cidr,r.message,e);break}case"emoji":Le(n,it.emoji(),r.message,e);break;case"ulid":{Le(n,it.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ct(n,"binary",r.message,e);break}case"contentEncoding:base64":{J(n,"contentEncoding","base64",r.message,e);break}case"pattern:zod":{Le(n,it.base64,r.message,e);break}}break}case"nanoid":Le(n,it.nanoid,r.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return n}function fl(t,e){return e.patternStrategy==="escape"?_v(t):t}var fv=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _v(t){let e="";for(let n=0;n<t.length;n++)fv.has(t[n])||(e+="\\"),e+=t[n];return e}function ct(t,e,n,r){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&r.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...n&&r.errorMessages&&{errorMessage:{format:n}}})):J(t,"format",e,n,r)}function Le(t,e,n,r){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&r.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:sm(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):J(t,"pattern",sm(e,r),n,r)}function sm(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let n={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},r=n.i?t.source.toLowerCase():t.source,o="",a=!1,s=!1,i=!1;for(let l=0;l<r.length;l++){if(a){o+=r[l],a=!1;continue}if(n.i){if(s){if(r[l].match(/[a-z]/)){i?(o+=r[l],o+=`${r[l-2]}-${r[l]}`.toUpperCase(),i=!1):r[l+1]==="-"&&r[l+2]?.match(/[a-z]/)?(o+=r[l],i=!0):o+=`${r[l]}${r[l].toUpperCase()}`;continue}}else if(r[l].match(/[a-z]/)){o+=`[${r[l]}${r[l].toUpperCase()}]`;continue}}if(n.m){if(r[l]==="^"){o+=`(^|(?<=[\r
39
39
  ]))`;continue}else if(r[l]==="$"){o+=`($|(?=[\r
40
40
  ]))`;continue}}if(n.s&&r[l]==="."){o+=s?`${r[l]}\r
41
41
  `:`[${r[l]}\r
42
- ]`;continue}o+=r[l],r[l]==="\\"?a=!0:s&&r[l]==="]"?s=!1:!s&&r[l]==="["&&(s=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}function La(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===A.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((r,o)=>({...r,[o]:F(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let n={type:"object",additionalProperties:F(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return n;if(t.keyType?._def.typeName===A.ZodString&&t.keyType._def.checks?.length){let{type:r,...o}=xa(t.keyType._def,e);return{...n,propertyNames:o}}else{if(t.keyType?._def.typeName===A.ZodEnum)return{...n,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===A.ZodBranded&&t.keyType._def.type._def.typeName===A.ZodString&&t.keyType._def.type._def.checks?.length){let{type:r,...o}=ka(t.keyType._def,e);return{...n,propertyNames:o}}}return n}function sm(t,e){if(e.mapStrategy==="record")return La(t,e);let n=F(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),r=F(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}u();function im(t){let e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),o=Array.from(new Set(r.map(a=>typeof a)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}u();function cm(t){return t.target==="openAi"?void 0:{not:fe({...t,currentPath:[...t.currentPath,"not"]})}}u();function lm(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}u();u();var Xr={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function um(t,e){if(e.target==="openApi3")return dm(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Xr&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,a)=>{let s=Xr[a._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,a)=>{let s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":if(a._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((a,s,i)=>i.indexOf(a)===s);return{type:o.length>1?o:o[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(a=>!r.includes(a))],[])};return dm(t,e)}var dm=(t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,o)=>F(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function hm(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Xr[t.innerType._def.typeName],nullable:!0}:{type:[Xr[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let r=F(t.innerType._def,{...e,currentPath:[...e.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let n=F(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}u();function pm(t,e){let n={type:"number"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",dl(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?J(n,"minimum",r.value,r.message,e):J(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),J(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?J(n,"maximum",r.value,r.message,e):J(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),J(n,"maximum",r.value,r.message,e));break;case"multipleOf":J(n,"multipleOf",r.value,r.message,e);break}return n}u();function mm(t,e){let n=e.target==="openAi",r={type:"object",properties:{}},o=[],a=t.shape();for(let i in a){let l=a[i];if(l===void 0||l._def===void 0)continue;let d=mv(l);d&&n&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),d=!1);let h=F(l._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});h!==void 0&&(r.properties[i]=h,d||o.push(i))}o.length&&(r.required=o);let s=pv(t,e);return s!==void 0&&(r.additionalProperties=s),r}function pv(t,e){if(t.catchall._def.typeName!=="ZodNever")return F(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function mv(t){try{return t.isOptional()}catch{return!0}}u();var fm=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return F(t.innerType._def,e);let n=F(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return n?{anyOf:[{not:fe(e)},n]}:fe(e)};u();var _m=(t,e)=>{if(e.pipeStrategy==="input")return F(t.in._def,e);if(e.pipeStrategy==="output")return F(t.out._def,e);let n=F(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=F(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(o=>o!==void 0)}};u();function gm(t,e){return F(t.type._def,e)}u();function ym(t,e){let r={type:"array",uniqueItems:!0,items:F(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&J(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&J(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}u();function Em(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>F(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:F(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>F(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}u();function Tm(t){return{not:fe(t)}}u();function bm(t){return fe(t)}u();var wm=(t,e)=>F(t.innerType._def,e);var vm=(t,e,n)=>{switch(e){case A.ZodString:return xa(t,n);case A.ZodNumber:return pm(t,n);case A.ZodObject:return mm(t,n);case A.ZodBigInt:return Jp(t,n);case A.ZodBoolean:return Xp();case A.ZodDate:return ul(t,n);case A.ZodUndefined:return Tm(n);case A.ZodNull:return lm(n);case A.ZodArray:return Kp(t,n);case A.ZodUnion:case A.ZodDiscriminatedUnion:return um(t,n);case A.ZodIntersection:return rm(t,n);case A.ZodTuple:return Em(t,n);case A.ZodRecord:return La(t,n);case A.ZodLiteral:return om(t,n);case A.ZodEnum:return nm(t);case A.ZodNativeEnum:return im(t);case A.ZodNullable:return hm(t,n);case A.ZodOptional:return fm(t,n);case A.ZodMap:return sm(t,n);case A.ZodSet:return ym(t,n);case A.ZodLazy:return()=>t.getter()._def;case A.ZodPromise:return gm(t,n);case A.ZodNaN:case A.ZodNever:return cm(n);case A.ZodEffects:return tm(t,n);case A.ZodAny:return fe(n);case A.ZodUnknown:return bm(n);case A.ZodDefault:return em(t,n);case A.ZodBranded:return ka(t,n);case A.ZodReadonly:return wm(t,n);case A.ZodCatch:return Qp(t,n);case A.ZodPipeline:return _m(t,n);case A.ZodFunction:case A.ZodVoid:case A.ZodSymbol:return;default:return(r=>{})(e)}};function F(t,e,n=!1){let r=e.seen.get(t);if(e.override){let i=e.override?.(t,e,r,n);if(i!==Wp)return i}if(r&&!n){let i=fv(r,e);if(i!==void 0)return i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let a=vm(t,t.typeName,e),s=typeof a=="function"?F(a(),e):a;if(s&&_v(t,e,s),e.postProcess){let i=e.postProcess(s,t,e);return o.jsonSchema=s,i}return o.jsonSchema=s,s}var fv=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Ra(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},_v=(t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),n);u();u();var ml=(t,e)=>{let n=Yp(e),r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,h])=>({...l,[d]:F(h._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0)??fe(n)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,a=F(t._def,o===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1)??fe(n),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(a.title=s),n.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let i=o===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...r,[o]:a}};return n.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};function gv(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function fl(t,e){return Xe(t)?Mc(t,{target:gv(e?.target),io:e?.pipeStrategy??"input"}):ml(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function _l(t){let n=jt(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let r=ca(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function gl(t,e){let n=Ft(t,e);if(!n.success)throw n.error;return n.data}var yv=6e4,$a=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(fa,n=>{this._oncancel(n)}),this.setNotificationHandler(ga,n=>{this._onprogress(n)}),this.setRequestHandler(_a,n=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ya,async(n,r)=>{let o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new k($.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ta,async(n,r)=>{let o=async()=>{let a=n.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(a,r.sessionId);){if(i.type==="response"||i.type==="error"){let l=i.message,d=l.id,h=this._requestResolvers.get(d);if(h)if(this._requestResolvers.delete(d),i.type==="response")h(l);else{let p=l,g=new k(p.error.code,p.error.message,p.error.data);h(g)}else{let p=i.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${d}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(a,r.sessionId);if(!s)throw new k($.InvalidParams,`Task not found: ${a}`);if(!Zt(s.status))return await this._waitForTaskUpdate(a,r.signal),await o();if(Zt(s.status)){let i=await this._taskStore.getTaskResult(a,r.sessionId);return this._clearTaskQueue(a),{...i,_meta:{...i._meta,[Gt]:{taskId:a}}}}return await o()};return await o()}),this.setRequestHandler(ba,async(n,r)=>{try{let{tasks:o,nextCursor:a}=await this._taskStore.listTasks(n.params?.cursor,r.sessionId);return{tasks:o,nextCursor:a,_meta:{}}}catch(o){throw new k($.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(va,async(n,r)=>{try{let o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new k($.InvalidParams,`Task not found: ${n.params.taskId}`);if(Zt(o.status))throw new k($.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);let a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new k($.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...a}}catch(o){throw o instanceof k?o:new k($.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,n,r,o,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:o})}_resetTimeout(e){let n=this._timeoutInfo.get(e);if(!n)return!1;let r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),k.fromError($.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(e){let n=this._timeoutInfo.get(e);n&&(clearTimeout(n.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 n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=a=>{r?.(a),this._onerror(a)};let o=this._transport?.onmessage;this._transport.onmessage=(a,s)=>{o?.(a,s),Zr(a)||$p(a)?this._onresponse(a):Kc(a)?this._onrequest(a,s):Lp(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let n=k.fromError($.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(n)}_onerror(e){this.onerror?.(e)}_onnotification(e){let n=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,n){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,a=e.params?._meta?.[Gt]?.taskId;if(r===void 0){let h={jsonrpc:"2.0",id:e.id,error:{code:$.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:h,timestamp:Date.now()},o?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):o?.send(h).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=Rp(e.params)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,d={signal:s.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async h=>{if(s.signal.aborted)return;let p={relatedRequestId:e.id};a&&(p.relatedTask={taskId:a}),await this.notification(h,p)},sendRequest:async(h,p,g)=>{if(s.signal.aborted)throw new k($.ConnectionClosed,"Request was cancelled");let f={...g,relatedRequestId:e.id};a&&!f.relatedTask&&(f.relatedTask={taskId:a});let m=f.relatedTask?.taskId??a;return m&&l&&await l.updateTaskStatus(m,"input_required"),await this.request(h,p,f)},authInfo:n?.authInfo,requestId:e.id,requestInfo:n?.requestInfo,taskId:a,taskStore:l,taskRequestedTtl:i?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,d)).then(async h=>{if(s.signal.aborted)return;let p={result:h,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:p,timestamp:Date.now()},o?.sessionId):await o?.send(p)},async h=>{if(s.signal.aborted)return;let p={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(h.code)?h.code:$.InternalError,message:h.message??"Internal error",...h.data!==void 0&&{data:h.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:p,timestamp:Date.now()},o?.sessionId):await o?.send(p)}).catch(h=>this._onerror(new Error(`Failed to send response: ${h}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===s&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:n,...r}=e.params,o=Number(n),a=this._progressHandlers.get(o);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(l){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(l);return}a(r)}_onresponse(e){let n=Number(e.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),Zr(e))r(e);else{let s=new k(e.error.code,e.error.message,e.error.data);r(s)}return}let o=this._responseHandlers.get(n);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let a=!1;if(Zr(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let i=s.task;typeof i.taskId=="string"&&(a=!0,this._taskProgressTokens.set(i.taskId,n))}}if(a||this._progressHandlers.delete(n),Zr(e))o(e);else{let s=k.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,n,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,n,r)}}catch(s){yield{type:"error",error:s instanceof k?s:new k($.InternalError,String(s))}}return}let a;try{let s=await this.request(e,er,r);if(s.task)a=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new k($.InternalError,"Task creation did not return a task");for(;;){let i=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:i},Zt(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},n,r)}:i.status==="failed"?yield{type:"error",error:new k($.InternalError,`Task ${a} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new k($.InternalError,`Task ${a} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},n,r)};return}let l=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(d=>setTimeout(d,l)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof k?s:new k($.InternalError,String(s))}}}request(e,n,r){let{relatedRequestId:o,resumptionToken:a,onresumptiontoken:s,task:i,relatedTask:l}=r??{};return new Promise((d,h)=>{let p=I=>{h(I)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(I){p(I);return}r?.signal?.throwIfAborted();let g=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:g};r?.onprogress&&(this._progressHandlers.set(g,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}}),i&&(f.params={...f.params,task:i}),l&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Gt]:l}});let m=I=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(I)}},{relatedRequestId:o,resumptionToken:a,onresumptiontoken:s}).catch(D=>this._onerror(new Error(`Failed to send cancellation: ${D}`)));let S=I instanceof k?I:new k($.RequestTimeout,String(I));h(S)};this._responseHandlers.set(g,I=>{if(!r?.signal?.aborted){if(I instanceof Error)return h(I);try{let S=Ft(n,I.result);S.success?d(S.data):h(S.error)}catch(S){h(S)}}}),r?.signal?.addEventListener("abort",()=>{m(r?.signal?.reason)});let y=r?.timeout??yv,T=()=>m(k.fromError($.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(g,y,r?.maxTotalTimeout,T,r?.resetTimeoutOnProgress??!1);let w=l?.taskId;if(w){let I=S=>{let D=this._responseHandlers.get(g);D?D(S):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,I),this._enqueueTaskMessage(w,{type:"request",message:f,timestamp:Date.now()}).catch(S=>{this._cleanupTimeout(g),h(S)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:a,onresumptiontoken:s}).catch(I=>{this._cleanupTimeout(g),h(I)})})}async getTask(e,n){return this.request({method:"tasks/get",params:e},Ea,n)}async getTaskResult(e,n,r){return this.request({method:"tasks/result",params:e},n,r)}async listTasks(e,n){return this.request({method:"tasks/list",params:e},wa,n)}async cancelTask(e,n){return this.request({method:"tasks/cancel",params:e},zp,n)}async notification(e,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let r=n?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Gt]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!n?.relatedRequestId&&!n?.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 i={...e,jsonrpc:"2.0"};n?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Gt]:n.relatedTask}}}),this._transport?.send(i,n).catch(l=>this._onerror(l))});return}let s={...e,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Gt]:n.relatedTask}}}),await this._transport.send(s,n)}setRequestHandler(e,n){let r=_l(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,a)=>{let s=gl(e,o);return Promise.resolve(n(s,a))})}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,n){let r=_l(e);this._notificationHandlers.set(r,o=>{let a=gl(e,o);return Promise.resolve(n(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let n=this._taskProgressTokens.get(e);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,n,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,n,r,o)}async _clearTaskQueue(e,n){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,n);for(let o of r)if(o.type==="request"&&Kc(o.message)){let a=o.message.id,s=this._requestResolvers.get(a);s?(s(new k($.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,n){let r=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(r=o.pollInterval)}catch{}return new Promise((o,a)=>{if(n.aborted){a(new k($.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,r);n.addEventListener("abort",()=>{clearTimeout(s),a(new k($.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,n){let r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},n)},getTask:async o=>{let a=await r.getTask(o,n);if(!a)throw new k($.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(o,a,s)=>{await r.storeTaskResult(o,a,s,n);let i=await r.getTask(o,n);if(i){let l=Hr.parse({method:"notifications/tasks/status",params:i});await this.notification(l),Zt(i.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,n),updateTaskStatus:async(o,a,s)=>{let i=await r.getTask(o,n);if(!i)throw new k($.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Zt(i.status))throw new k($.InvalidParams,`Cannot update task "${o}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,a,s,n);let l=await r.getTask(o,n);if(l){let d=Hr.parse({method:"notifications/tasks/status",params:l});await this.notification(d),Zt(l.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,n)}}};function Im(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Am(t,e){let n={...t};for(let r in e){let o=r,a=e[o];if(a===void 0)continue;let s=n[o];Im(s)&&Im(a)?n[o]={...s,...a}:n[o]=a}return n}u();var gg=Iu(ru(),1),yg=Iu(_g(),1);function bP(){let t=new gg.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,yg.default)(t),t}var gs=class{constructor(e){this._ajv=e??bP()}getValidator(e){let n="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return r=>n(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};u();var ys=class{constructor(e){this._server=e}requestStream(e,n,r){return this._server.requestStream(e,n,r)}createMessageStream(e,n){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.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],a=Array.isArray(o.content)?o.content:[o.content],s=a.some(h=>h.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,l=i?Array.isArray(i.content)?i.content:[i.content]:[],d=l.some(h=>h.type==="tool_use");if(s){if(a.some(h=>h.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!d)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(d){let h=new Set(l.filter(g=>g.type==="tool_use").map(g=>g.id)),p=new Set(a.filter(g=>g.type==="tool_result").map(g=>g.toolUseId));if(h.size!==p.size||![...h].every(g=>p.has(g)))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},Jr,n)}elicitInputStream(e,n){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let a=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:a},rr,n)}async getTask(e,n){return this._server.getTask({taskId:e},n)}async getTaskResult(e,n,r){return this._server.getTaskResult({taskId:e},n,r)}async listTasks(e,n){return this._server.listTasks(e?{cursor:e}:void 0,n)}async cancelTask(e,n){return this._server.cancelTask({taskId:e},n)}};u();function Eg(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${n} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Tg(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${n} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Es=class extends $a{constructor(e,n){super(n),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Kr.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let a=this._loggingLevels.get(o);return a?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new gs,this.setRequestHandler(Qc,r=>this._oninitialize(r)),this.setNotificationHandler(el,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(il,async(r,o)=>{let a=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Kr.safeParse(s);return i.success&&this._loggingLevels.set(a,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ys(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Am(this._capabilities,e)}setRequestHandler(e,n){let o=jt(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let a;if(Xe(o)){let i=o;a=i._zod?.def?.value??i.value}else{let i=o;a=i._def?.value??i.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");if(a==="tools/call"){let i=async(l,d)=>{let h=Ft(nr,l);if(!h.success){let m=h.error instanceof Error?h.error.message:String(h.error);throw new k($.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:p}=h.data,g=await Promise.resolve(n(l,d));if(p.task){let m=Ft(er,g);if(!m.success){let y=m.error instanceof Error?m.error.message:String(m.error);throw new k($.InvalidParams,`Invalid task creation result: ${y}`)}return m.data}let f=Ft(Ca,g);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new k($.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,n)}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){Tg(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Eg(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let n=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Pp.includes(n)?n:Hc,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"},ma)}async createMessage(e,n){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 r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],a=o.some(d=>d.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],l=i.some(d=>d.type==="tool_use");if(a){if(o.some(d=>d.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(i.filter(p=>p.type==="tool_use").map(p=>p.id)),h=new Set(o.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(d.size!==h.size||![...d].every(p=>h.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},cl,n):this.request({method:"sampling/createMessage",params:e},Jr,n)}async elicitInput(e,n){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},rr,n)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:o},rr,n);if(a.action==="accept"&&a.content&&o.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(o.requestedSchema)(a.content);if(!i.valid)throw new k($.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){throw s instanceof k?s:new k($.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return a}}}createElicitationCompletionNotifier(e,n){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}},n)}async listRoots(e,n){return this.request({method:"roots/list",params:e},ll,n)}async sendLoggingMessage(e,n){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,n))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"})}};u();var wg=Symbol.for("mcp.completable");function uu(t){return!!t&&typeof t=="object"&&wg in t}function vg(t){return t[wg]?.complete}var bg;(function(t){t.Completable="McpCompletable"})(bg||(bg={}));u();var Ts=class t{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,n,r){if(e.length>n)throw new Error(`${r} exceeds maximum length of ${n} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){t.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let n=[],r="",o=0,a=0;for(;o<e.length;)if(e[o]==="{"){r&&(n.push(r),r="");let s=e.indexOf("}",o);if(s===-1)throw new Error("Unclosed template expression");if(a++,a>1e4)throw new Error("Template contains too many expressions (max 10000)");let i=e.slice(o+1,s),l=this.getOperator(i),d=i.includes("*"),h=this.getNames(i),p=h[0];for(let g of h)t.validateLength(g,1e6,"Variable name");n.push({name:p,operator:l,names:h,exploded:d}),o=s+1}else r+=e[o],o++;return r&&n.push(r),n}getOperator(e){return["+","#",".","/","?","&"].find(r=>e.startsWith(r))||""}getNames(e){let n=this.getOperator(e);return e.slice(n.length).split(",").map(r=>r.replace("*","").trim()).filter(r=>r.length>0)}encodeValue(e,n){return t.validateLength(e,1e6,"Variable value"),n==="+"||n==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,n){if(e.operator==="?"||e.operator==="&"){let s=e.names.map(l=>{let d=n[l];if(d===void 0)return"";let h=Array.isArray(d)?d.map(p=>this.encodeValue(p,e.operator)).join(","):this.encodeValue(d.toString(),e.operator);return`${l}=${h}`}).filter(l=>l.length>0);return s.length===0?"":(e.operator==="?"?"?":"&")+s.join("&")}if(e.names.length>1){let s=e.names.map(i=>n[i]).filter(i=>i!==void 0);return s.length===0?"":s.map(i=>Array.isArray(i)?i[0]:i).join(",")}let r=n[e.name];if(r===void 0)return"";let a=(Array.isArray(r)?r:[r]).map(s=>this.encodeValue(s,e.operator));switch(e.operator){case"":return a.join(",");case"+":return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/");default:return a.join(",")}}expand(e){let n="",r=!1;for(let o of this.parts){if(typeof o=="string"){n+=o;continue}let a=this.expandPart(o,e);a&&((o.operator==="?"||o.operator==="&")&&r?n+=a.replace("?","&"):n+=a,(o.operator==="?"||o.operator==="&")&&(r=!0))}return n}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let n=[];for(let a of e.names)t.validateLength(a,1e6,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let a=0;a<e.names.length;a++){let s=e.names[a],i=a===0?"\\"+e.operator:"&";n.push({pattern:i+this.escapeRegExp(s)+"=([^&]+)",name:s})}return n}let r,o=e.name;switch(e.operator){case"":r=e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":r="(.+)";break;case".":r="\\.([^/,]+)";break;case"/":r="/"+(e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:r="([^/]+)"}return n.push({pattern:r,name:o}),n}match(e){t.validateLength(e,1e6,"URI");let n="^",r=[];for(let i of this.parts)if(typeof i=="string")n+=this.escapeRegExp(i);else{let l=this.partToRegExp(i);for(let{pattern:d,name:h}of l)n+=d,r.push({name:h,exploded:i.exploded})}n+="$",t.validateLength(n,1e6,"Generated regex pattern");let o=new RegExp(n),a=e.match(o);if(!a)return null;let s={};for(let i=0;i<r.length;i++){let{name:l,exploded:d}=r[i],h=a[i+1],p=l.replace("*","");d&&h.includes(",")?s[p]=h.split(","):s[p]=h}return s}};u();var wP=/^[A-Za-z0-9._-]{1,128}$/;function vP(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!wP.test(t)){let n=t.split("").filter(r=>!/[A-Za-z0-9._-]/.test(r)).filter((r,o,a)=>a.indexOf(r)===o);return e.push(`Tool name contains invalid characters: ${n.map(r=>`"${r}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function IP(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let n of e)console.warn(` - ${n}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function hu(t){let e=vP(t);return IP(t,e.warnings),e.isValid}u();var bs=class{constructor(e){this._mcpServer=e}registerToolTask(e,n,r){let o={taskSupport:"required",...n.execution};if(o.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,n.title,n.description,n.inputSchema,n.outputSchema,n.annotations,o,n._meta,r)}};u();var Ig=class{constructor(e,n){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Es(e,n)}get experimental(){return this._experimental||(this._experimental={tasks:new bs(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Xt(Pa)),this.server.assertCanSetRequestHandler(Xt(nr)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Pa,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,n])=>{let r={name:e,title:n.title,description:n.description,inputSchema:(()=>{let o=Xn(n.inputSchema);return o?fl(o,{strictUnions:!0,pipeStrategy:"input"}):AP})(),annotations:n.annotations,execution:n.execution,_meta:n._meta};if(n.outputSchema){let o=Xn(n.outputSchema);o&&(r.outputSchema=fl(o,{strictUnions:!0,pipeStrategy:"output"}))}return r})})),this.server.setRequestHandler(nr,async(e,n)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new k($.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new k($.InvalidParams,`Tool ${e.params.name} disabled`);let o=!!e.params.task,a=r.execution?.taskSupport,s="createTask"in r.handler;if((a==="required"||a==="optional")&&!s)throw new k($.InternalError,`Tool ${e.params.name} has taskSupport '${a}' but was not registered with registerToolTask`);if(a==="required"&&!o)throw new k($.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(a==="optional"&&!o&&s)return await this.handleAutomaticTaskPolling(r,e,n);let i=await this.validateToolInput(r,e.params.arguments,e.params.name),l=await this.executeToolHandler(r,i,n);return o||await this.validateToolOutput(r,l,e.params.name),l}catch(r){if(r instanceof k&&r.code===$.UrlElicitationRequired)throw r;return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,n,r){if(!e.inputSchema)return;let a=Xn(e.inputSchema)??e.inputSchema,s=await sa(a,n);if(!s.success){let i="error"in s?s.error:"Unknown error",l=ia(i);throw new k($.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${l}`)}return s.data}async validateToolOutput(e,n,r){if(!e.outputSchema||!("content"in n)||n.isError)return;if(!n.structuredContent)throw new k($.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=Xn(e.outputSchema),a=await sa(o,n.structuredContent);if(!a.success){let s="error"in a?a.error:"Unknown error",i=ia(s);throw new k($.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${i}`)}}async executeToolHandler(e,n,r){let o=e.handler;if("createTask"in o){if(!r.taskStore)throw new Error("No task store provided.");let s={...r,taskStore:r.taskStore};if(e.inputSchema){let i=o;return await Promise.resolve(i.createTask(n,s))}else{let i=o;return await Promise.resolve(i.createTask(s))}}if(e.inputSchema){let s=o;return await Promise.resolve(s(n,r))}else{let s=o;return await Promise.resolve(s(r))}}async handleAutomaticTaskPolling(e,n,r){if(!r.taskStore)throw new Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(e,n.params.arguments,n.params.name),a=e.handler,s={...r,taskStore:r.taskStore},i=o?await Promise.resolve(a.createTask(o,s)):await Promise.resolve(a.createTask(s)),l=i.task.taskId,d=i.task,h=d.pollInterval??5e3;for(;d.status!=="completed"&&d.status!=="failed"&&d.status!=="cancelled";){await new Promise(g=>setTimeout(g,h));let p=await r.taskStore.getTask(l);if(!p)throw new k($.InternalError,`Task ${l} not found during polling`);d=p}return await r.taskStore.getTaskResult(l)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Xt(Da)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Da,async e=>{switch(e.params.ref.type){case"ref/prompt":return Bp(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return qp(e),this.handleResourceCompletion(e,e.params.ref);default:throw new k($.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,n){let r=this._registeredPrompts[n.name];if(!r)throw new k($.InvalidParams,`Prompt ${n.name} not found`);if(!r.enabled)throw new k($.InvalidParams,`Prompt ${n.name} disabled`);if(!r.argsSchema)return Po;let a=jt(r.argsSchema)?.[e.params.argument.name];if(!uu(a))return Po;let s=vg(a);if(!s)return Po;let i=await s(e.params.argument.value,e.params.context);return Og(i)}async handleResourceCompletion(e,n){let r=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===n.uri);if(!r){if(this._registeredResources[n.uri])return Po;throw new k($.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return Po;let a=await o(e.params.argument.value,e.params.context);return Og(a)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Xt(Ia)),this.server.assertCanSetRequestHandler(Xt(Aa)),this.server.assertCanSetRequestHandler(Xt(Sa)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ia,async(e,n)=>{let r=Object.entries(this._registeredResources).filter(([a,s])=>s.enabled).map(([a,s])=>({uri:a,name:s.name,...s.metadata})),o=[];for(let a of Object.values(this._registeredResourceTemplates)){if(!a.resourceTemplate.listCallback)continue;let s=await a.resourceTemplate.listCallback(n);for(let i of s.resources)o.push({...a.metadata,...i})}return{resources:[...r,...o]}}),this.server.setRequestHandler(Aa,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([n,r])=>({name:n,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(Sa,async(e,n)=>{let r=new URL(e.params.uri),o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new k($.InvalidParams,`Resource ${r} disabled`);return o.readCallback(r,n)}for(let a of Object.values(this._registeredResourceTemplates)){let s=a.resourceTemplate.uriTemplate.match(r.toString());if(s)return a.readCallback(r,s,n)}throw new k($.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Xt(Oa)),this.server.assertCanSetRequestHandler(Xt(Na)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Oa,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,n])=>({name:e,title:n.title,description:n.description,arguments:n.argsSchema?SP(n.argsSchema):void 0}))})),this.server.setRequestHandler(Na,async(e,n)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new k($.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new k($.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let o=Xn(r.argsSchema),a=await sa(o,e.params.arguments);if(!a.success){let l="error"in a?a.error:"Unknown error",d=ia(l);throw new k($.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${d}`)}let s=a.data,i=r.callback;return await Promise.resolve(i(s,n))}else{let o=r.callback;return await Promise.resolve(o(n))}}),this._promptHandlersInitialized=!0)}resource(e,n,...r){let o;typeof r[0]=="object"&&(o=r.shift());let a=r[0];if(typeof n=="string"){if(this._registeredResources[n])throw new Error(`Resource ${n} is already registered`);let s=this._createRegisteredResource(e,void 0,n,o,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,n,o,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,n,r,o){if(typeof n=="string"){if(this._registeredResources[n])throw new Error(`Resource ${n} is already registered`);let a=this._createRegisteredResource(e,r.title,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let a=this._createRegisteredResourceTemplate(e,r.title,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,n,r,o,a){let s={name:e,title:n,metadata:o,readCallback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:i=>{typeof i.uri<"u"&&i.uri!==r&&(delete this._registeredResources[r],i.uri&&(this._registeredResources[i.uri]=s)),typeof i.name<"u"&&(s.name=i.name),typeof i.title<"u"&&(s.title=i.title),typeof i.metadata<"u"&&(s.metadata=i.metadata),typeof i.callback<"u"&&(s.readCallback=i.callback),typeof i.enabled<"u"&&(s.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,n,r,o,a){let s={resourceTemplate:r,title:n,metadata:o,readCallback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(delete this._registeredResourceTemplates[e],d.name&&(this._registeredResourceTemplates[d.name]=s)),typeof d.title<"u"&&(s.title=d.title),typeof d.template<"u"&&(s.resourceTemplate=d.template),typeof d.metadata<"u"&&(s.metadata=d.metadata),typeof d.callback<"u"&&(s.readCallback=d.callback),typeof d.enabled<"u"&&(s.enabled=d.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;return Array.isArray(i)&&i.some(d=>!!r.completeCallback(d))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,n,r,o,a){let s={title:n,description:r,argsSchema:o===void 0?void 0:vn(o),callback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredPrompts[e],i.name&&(this._registeredPrompts[i.name]=s)),typeof i.title<"u"&&(s.title=i.title),typeof i.description<"u"&&(s.description=i.description),typeof i.argsSchema<"u"&&(s.argsSchema=vn(i.argsSchema)),typeof i.callback<"u"&&(s.callback=i.callback),typeof i.enabled<"u"&&(s.enabled=i.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=s,o&&Object.values(o).some(l=>{let d=l instanceof Ue?l._def?.innerType:l;return uu(d)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(e,n,r,o,a,s,i,l,d){hu(e);let h={title:n,description:r,inputSchema:Sg(o),outputSchema:Sg(a),annotations:s,execution:i,_meta:l,handler:d,enabled:!0,disable:()=>h.update({enabled:!1}),enable:()=>h.update({enabled:!0}),remove:()=>h.update({name:null}),update:p=>{typeof p.name<"u"&&p.name!==e&&(typeof p.name=="string"&&hu(p.name),delete this._registeredTools[e],p.name&&(this._registeredTools[p.name]=h)),typeof p.title<"u"&&(h.title=p.title),typeof p.description<"u"&&(h.description=p.description),typeof p.paramsSchema<"u"&&(h.inputSchema=vn(p.paramsSchema)),typeof p.outputSchema<"u"&&(h.outputSchema=vn(p.outputSchema)),typeof p.callback<"u"&&(h.handler=p.callback),typeof p.annotations<"u"&&(h.annotations=p.annotations),typeof p._meta<"u"&&(h._meta=p._meta),typeof p.enabled<"u"&&(h.enabled=p.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=h,this.setToolRequestHandlers(),this.sendToolListChanged(),h}tool(e,...n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let r,o,a,s;if(typeof n[0]=="string"&&(r=n.shift()),n.length>1){let l=n[0];if(pu(l))o=n.shift(),n.length>1&&typeof n[0]=="object"&&n[0]!==null&&!pu(n[0])&&(s=n.shift());else if(typeof l=="object"&&l!==null){if(Object.values(l).some(d=>typeof d=="object"&&d!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=n.shift()}}let i=n[0];return this._createRegisteredTool(e,void 0,r,o,a,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,n,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:a,inputSchema:s,outputSchema:i,annotations:l,_meta:d}=n;return this._createRegisteredTool(e,o,a,s,i,l,{taskSupport:"forbidden"},d,r)}prompt(e,...n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let r;typeof n[0]=="string"&&(r=n.shift());let o;n.length>1&&(o=n.shift());let a=n[0],s=this._createRegisteredPrompt(e,void 0,r,o,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,n,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:a,argsSchema:s}=n,i=this._createRegisteredPrompt(e,o,a,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,n){return this.server.sendLoggingMessage(e,n)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},Ag=class{constructor(e,n){this._callbacks=n,this._uriTemplate=typeof e=="string"?new Ts(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}},AP={type:"object",properties:{}};function Ng(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function Pg(t){return"_def"in t||"_zod"in t||Ng(t)}function pu(t){return typeof t!="object"||t===null||Pg(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(Ng)}function Sg(t){if(t){if(pu(t))return vn(t);if(!Pg(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function SP(t){let e=jt(t);return e?Object.entries(e).map(([n,r])=>{let o=ap(r),a=sp(r);return{name:n,description:o,required:!a}}):[]}function Xt(t){let n=jt(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let r=ca(n);if(typeof r=="string")return r;throw new Error("Schema method literal must be a string")}function Og(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var Po={completion:{values:[],hasMore:!1}};u();u();u();u();u();import{readFileSync as LP}from"node:fs";import{dirname as $P,join as MP}from"node:path";import{fileURLToPath as zP}from"node:url";u();var be,Co=null;function ws(){return(Co===null||Co.byteLength===0)&&(Co=new Uint8Array(be.memory.buffer)),Co}var vs=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&vs.decode();var OP=2146435072,mu=0;function NP(t,e){return mu+=e,mu>=OP&&(vs=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},vs.decode(),mu=e),vs.decode(ws().subarray(t,t+e))}function fu(t,e){return t=t>>>0,NP(t,e)}function _u(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let o=t.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){let o=t.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(t)){let o=t.length,a="[";o>0&&(a+=_u(t[0]));for(let s=1;s<o;s++)a+=", "+_u(t[s]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(t)),r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
43
- ${t.stack}`:r}var As=0,Is=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},PP=typeof Is.encodeInto=="function"?function(t,e){return Is.encodeInto(t,e)}:function(t,e){let n=Is.encode(t);return e.set(n),{read:t.length,written:n.length}};function Cg(t,e,n){if(n===void 0){let i=Is.encode(t),l=e(i.length,1)>>>0;return ws().subarray(l,l+i.length).set(i),As=i.length,l}let r=t.length,o=e(r,1)>>>0,a=ws(),s=0;for(;s<r;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i}if(s!==r){s!==0&&(t=t.slice(s)),o=n(o,r,r=s+t.length*3,1)>>>0;let i=ws().subarray(o+s,o+r),l=PP(t,i);s+=l.written,o=n(o,r,s,1)>>>0}return As=s,o}var Ln=null;function gu(){return(Ln===null||Ln.buffer.detached===!0||Ln.buffer.detached===void 0&&Ln.buffer!==be.memory.buffer)&&(Ln=new DataView(be.memory.buffer)),Ln}function CP(t){return t==null}function DP(t,e){t=t>>>0;let n=gu(),r=[];for(let o=t;o<t+4*e;o+=4)r.push(be.__wbindgen_export_2.get(n.getUint32(o,!0)));return be.__externref_drop_slice(t,e),r}function Dg(t,e){let n=Cg(t,be.__wbindgen_malloc,be.__wbindgen_realloc),r=As,o=be.cut(n,r,CP(e)?16777215:e?1:0);var a=DP(o[0],o[1]).slice();return be.__wbindgen_free(o[0],o[1]*4,4),a}var RP=new Set(["basic","cors","default"]);async function kP(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.ok&&RP.has(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function Rg(){let t={};return t.wbg={},t.wbg.__wbg_Error_0497d5bdba9362e5=function(e,n){return Error(fu(e,n))},t.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_debug_string=function(e,n){let r=_u(n),o=Cg(r,be.__wbindgen_malloc,be.__wbindgen_realloc),a=As;gu().setInt32(e+4,a,!0),gu().setInt32(e+0,o,!0)},t.wbg.__wbindgen_init_externref_table=function(){let e=be.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_new=function(e,n){return fu(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(fu(e,n))},t}function kg(t,e){return be=t.exports,xP.__wbindgen_wasm_module=e,Ln=null,Co=null,be.__wbindgen_start(),be}function xg(t){if(be!==void 0)return be;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=Rg();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let n=new WebAssembly.Instance(t,e);return kg(n,t)}async function xP(t){if(be!==void 0)return be;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("jieba_rs_wasm_bg.wasm",import.meta.url));let e=Rg();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await kP(await t,e);return kg(n,r)}var Lg=!1,$g=(t,e)=>{if(!Lg){let n=MP($P(zP(import.meta.url)),"jieba-engine.wasm");xg({module:LP(n)}),Lg=!0}return Dg(t,e)};var UP=new Set(["a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]),FP=/[a-z0-9]+/g,jP=t=>{let e=t.toLowerCase().replace(/'s\b/g,""),n=[];for(let r of e.matchAll(FP)){let o=r[0];UP.has(o)||n.push(BP(o))}return n},GP=/[㐀-鿿豈-﫿぀-ヿ가-힯]|[a-z0-9]/i,ZP=t=>$g(t.toLowerCase(),!0).filter(e=>GP.test(e)),Eu=t=>{switch(Un){case"ZION":return ZP(t);case"MOMEN":return jP(t);default:throw new Error(`[analyzer] unknown PRODUCT '${Un}'`)}},$n=(t,e)=>{let n=t[e];return n==="a"||n==="e"||n==="i"||n==="o"||n==="u"?!1:n==="y"?e===0?!0:!$n(t,e-1):!0},Qt=t=>{let e=0,n=!1;for(let r=0;r<t.length;r+=1){let o=!$n(t,r);n&&!o&&(e+=1),n=o}return e},yu=t=>{for(let e=0;e<t.length;e+=1)if(!$n(t,e))return!0;return!1},Mg=t=>{let e=t.length;return e>=2&&t[e-1]===t[e-2]&&$n(t,e-1)},zg=t=>{let e=t.length;if(e<3||!$n(t,e-1)||$n(t,e-2)||!$n(t,e-3))return!1;let n=t[e-1];return n!=="w"&&n!=="x"&&n!=="y"},Ss=(t,e,n)=>t.slice(0,t.length-e.length)+n;function BP(t){let e=t;if(e.length<=2)return e;e.endsWith("sses")?e=Ss(e,"sses","ss"):e.endsWith("ies")?e=Ss(e,"ies","i"):e.endsWith("ss")||e.endsWith("s")&&(e=e.slice(0,-1));let n=!1;e.endsWith("eed")?Qt(e.slice(0,-3))>0&&(e=e.slice(0,-1)):e.endsWith("ed")&&yu(e.slice(0,-2))?(e=e.slice(0,-2),n=!0):e.endsWith("ing")&&yu(e.slice(0,-3))&&(e=e.slice(0,-3),n=!0),n&&(e.endsWith("at")||e.endsWith("bl")||e.endsWith("iz")?e+="e":Mg(e)&&!/[lsz]$/.test(e)?e=e.slice(0,-1):Qt(e)===1&&zg(e)&&(e+="e")),e.endsWith("y")&&yu(e.slice(0,-1))&&(e=`${e.slice(0,-1)}i`);let r=[["ational","ate"],["tional","tion"],["enci","ence"],["anci","ance"],["izer","ize"],["bli","ble"],["alli","al"],["entli","ent"],["eli","e"],["ousli","ous"],["ization","ize"],["ation","ate"],["ator","ate"],["alism","al"],["iveness","ive"],["fulness","ful"],["ousness","ous"],["aliti","al"],["iviti","ive"],["biliti","ble"],["logi","log"]];for(let[i,l]of r)if(e.endsWith(i)){Qt(e.slice(0,e.length-i.length))>0&&(e=Ss(e,i,l));break}let o=[["icate","ic"],["ative",""],["alize","al"],["iciti","ic"],["ical","ic"],["ful",""],["ness",""]];for(let[i,l]of o)if(e.endsWith(i)){Qt(e.slice(0,e.length-i.length))>0&&(e=Ss(e,i,l));break}let a=["al","ance","ence","er","ic","able","ible","ant","ement","ment","ent","ou","ism","ate","iti","ous","ive","ize"],s=!1;for(let i of a)if(e.endsWith(i)){let l=e.slice(0,e.length-i.length);Qt(l)>1&&(e=l),s=!0;break}if(!s&&e.endsWith("ion")){let i=e.slice(0,-3);Qt(i)>1&&/[st]$/.test(i)&&(e=i)}if(e.endsWith("e")){let i=e.slice(0,-1),l=Qt(i);(l>1||l===1&&!zg(i))&&(e=i)}return Qt(e)>1&&Mg(e)&&e.endsWith("l")&&(e=e.slice(0,-1)),e}u();var Ug=1.5,Fg=.75,qP=t=>{let e=[],n=new Map,r=0;for(let{ref:o,tokens:a}of t){let s=new Map;for(let i of a)s.set(i,(s.get(i)??0)+1);for(let i of s.keys())n.set(i,(n.get(i)??0)+1);e.push({ref:o,tf:s,length:a.length}),r+=a.length}return{docs:e,df:n,avgdl:e.length>0?r/e.length:0}},VP=(t,e)=>{let n=[...new Set(Eu(e))],r=t.docs.length;return n.length===0||r===0?[]:t.docs.map(o=>{let a=0;for(let s of n){let i=o.tf.get(s);if(!i)continue;let l=t.df.get(s)??0,d=Math.log(1+(r-l+.5)/(l+.5)),h=i+Ug*(1-Fg+Fg*o.length/(t.avgdl||1));a+=d*(i*(Ug+1)/h)}return{ref:o.ref,score:a}})};u();var wr={actionflow:"## Actionflow Domain Knowledge\nActionflows are server-side workflows for business logic. They run entirely on the server; the frontend triggers them via \"Request \u2013 Actionflow\" component actions.\n\n### When to Use an Actionflow\nDo not create an Actionflow merely to proxy CRUD. Simple single-table CRUD should run directly from the frontend when table, column, and row permissions fully express the authorization policy. Reserve Actionflows for genuinely server-side, multi-step, transactional, or orchestrated operations: cross-table atomicity, trusted calculations or secrets, loops, AI steps, third-party calls, schedules, webhooks, and database triggers. If data permissions cannot express the authorization rule, enforce it server-side here. A condition on its own is not a reason to build a flow: a check that only decides what the UI does belongs in the frontend, and only a condition that must be guaranteed rather than merely evaluated has to run here, where the client cannot bypass it. That includes authorization checks \u2014 if the rule is already expressed in table, column, and row permissions, the frontend may hold the condition, because permissions are enforced on every request and nothing the client sends can bypass them. Wrapping such a check in a flow adds a hop and a second place for the rule to drift, without making it any harder to circumvent.\n\n### Execution Modes\nSynchronous: all nodes in one synchronous Actionflow invocation execute inside a single database transaction; the caller blocks for the result, and any node error rolls back every DB write from that invocation. Asynchronous: the caller gets a task handle instead of blocking and retrieves the result later \u2014 the flow still computes and returns its declared output; only the failing node's DB writes roll back; required for AI agents and video generation.\n\nEvery flow has a `timeout` in seconds for the whole run, not per node: 30 s by default for a synchronous flow and 120 s for an asynchronous one, whose clock stops while a Delay node waits but keeps running through AI waits. Set it on ADD_ACTION_FLOWS or UPDATE_ACTION_FLOW: at least 1, and at most 60 while the flow is synchronous \u2014 a job that needs longer belongs in an asynchronous flow. GET_ALL_ACTION_FLOWS_INFO and GET_ACTION_FLOW_DETAIL report the timeout in force, default included. When it runs out the flow is cut off inside whatever node is running (a query, custom code, an API call) and fails with a timeout error; a synchronous flow's DB writes roll back. Switching a flow whose timeout is above 60 s to synchronous is refused unless the same UPDATE_ACTION_FLOW call lowers `timeout`.\n\n### Triggers\nWhat fires a flow. Four kinds: Manual (a UI action \u2014 no config), scheduled (cron), database-change event, and webhook. Scheduled and database-change triggers are tool-managed: inspect with `GET_ALL_SCHEDULED_TRIGGERS_INFO` / `GET_ALL_DB_TRIGGERS_INFO`, create with `ADD_SCHEDULED_TRIGGERS` (a Quartz cron \u2014 set a future `endInstant` or it never fires) and `ADD_DB_TRIGGERS` (a table + INSERT/UPDATE/DELETE), each pointing at a flow id from `GET_ALL_ACTION_FLOWS_INFO` (update/delete variants too). Manual triggers need no setup; webhook triggers are managed by the separate `webhook` plugin (`ADD_CALLBACK_TRIGGERS`) \u2014 load it to add or edit an incoming HTTP webhook that fires a flow.\n\n### Node Types\nWhat can be added at a position is the add-node menu there: read it with BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS at that same `afterNodeId` and pass that entry's `node` to ADD_ACTION_FLOW_NODE \u2014 the entry already carries every default for that position, and its config fields are yours to override; its `type` and `templateCodeId` name the menu entry, so never assemble those yourself, and an entry disabled there is refused with the same reason. The menu also carries the deployment's **preset integration nodes** (the `TEMPLATE_CODE` entries \u2014 the current user's ID / WeChat OpenID / Access Token, file/media conversion to Zion native types, SMS, and video/AI generation), whose set varies by deployment. There is no built-in `CURRENT_USER` / `FILES` / `SMS` node type; do not pass those to `ADD_ACTION_FLOW_NODE`.\n\n### AI Conversation Nodes\nAI conversation nodes are valid only in asynchronous Actionflows.\n\n`AI_CREATE_CONVERSATION` creates a new conversation and runs its first turn. Bind the Agent's declared inputs; Start has no free-form message field because the first user message comes from the Agent's configured prompt. When the node completes, `id` is the conversation ID and `data` is the Agent result. For plain output, `data` is text; for structured output, it has the Agent's declared output type. `id` and `data` are the stable fields. Inspect the node's data-binding options for feature-dependent reasoning and media outputs.\n\n`AI_SEND_MESSAGE` continues an existing conversation. Continue returns the same `id` and `data` shape as Start. Bind `conversationId` to the `id` returned by Start, then bind the new message. Continue uses the Agent configuration stored by Start; selecting another Agent on Continue does not switch the conversation. Use the same `configId` as Start so validation and output typing remain correct.\n\n`AI_STOP_RESPONSE` cancels only the response currently being generated. It preserves the conversation, which may later be continued. `AI_DELETE_CONVERSATION` permanently deletes the conversation and its messages. Stop and Delete have no node output.\n\nUse the target node's data-binding options to select the preceding Start or Continue node's `id`; the event's `taskId` is not a conversation ID.\n\nStart and Continue are wait points: the Actionflow does not proceed to the next node until the AI response finishes. A Stop node placed after Start or Continue therefore cannot stop that response.\n\n**Current runtime limitation:** There is currently no safe cancellation path for a response launched by an Actionflow. Do not use Stop for a response launched by an Actionflow. Stop acts only while the stored status is `IN_PROGRESS`; once it is `STREAMING`, Stop does not cancel the response. If Stop reaches an in-progress response, canceling leaves the AI child task processing, so the source Actionflow never resumes.\n\n### Choosing How to Express Logic: nodes \u2192 formulas \u2192 code\nThree tiers, in order of preference:\n1. **Visual nodes** for orchestration \u2014 query / branch / iterate / write / call (Database, Condition, Loop, Set Variable, Call API, Run Actionflow). They take part in the flow's transaction, surface individually in logs and the edit-time error collector, and stay user-editable.\n2. **Formula bindings** for value-level computation. A node value \u2014 a Set Variable value, a mutation column, a condition predicate \u2014 can be a FORMULA binding built with the bindings plugin, and formulas cover far more than people expect: text and regex (extract / match / replace, substring, split, concat), math, date/time arithmetic and formatting, array aggregation / mapping / filtering, JSON value access, and type casts. Prefer a formula over code whenever you are computing a single value.\n3. **Run Code** only for genuinely procedural logic that neither a node nor a formula operator expresses \u2014 e.g. cryptographic hashing / signature building, multi-step algorithms with intermediate state, or assembling / parsing a complex nested payload. Keep it small and fed by node inputs; never collapse a whole flow into one Run Code node.\n\n### Variables\nDeclared at flow level, accessible by all nodes, assigned with \"Set Variable\" node.\n\n### Inputs & Outputs\nInspect a flow first with `GET_ALL_ACTION_FLOWS_INFO` / `GET_ACTION_FLOW_DETAIL` (unless its detail is already provided in your context). Declare typed **input params** with `ADD_ACTION_FLOW_INPUT_PARAMS`; set each param's type to a value copied verbatim from `GET_ACTION_FLOW_SELECTABLE_TYPES` (never hand-build the type string). Every input param, variable, output field and code-node input/output name is an identifier: letters, digits and underscores only, never starting with a digit. The editor enforces the same rule on a manual rename, so a name that breaks it is one the user cannot repair in the UI; put user-facing wording in a displayName or description instead.\n\nA flow returns a **single typed output value**: set its type with `SET_ACTION_FLOW_OUTPUT`\n(type copied from `GET_ACTION_FLOW_SELECTABLE_TYPES`) and clear it with\n`CLEAR_ACTION_FLOW_OUTPUT`; bind the value afterwards at the output's schema path.\n\n### Building & Editing a Flow\nCreate flows with `ADD_ACTION_FLOWS` (each seeds an empty FLOW_START \u2192 FLOW_END), then read node and structure ids from `GET_ACTION_FLOW_DETAIL` before editing. See what can be added after a node with `BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS` at that same position, then add an entry's `node` with `ADD_ACTION_FLOW_NODE`; reorder with `MOVE_ACTION_FLOW_NODES`, remove with `DELETE_ACTION_FLOW_NODES`, and branch a Condition node with `ADD_ACTION_FLOW_BRANCH_ITEM`. When a flow has grown a run of nodes that reads as one step, or the same run is wanted in another flow, extract it with `EXTRACT_ACTION_FLOW_NODES` instead of rebuilding it: the run becomes a new flow with the inputs and output it needs, and a Run Actionflow node calling it stays in place. Every node's displayName should state its business intent ('Insert generation request', 'Decrement like count') rather than the node-type default \u2014 it is optional, and a name left off becomes that default, so omit it only when no better name fits. Edit a node's name or type-scalar config with `UPDATE_ACTION_FLOW_NODE`, but set its data bindings (values, conditions, data sources, mutation fields) with the bindings plugin at the node's schema path \u2014 never inline. A node's schema path is NEVER hand-built: copy it from `ADD_ACTION_FLOW_NODE`'s result or `GET_ACTION_FLOW_DETAIL`'s nodeSchemaPaths (form: server/actionFlows/{i}/allNodes/{j}), then append key segments to reach a binding site inside the node. The key names vary by node type \u2014 an AI node's input arg is `.../allNodes/{j}/inputArgs/<argKey>`, a code node's is `.../allNodes/{j}/inputs/{index}/value`, a mutation column is `.../allNodes/{j}/mutation/object/<columnName>` \u2014 copy the exact keys from `GET_ACTION_FLOW_CONTEXT_INFO`'s currentNode structure, never guess them. Declare flow variables with `ADD_ACTION_FLOW_GLOBAL_VARIABLES` and assign them in a Set Variable node with `ADD_GLOBAL_VARIABLES_NODE_TARGETS`. A Run Code node's `args.<name>` input slots are managed with `ADD_CUSTOM_CODE_NODE_INPUT` (rename/delete variants); its result type is declared with `SET_CUSTOM_CODE_NODE_OUTPUT_TYPE` so downstream nodes can bind to it; fill the code body with `CREATE_CONST_BINDING`. An update or delete Database node is seeded with an always-true filter that matches **every** row \u2014 narrow it with the bindings plugin's request filters before syncing, or the write hits the whole table. A workspace API node's request parameters are pre-seeded on the node when the API is selected \u2014 read the node back and bind ONLY the parameter slots it shows under `event/inputs/<param>`. NEVER invent input keys the read-back does not show: the runtime and editor ignore them.\n\n### Condition Branches\nCondition branches use their left-to-right editor order. At runtime, only the first branch whose condition is true has its branch body executed; branches to its right are not entered. Put an `Always` branch last when fallback behavior is required\u2014an earlier `Always` branch shadows every branch to its right. Do not rely on the no-match behavior; provide an explicit fallback whenever the flow must choose a branch. Only `MUTUAL_EXCLUSION` is supported. `MUTUAL_TOLERANCE` may still appear in generated argument schemas, but tolerance branches are not implemented and fail at runtime. Always set a Condition node's `conditionType` to `MUTUAL_EXCLUSION`.\n\n### Node Input Visibility (Scope)\nWhat a node can bind to is not \"any earlier node\": ztype limits it to the nodes **visible** from that site \u2014 the ones on its straight path back from FLOW_START. The data binding options tree returned with every binding response (its \"Actionflow data\" branch) already applies this rule and is the authoritative list of reachable node outputs; if a node is absent there it is out of scope, so never hand-build a path to reach it.\n\nLoops and Condition branches are **one-way scopes**. From *inside* a block, a node sees the outer scope, the flow inputs, and \u2014 in a Loop \u2014 the current item; but from *outside* the block (any node after the loop's end or after a branch merge) the block's inner nodes are invisible, and sibling branches never see one another. A value produced inside one branch or one loop iteration therefore CANNOT be bound directly by a later node \u2014 it will not appear in that node's options tree.\n\nTo carry a branch- or loop-dependent value past the block, use a **flow variable** \u2014 the only output that crosses a scope boundary. Declare it once with `ADD_ACTION_FLOW_GLOBAL_VARIABLES` (type copied from `GET_ACTION_FLOW_SELECTABLE_TYPES`), assign it *inside* the branch or loop body with a Set Variable node (`ADD_GLOBAL_VARIABLES_NODE_TARGETS`), then read the variable from any later node. Idioms: choose a value by branch \u2014 assign the SAME variable in every branch, then read it after the merge; capture or accumulate across a Loop \u2014 assign the variable inside the loop body, then read it after the loop's end. A branch that never assigns the variable leaves its prior value, so set a sensible default before the branch when every path must yield one.\n\n### Concurrency\nConcurrent invocations of the same flow interleave between nodes; sync-mode ACID rolls back on error but does NOT serialize flows (read committed). Query-a-row, branch, then write based on that read is a race: concurrent calls all act on the same stale read. Where the platform can express the check inside the write, prefer that: put row-local guards in the mutation node's own filter (update where stock >= qty; delete where the key pair matches) and branch on the write's affected rows; use an update node's increment/decrement mode for counters; for insert-if-absent or toggle semantics use a unique constraint (the only DB-enforced constraint kind today) as the insert node's conflict target with action 'none' (`UPDATE_ACTION_FLOW_NODE`'s `onConflict`), then branch on whether the insert returned a row \u2014 a skipped conflict returns no row. Invariants none of these can express (cross-row rules, aggregates) have no atomic form yet; check-then-write is the accepted fallback there.\n\n### Error Handling\nSynchronous: all DB changes roll back on error. Asynchronous: only the failing node's DB changes roll back.\n\n### Versioning\nEach save creates a new version. \"Sync Backend\" required after editing for changes to take effect in production.\n\n### JavaScript Sandbox (Run Code node)\nCustom Code Blocks run in a synchronous GraalJS server sandbox. No async/await, no require(), no browser APIs. All platform interactions go through the global `context` object: context.getArg(key) \u2014 retrieve flow input context.setResult(val) \u2014 pass this node's single result downstream context.runGql(opName, gql, vars, permission) \u2014 execute DB operations context.callThirdPartyApi(apiId, params) \u2014 invoke a workspace API by its apiId (the method name is historical; this project has no third-party API configs) context.callActionFlow(flowId, ver, args) \u2014 run a sub-flow synchronously context.createActionFlowTask(flowId, ver, args) \u2014 trigger a sub-flow async context.getSsoUserInfo() \u2014 get authenticated user profile context.uploadMedia(url, headers) \u2014 stream remote image to asset server context.log(message) \u2014 emit to Log Service\n\n`runGql` takes FOUR arguments and the first one is the operation NAME, not the document: `runGql(\"GetWords\", \"query GetWords { theme_word(where: {...}) { word } }\", {}, {role: \"admin\"})`. The name must match the one declared in the document. `vars` is a JS object (not a JSON string) and `permission` is `{role: \"<role name>\"}` with an optional `sessionVariable` map. Passing the document first is the mistake that costs an afternoon: the arity error, then a String-coercion error naming a type you did not pass, then \"permission should have field role\" are all the same misalignment reported one argument at a time.\n\nIt returns the `data` object directly \u2014 `r.theme_word`, never `r.data.theme_word` \u2014 and it THROWS on a GraphQL error rather than returning an `errors` array, so there is no envelope to branch on. Do not write defensive code for a response shape you have not seen.\n\nThe list above is the methods you will reach for, not the whole API. The complete Context API reference \u2014 every method with its parameters and return shape \u2014 is the \"Develop with Run Code\" developer page: find it with `docs.search`, and read it rather than inferring a signature from an error message. Search by title; the page's path is not the same across products.",agent:`Zion is a powerful no-code development platform that enables developers to build and deploy web, mobile, and WeChat Mini Program (\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F) applications. It integrates a visual drag-and-drop design canvas, an enterprise-grade relational database engine (PostgreSQL), and an event-driven backend logic execution pipeline.
42
+ ]`;continue}o+=r[l],r[l]==="\\"?a=!0:s&&r[l]==="]"?s=!1:!s&&r[l]==="["&&(s=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}function $a(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===A.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((r,o)=>({...r,[o]:F(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let n={type:"object",additionalProperties:F(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return n;if(t.keyType?._def.typeName===A.ZodString&&t.keyType._def.checks?.length){let{type:r,...o}=La(t.keyType._def,e);return{...n,propertyNames:o}}else{if(t.keyType?._def.typeName===A.ZodEnum)return{...n,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===A.ZodBranded&&t.keyType._def.type._def.typeName===A.ZodString&&t.keyType._def.type._def.checks?.length){let{type:r,...o}=ka(t.keyType._def,e);return{...n,propertyNames:o}}}return n}function im(t,e){if(e.mapStrategy==="record")return $a(t,e);let n=F(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),r=F(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}u();function cm(t){let e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),o=Array.from(new Set(r.map(a=>typeof a)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}u();function lm(t){return t.target==="openAi"?void 0:{not:fe({...t,currentPath:[...t.currentPath,"not"]})}}u();function dm(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}u();u();var Qr={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function hm(t,e){if(e.target==="openApi3")return um(t,e);let n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in Qr&&(!r._def.checks||!r._def.checks.length))){let r=n.reduce((o,a)=>{let s=Qr[a._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){let r=n.reduce((o,a)=>{let s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":if(a._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(r.length===n.length){let o=r.filter((a,s,i)=>i.indexOf(a)===s);return{type:o.length>1?o:o[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(a=>!r.includes(a))],[])};return um(t,e)}var um=(t,e)=>{let n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,o)=>F(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function pm(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Qr[t.innerType._def.typeName],nullable:!0}:{type:[Qr[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let r=F(t.innerType._def,{...e,currentPath:[...e.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let n=F(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}u();function mm(t,e){let n={type:"number"};if(!t.checks)return n;for(let r of t.checks)switch(r.kind){case"int":n.type="integer",hl(n,"type",r.message,e);break;case"min":e.target==="jsonSchema7"?r.inclusive?J(n,"minimum",r.value,r.message,e):J(n,"exclusiveMinimum",r.value,r.message,e):(r.inclusive||(n.exclusiveMinimum=!0),J(n,"minimum",r.value,r.message,e));break;case"max":e.target==="jsonSchema7"?r.inclusive?J(n,"maximum",r.value,r.message,e):J(n,"exclusiveMaximum",r.value,r.message,e):(r.inclusive||(n.exclusiveMaximum=!0),J(n,"maximum",r.value,r.message,e));break;case"multipleOf":J(n,"multipleOf",r.value,r.message,e);break}return n}u();function fm(t,e){let n=e.target==="openAi",r={type:"object",properties:{}},o=[],a=t.shape();for(let i in a){let l=a[i];if(l===void 0||l._def===void 0)continue;let d=yv(l);d&&n&&(l._def.typeName==="ZodOptional"&&(l=l._def.innerType),l.isNullable()||(l=l.nullable()),d=!1);let h=F(l._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});h!==void 0&&(r.properties[i]=h,d||o.push(i))}o.length&&(r.required=o);let s=gv(t,e);return s!==void 0&&(r.additionalProperties=s),r}function gv(t,e){if(t.catchall._def.typeName!=="ZodNever")return F(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function yv(t){try{return t.isOptional()}catch{return!0}}u();var _m=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return F(t.innerType._def,e);let n=F(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return n?{anyOf:[{not:fe(e)},n]}:fe(e)};u();var gm=(t,e)=>{if(e.pipeStrategy==="input")return F(t.in._def,e);if(e.pipeStrategy==="output")return F(t.out._def,e);let n=F(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=F(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(o=>o!==void 0)}};u();function ym(t,e){return F(t.type._def,e)}u();function Em(t,e){let r={type:"array",uniqueItems:!0,items:F(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&J(r,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&J(r,"maxItems",t.maxSize.value,t.maxSize.message,e),r}u();function Tm(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>F(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:F(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>F(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}u();function bm(t){return{not:fe(t)}}u();function wm(t){return fe(t)}u();var vm=(t,e)=>F(t.innerType._def,e);var Im=(t,e,n)=>{switch(e){case A.ZodString:return La(t,n);case A.ZodNumber:return mm(t,n);case A.ZodObject:return fm(t,n);case A.ZodBigInt:return Xp(t,n);case A.ZodBoolean:return Qp();case A.ZodDate:return pl(t,n);case A.ZodUndefined:return bm(n);case A.ZodNull:return dm(n);case A.ZodArray:return Jp(t,n);case A.ZodUnion:case A.ZodDiscriminatedUnion:return hm(t,n);case A.ZodIntersection:return om(t,n);case A.ZodTuple:return Tm(t,n);case A.ZodRecord:return $a(t,n);case A.ZodLiteral:return am(t,n);case A.ZodEnum:return rm(t);case A.ZodNativeEnum:return cm(t);case A.ZodNullable:return pm(t,n);case A.ZodOptional:return _m(t,n);case A.ZodMap:return im(t,n);case A.ZodSet:return Em(t,n);case A.ZodLazy:return()=>t.getter()._def;case A.ZodPromise:return ym(t,n);case A.ZodNaN:case A.ZodNever:return lm(n);case A.ZodEffects:return nm(t,n);case A.ZodAny:return fe(n);case A.ZodUnknown:return wm(n);case A.ZodDefault:return tm(t,n);case A.ZodBranded:return ka(t,n);case A.ZodReadonly:return vm(t,n);case A.ZodCatch:return em(t,n);case A.ZodPipeline:return gm(t,n);case A.ZodFunction:case A.ZodVoid:case A.ZodSymbol:return;default:return(r=>{})(e)}};function F(t,e,n=!1){let r=e.seen.get(t);if(e.override){let i=e.override?.(t,e,r,n);if(i!==Hp)return i}if(r&&!n){let i=Ev(r,e);if(i!==void 0)return i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let a=Im(t,t.typeName,e),s=typeof a=="function"?F(a(),e):a;if(s&&Tv(t,e,s),e.postProcess){let i=e.postProcess(s,t,e);return o.jsonSchema=s,i}return o.jsonSchema=s,s}var Ev=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:xa(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},Tv=(t,e,n)=>(t.description&&(n.description=t.description,e.markdownDescription&&(n.markdownDescription=t.description)),n);u();u();var _l=(t,e)=>{let n=Kp(e),r=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[d,h])=>({...l,[d]:F(h._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0)??fe(n)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,a=F(t._def,o===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,o]},!1)??fe(n),s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(a.title=s),n.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:n.$refStrategy==="relative"?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let i=o===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,o].join("/"),[n.definitionPath]:{...r,[o]:a}};return n.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":(n.target==="jsonSchema2019-09"||n.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),n.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};function bv(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function gl(t,e){return Xe(t)?Uc(t,{target:bv(e?.target),io:e?.pipeStrategy??"input"}):_l(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function yl(t){let n=jt(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let r=la(n);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function El(t,e){let n=Ft(t,e);if(!n.success)throw n.error;return n.data}var wv=6e4,Ma=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(_a,n=>{this._oncancel(n)}),this.setNotificationHandler(ya,n=>{this._onprogress(n)}),this.setRequestHandler(ga,n=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ea,async(n,r)=>{let o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new x($.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(ba,async(n,r)=>{let o=async()=>{let a=n.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(a,r.sessionId);){if(i.type==="response"||i.type==="error"){let l=i.message,d=l.id,h=this._requestResolvers.get(d);if(h)if(this._requestResolvers.delete(d),i.type==="response")h(l);else{let p=l,g=new x(p.error.code,p.error.message,p.error.data);h(g)}else{let p=i.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${d}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(a,r.sessionId);if(!s)throw new x($.InvalidParams,`Task not found: ${a}`);if(!Zt(s.status))return await this._waitForTaskUpdate(a,r.signal),await o();if(Zt(s.status)){let i=await this._taskStore.getTaskResult(a,r.sessionId);return this._clearTaskQueue(a),{...i,_meta:{...i._meta,[Gt]:{taskId:a}}}}return await o()};return await o()}),this.setRequestHandler(wa,async(n,r)=>{try{let{tasks:o,nextCursor:a}=await this._taskStore.listTasks(n.params?.cursor,r.sessionId);return{tasks:o,nextCursor:a,_meta:{}}}catch(o){throw new x($.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Ia,async(n,r)=>{try{let o=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!o)throw new x($.InvalidParams,`Task not found: ${n.params.taskId}`);if(Zt(o.status))throw new x($.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(n.params.taskId);let a=await this._taskStore.getTask(n.params.taskId,r.sessionId);if(!a)throw new x($.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return{_meta:{},...a}}catch(o){throw o instanceof x?o:new x($.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,n,r,o,a=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,n),startTime:Date.now(),timeout:n,maxTotalTimeout:r,resetTimeoutOnProgress:a,onTimeout:o})}_resetTimeout(e){let n=this._timeoutInfo.get(e);if(!n)return!1;let r=Date.now()-n.startTime;if(n.maxTotalTimeout&&r>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),x.fromError($.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:r});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),!0}_cleanupTimeout(e){let n=this._timeoutInfo.get(e);n&&(clearTimeout(n.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 n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=a=>{r?.(a),this._onerror(a)};let o=this._transport?.onmessage;this._transport.onmessage=(a,s)=>{o?.(a,s),Br(a)||Mp(a)?this._onresponse(a):Xc(a)?this._onrequest(a,s):$p(a)?this._onnotification(a):this._onerror(new Error(`Unknown message type: ${JSON.stringify(a)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let n=x.fromError($.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(n)}_onerror(e){this.onerror?.(e)}_onnotification(e){let n=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,n){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,a=e.params?._meta?.[Gt]?.taskId;if(r===void 0){let h={jsonrpc:"2.0",id:e.id,error:{code:$.MethodNotFound,message:"Method not found"}};a&&this._taskMessageQueue?this._enqueueTaskMessage(a,{type:"error",message:h,timestamp:Date.now()},o?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):o?.send(h).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=xp(e.params)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,d={signal:s.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async h=>{if(s.signal.aborted)return;let p={relatedRequestId:e.id};a&&(p.relatedTask={taskId:a}),await this.notification(h,p)},sendRequest:async(h,p,g)=>{if(s.signal.aborted)throw new x($.ConnectionClosed,"Request was cancelled");let f={...g,relatedRequestId:e.id};a&&!f.relatedTask&&(f.relatedTask={taskId:a});let m=f.relatedTask?.taskId??a;return m&&l&&await l.updateTaskStatus(m,"input_required"),await this.request(h,p,f)},authInfo:n?.authInfo,requestId:e.id,requestInfo:n?.requestInfo,taskId:a,taskStore:l,taskRequestedTtl:i?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,d)).then(async h=>{if(s.signal.aborted)return;let p={result:h,jsonrpc:"2.0",id:e.id};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"response",message:p,timestamp:Date.now()},o?.sessionId):await o?.send(p)},async h=>{if(s.signal.aborted)return;let p={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(h.code)?h.code:$.InternalError,message:h.message??"Internal error",...h.data!==void 0&&{data:h.data}}};a&&this._taskMessageQueue?await this._enqueueTaskMessage(a,{type:"error",message:p,timestamp:Date.now()},o?.sessionId):await o?.send(p)}).catch(h=>this._onerror(new Error(`Failed to send response: ${h}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===s&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:n,...r}=e.params,o=Number(n),a=this._progressHandlers.get(o);if(!a){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(l){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(l);return}a(r)}_onresponse(e){let n=Number(e.id),r=this._requestResolvers.get(n);if(r){if(this._requestResolvers.delete(n),Br(e))r(e);else{let s=new x(e.error.code,e.error.message,e.error.data);r(s)}return}let o=this._responseHandlers.get(n);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let a=!1;if(Br(e)&&e.result&&typeof e.result=="object"){let s=e.result;if(s.task&&typeof s.task=="object"){let i=s.task;typeof i.taskId=="string"&&(a=!0,this._taskProgressTokens.set(i.taskId,n))}}if(a||this._progressHandlers.delete(n),Br(e))o(e);else{let s=x.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,n,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,n,r)}}catch(s){yield{type:"error",error:s instanceof x?s:new x($.InternalError,String(s))}}return}let a;try{let s=await this.request(e,tr,r);if(s.task)a=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new x($.InternalError,"Task creation did not return a task");for(;;){let i=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:i},Zt(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:a},n,r)}:i.status==="failed"?yield{type:"error",error:new x($.InternalError,`Task ${a} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new x($.InternalError,`Task ${a} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:a},n,r)};return}let l=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(d=>setTimeout(d,l)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof x?s:new x($.InternalError,String(s))}}}request(e,n,r){let{relatedRequestId:o,resumptionToken:a,onresumptiontoken:s,task:i,relatedTask:l}=r??{};return new Promise((d,h)=>{let p=I=>{h(I)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(I){p(I);return}r?.signal?.throwIfAborted();let g=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:g};r?.onprogress&&(this._progressHandlers.set(g,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}}),i&&(f.params={...f.params,task:i}),l&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Gt]:l}});let m=I=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(I)}},{relatedRequestId:o,resumptionToken:a,onresumptiontoken:s}).catch(D=>this._onerror(new Error(`Failed to send cancellation: ${D}`)));let S=I instanceof x?I:new x($.RequestTimeout,String(I));h(S)};this._responseHandlers.set(g,I=>{if(!r?.signal?.aborted){if(I instanceof Error)return h(I);try{let S=Ft(n,I.result);S.success?d(S.data):h(S.error)}catch(S){h(S)}}}),r?.signal?.addEventListener("abort",()=>{m(r?.signal?.reason)});let y=r?.timeout??wv,T=()=>m(x.fromError($.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(g,y,r?.maxTotalTimeout,T,r?.resetTimeoutOnProgress??!1);let w=l?.taskId;if(w){let I=S=>{let D=this._responseHandlers.get(g);D?D(S):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,I),this._enqueueTaskMessage(w,{type:"request",message:f,timestamp:Date.now()}).catch(S=>{this._cleanupTimeout(g),h(S)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:a,onresumptiontoken:s}).catch(I=>{this._cleanupTimeout(g),h(I)})})}async getTask(e,n){return this.request({method:"tasks/get",params:e},Ta,n)}async getTaskResult(e,n,r){return this.request({method:"tasks/result",params:e},n,r)}async listTasks(e,n){return this.request({method:"tasks/list",params:e},va,n)}async cancelTask(e,n){return this.request({method:"tasks/cancel",params:e},Up,n)}async notification(e,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let r=n?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Gt]:n.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!n?.relatedRequestId&&!n?.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 i={...e,jsonrpc:"2.0"};n?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Gt]:n.relatedTask}}}),this._transport?.send(i,n).catch(l=>this._onerror(l))});return}let s={...e,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Gt]:n.relatedTask}}}),await this._transport.send(s,n)}setRequestHandler(e,n){let r=yl(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,a)=>{let s=El(e,o);return Promise.resolve(n(s,a))})}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,n){let r=yl(e);this._notificationHandlers.set(r,o=>{let a=El(e,o);return Promise.resolve(n(a))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let n=this._taskProgressTokens.get(e);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,n,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,n,r,o)}async _clearTaskQueue(e,n){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,n);for(let o of r)if(o.type==="request"&&Xc(o.message)){let a=o.message.id,s=this._requestResolvers.get(a);s?(s(new x($.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(a)):this._onerror(new Error(`Resolver missing for request ${a} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,n){let r=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(r=o.pollInterval)}catch{}return new Promise((o,a)=>{if(n.aborted){a(new x($.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,r);n.addEventListener("abort",()=>{clearTimeout(s),a(new x($.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,n){let r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},n)},getTask:async o=>{let a=await r.getTask(o,n);if(!a)throw new x($.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(o,a,s)=>{await r.storeTaskResult(o,a,s,n);let i=await r.getTask(o,n);if(i){let l=Yr.parse({method:"notifications/tasks/status",params:i});await this.notification(l),Zt(i.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>r.getTaskResult(o,n),updateTaskStatus:async(o,a,s)=>{let i=await r.getTask(o,n);if(!i)throw new x($.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Zt(i.status))throw new x($.InvalidParams,`Cannot update task "${o}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,a,s,n);let l=await r.getTask(o,n);if(l){let d=Yr.parse({method:"notifications/tasks/status",params:l});await this.notification(d),Zt(l.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>r.listTasks(o,n)}}};function Am(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Sm(t,e){let n={...t};for(let r in e){let o=r,a=e[o];if(a===void 0)continue;let s=n[o];Am(s)&&Am(a)?n[o]={...s,...a}:n[o]=a}return n}u();var yg=Au(au(),1),Eg=Au(gg(),1);function AP(){let t=new yg.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Eg.default)(t),t}var ys=class{constructor(e){this._ajv=e??AP()}getValidator(e){let n="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return r=>n(r)?{valid:!0,data:r,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};u();var Es=class{constructor(e){this._server=e}requestStream(e,n,r){return this._server.requestStream(e,n,r)}createMessageStream(e,n){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.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],a=Array.isArray(o.content)?o.content:[o.content],s=a.some(h=>h.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,l=i?Array.isArray(i.content)?i.content:[i.content]:[],d=l.some(h=>h.type==="tool_use");if(s){if(a.some(h=>h.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!d)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(d){let h=new Set(l.filter(g=>g.type==="tool_use").map(g=>g.id)),p=new Set(a.filter(g=>g.type==="tool_result").map(g=>g.toolUseId));if(h.size!==p.size||![...h].every(g=>p.has(g)))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},Xr,n)}elicitInputStream(e,n){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let a=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:a},or,n)}async getTask(e,n){return this._server.getTask({taskId:e},n)}async getTaskResult(e,n,r){return this._server.getTaskResult({taskId:e},n,r)}async listTasks(e,n){return this._server.listTasks(e?{cursor:e}:void 0,n)}async cancelTask(e,n){return this._server.cancelTask({taskId:e},n)}};u();function Tg(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${n} does not support task creation for tools/call (required for ${e})`);break;default:break}}function bg(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${n} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Ts=class extends Ma{constructor(e,n){super(n),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Jr.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let a=this._loggingLevels.get(o);return a?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new ys,this.setRequestHandler(tl,r=>this._oninitialize(r)),this.setNotificationHandler(nl,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(ll,async(r,o)=>{let a=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Jr.safeParse(s);return i.success&&this._loggingLevels.set(a,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Es(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Sm(this._capabilities,e)}setRequestHandler(e,n){let o=jt(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let a;if(Xe(o)){let i=o;a=i._zod?.def?.value??i.value}else{let i=o;a=i._def?.value??i.value}if(typeof a!="string")throw new Error("Schema method literal must be a string");if(a==="tools/call"){let i=async(l,d)=>{let h=Ft(rr,l);if(!h.success){let m=h.error instanceof Error?h.error.message:String(h.error);throw new x($.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:p}=h.data,g=await Promise.resolve(n(l,d));if(p.task){let m=Ft(tr,g);if(!m.success){let y=m.error instanceof Error?m.error.message:String(m.error);throw new x($.InvalidParams,`Invalid task creation result: ${y}`)}return m.data}let f=Ft(Da,g);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new x($.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,n)}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){bg(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Tg(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let n=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Cp.includes(n)?n:Kc,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"},fa)}async createMessage(e,n){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 r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],a=o.some(d=>d.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],l=i.some(d=>d.type==="tool_use");if(a){if(o.some(d=>d.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(i.filter(p=>p.type==="tool_use").map(p=>p.id)),h=new Set(o.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(d.size!==h.size||![...d].every(p=>h.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},dl,n):this.request({method:"sampling/createMessage",params:e},Xr,n)}async elicitInput(e,n){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},or,n)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:o},or,n);if(a.action==="accept"&&a.content&&o.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(o.requestedSchema)(a.content);if(!i.valid)throw new x($.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){throw s instanceof x?s:new x($.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return a}}}createElicitationCompletionNotifier(e,n){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}},n)}async listRoots(e,n){return this.request({method:"roots/list",params:e},ul,n)}async sendLoggingMessage(e,n){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,n))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"})}};u();var vg=Symbol.for("mcp.completable");function pu(t){return!!t&&typeof t=="object"&&vg in t}function Ig(t){return t[vg]?.complete}var wg;(function(t){t.Completable="McpCompletable"})(wg||(wg={}));u();var bs=class t{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,n,r){if(e.length>n)throw new Error(`${r} exceeds maximum length of ${n} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){t.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let n=[],r="",o=0,a=0;for(;o<e.length;)if(e[o]==="{"){r&&(n.push(r),r="");let s=e.indexOf("}",o);if(s===-1)throw new Error("Unclosed template expression");if(a++,a>1e4)throw new Error("Template contains too many expressions (max 10000)");let i=e.slice(o+1,s),l=this.getOperator(i),d=i.includes("*"),h=this.getNames(i),p=h[0];for(let g of h)t.validateLength(g,1e6,"Variable name");n.push({name:p,operator:l,names:h,exploded:d}),o=s+1}else r+=e[o],o++;return r&&n.push(r),n}getOperator(e){return["+","#",".","/","?","&"].find(r=>e.startsWith(r))||""}getNames(e){let n=this.getOperator(e);return e.slice(n.length).split(",").map(r=>r.replace("*","").trim()).filter(r=>r.length>0)}encodeValue(e,n){return t.validateLength(e,1e6,"Variable value"),n==="+"||n==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,n){if(e.operator==="?"||e.operator==="&"){let s=e.names.map(l=>{let d=n[l];if(d===void 0)return"";let h=Array.isArray(d)?d.map(p=>this.encodeValue(p,e.operator)).join(","):this.encodeValue(d.toString(),e.operator);return`${l}=${h}`}).filter(l=>l.length>0);return s.length===0?"":(e.operator==="?"?"?":"&")+s.join("&")}if(e.names.length>1){let s=e.names.map(i=>n[i]).filter(i=>i!==void 0);return s.length===0?"":s.map(i=>Array.isArray(i)?i[0]:i).join(",")}let r=n[e.name];if(r===void 0)return"";let a=(Array.isArray(r)?r:[r]).map(s=>this.encodeValue(s,e.operator));switch(e.operator){case"":return a.join(",");case"+":return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/");default:return a.join(",")}}expand(e){let n="",r=!1;for(let o of this.parts){if(typeof o=="string"){n+=o;continue}let a=this.expandPart(o,e);a&&((o.operator==="?"||o.operator==="&")&&r?n+=a.replace("?","&"):n+=a,(o.operator==="?"||o.operator==="&")&&(r=!0))}return n}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let n=[];for(let a of e.names)t.validateLength(a,1e6,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let a=0;a<e.names.length;a++){let s=e.names[a],i=a===0?"\\"+e.operator:"&";n.push({pattern:i+this.escapeRegExp(s)+"=([^&]+)",name:s})}return n}let r,o=e.name;switch(e.operator){case"":r=e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":r="(.+)";break;case".":r="\\.([^/,]+)";break;case"/":r="/"+(e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:r="([^/]+)"}return n.push({pattern:r,name:o}),n}match(e){t.validateLength(e,1e6,"URI");let n="^",r=[];for(let i of this.parts)if(typeof i=="string")n+=this.escapeRegExp(i);else{let l=this.partToRegExp(i);for(let{pattern:d,name:h}of l)n+=d,r.push({name:h,exploded:i.exploded})}n+="$",t.validateLength(n,1e6,"Generated regex pattern");let o=new RegExp(n),a=e.match(o);if(!a)return null;let s={};for(let i=0;i<r.length;i++){let{name:l,exploded:d}=r[i],h=a[i+1],p=l.replace("*","");d&&h.includes(",")?s[p]=h.split(","):s[p]=h}return s}};u();var SP=/^[A-Za-z0-9._-]{1,128}$/;function OP(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!SP.test(t)){let n=t.split("").filter(r=>!/[A-Za-z0-9._-]/.test(r)).filter((r,o,a)=>a.indexOf(r)===o);return e.push(`Tool name contains invalid characters: ${n.map(r=>`"${r}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function NP(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let n of e)console.warn(` - ${n}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function mu(t){let e=OP(t);return NP(t,e.warnings),e.isValid}u();var ws=class{constructor(e){this._mcpServer=e}registerToolTask(e,n,r){let o={taskSupport:"required",...n.execution};if(o.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,n.title,n.description,n.inputSchema,n.outputSchema,n.annotations,o,n._meta,r)}};u();var Ag=class{constructor(e,n){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Ts(e,n)}get experimental(){return this._experimental||(this._experimental={tasks:new ws(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Xt(Ca)),this.server.assertCanSetRequestHandler(Xt(rr)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Ca,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,n])=>{let r={name:e,title:n.title,description:n.description,inputSchema:(()=>{let o=Qn(n.inputSchema);return o?gl(o,{strictUnions:!0,pipeStrategy:"input"}):PP})(),annotations:n.annotations,execution:n.execution,_meta:n._meta};if(n.outputSchema){let o=Qn(n.outputSchema);o&&(r.outputSchema=gl(o,{strictUnions:!0,pipeStrategy:"output"}))}return r})})),this.server.setRequestHandler(rr,async(e,n)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new x($.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new x($.InvalidParams,`Tool ${e.params.name} disabled`);let o=!!e.params.task,a=r.execution?.taskSupport,s="createTask"in r.handler;if((a==="required"||a==="optional")&&!s)throw new x($.InternalError,`Tool ${e.params.name} has taskSupport '${a}' but was not registered with registerToolTask`);if(a==="required"&&!o)throw new x($.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(a==="optional"&&!o&&s)return await this.handleAutomaticTaskPolling(r,e,n);let i=await this.validateToolInput(r,e.params.arguments,e.params.name),l=await this.executeToolHandler(r,i,n);return o||await this.validateToolOutput(r,l,e.params.name),l}catch(r){if(r instanceof x&&r.code===$.UrlElicitationRequired)throw r;return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,n,r){if(!e.inputSchema)return;let a=Qn(e.inputSchema)??e.inputSchema,s=await ia(a,n);if(!s.success){let i="error"in s?s.error:"Unknown error",l=ca(i);throw new x($.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${l}`)}return s.data}async validateToolOutput(e,n,r){if(!e.outputSchema||!("content"in n)||n.isError)return;if(!n.structuredContent)throw new x($.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=Qn(e.outputSchema),a=await ia(o,n.structuredContent);if(!a.success){let s="error"in a?a.error:"Unknown error",i=ca(s);throw new x($.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${i}`)}}async executeToolHandler(e,n,r){let o=e.handler;if("createTask"in o){if(!r.taskStore)throw new Error("No task store provided.");let s={...r,taskStore:r.taskStore};if(e.inputSchema){let i=o;return await Promise.resolve(i.createTask(n,s))}else{let i=o;return await Promise.resolve(i.createTask(s))}}if(e.inputSchema){let s=o;return await Promise.resolve(s(n,r))}else{let s=o;return await Promise.resolve(s(r))}}async handleAutomaticTaskPolling(e,n,r){if(!r.taskStore)throw new Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(e,n.params.arguments,n.params.name),a=e.handler,s={...r,taskStore:r.taskStore},i=o?await Promise.resolve(a.createTask(o,s)):await Promise.resolve(a.createTask(s)),l=i.task.taskId,d=i.task,h=d.pollInterval??5e3;for(;d.status!=="completed"&&d.status!=="failed"&&d.status!=="cancelled";){await new Promise(g=>setTimeout(g,h));let p=await r.taskStore.getTask(l);if(!p)throw new x($.InternalError,`Task ${l} not found during polling`);d=p}return await r.taskStore.getTaskResult(l)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Xt(Ra)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ra,async e=>{switch(e.params.ref.type){case"ref/prompt":return qp(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Vp(e),this.handleResourceCompletion(e,e.params.ref);default:throw new x($.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,n){let r=this._registeredPrompts[n.name];if(!r)throw new x($.InvalidParams,`Prompt ${n.name} not found`);if(!r.enabled)throw new x($.InvalidParams,`Prompt ${n.name} disabled`);if(!r.argsSchema)return Co;let a=jt(r.argsSchema)?.[e.params.argument.name];if(!pu(a))return Co;let s=Ig(a);if(!s)return Co;let i=await s(e.params.argument.value,e.params.context);return Ng(i)}async handleResourceCompletion(e,n){let r=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===n.uri);if(!r){if(this._registeredResources[n.uri])return Co;throw new x($.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return Co;let a=await o(e.params.argument.value,e.params.context);return Ng(a)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Xt(Aa)),this.server.assertCanSetRequestHandler(Xt(Sa)),this.server.assertCanSetRequestHandler(Xt(Oa)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Aa,async(e,n)=>{let r=Object.entries(this._registeredResources).filter(([a,s])=>s.enabled).map(([a,s])=>({uri:a,name:s.name,...s.metadata})),o=[];for(let a of Object.values(this._registeredResourceTemplates)){if(!a.resourceTemplate.listCallback)continue;let s=await a.resourceTemplate.listCallback(n);for(let i of s.resources)o.push({...a.metadata,...i})}return{resources:[...r,...o]}}),this.server.setRequestHandler(Sa,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([n,r])=>({name:n,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(Oa,async(e,n)=>{let r=new URL(e.params.uri),o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new x($.InvalidParams,`Resource ${r} disabled`);return o.readCallback(r,n)}for(let a of Object.values(this._registeredResourceTemplates)){let s=a.resourceTemplate.uriTemplate.match(r.toString());if(s)return a.readCallback(r,s,n)}throw new x($.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Xt(Na)),this.server.assertCanSetRequestHandler(Xt(Pa)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Na,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,n])=>({name:e,title:n.title,description:n.description,arguments:n.argsSchema?CP(n.argsSchema):void 0}))})),this.server.setRequestHandler(Pa,async(e,n)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new x($.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new x($.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let o=Qn(r.argsSchema),a=await ia(o,e.params.arguments);if(!a.success){let l="error"in a?a.error:"Unknown error",d=ca(l);throw new x($.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${d}`)}let s=a.data,i=r.callback;return await Promise.resolve(i(s,n))}else{let o=r.callback;return await Promise.resolve(o(n))}}),this._promptHandlersInitialized=!0)}resource(e,n,...r){let o;typeof r[0]=="object"&&(o=r.shift());let a=r[0];if(typeof n=="string"){if(this._registeredResources[n])throw new Error(`Resource ${n} is already registered`);let s=this._createRegisteredResource(e,void 0,n,o,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,n,o,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,n,r,o){if(typeof n=="string"){if(this._registeredResources[n])throw new Error(`Resource ${n} is already registered`);let a=this._createRegisteredResource(e,r.title,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let a=this._createRegisteredResourceTemplate(e,r.title,n,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,n,r,o,a){let s={name:e,title:n,metadata:o,readCallback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:i=>{typeof i.uri<"u"&&i.uri!==r&&(delete this._registeredResources[r],i.uri&&(this._registeredResources[i.uri]=s)),typeof i.name<"u"&&(s.name=i.name),typeof i.title<"u"&&(s.title=i.title),typeof i.metadata<"u"&&(s.metadata=i.metadata),typeof i.callback<"u"&&(s.readCallback=i.callback),typeof i.enabled<"u"&&(s.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,n,r,o,a){let s={resourceTemplate:r,title:n,metadata:o,readCallback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(delete this._registeredResourceTemplates[e],d.name&&(this._registeredResourceTemplates[d.name]=s)),typeof d.title<"u"&&(s.title=d.title),typeof d.template<"u"&&(s.resourceTemplate=d.template),typeof d.metadata<"u"&&(s.metadata=d.metadata),typeof d.callback<"u"&&(s.readCallback=d.callback),typeof d.enabled<"u"&&(s.enabled=d.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;return Array.isArray(i)&&i.some(d=>!!r.completeCallback(d))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,n,r,o,a){let s={title:n,description:r,argsSchema:o===void 0?void 0:vn(o),callback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredPrompts[e],i.name&&(this._registeredPrompts[i.name]=s)),typeof i.title<"u"&&(s.title=i.title),typeof i.description<"u"&&(s.description=i.description),typeof i.argsSchema<"u"&&(s.argsSchema=vn(i.argsSchema)),typeof i.callback<"u"&&(s.callback=i.callback),typeof i.enabled<"u"&&(s.enabled=i.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=s,o&&Object.values(o).some(l=>{let d=l instanceof Ue?l._def?.innerType:l;return pu(d)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(e,n,r,o,a,s,i,l,d){mu(e);let h={title:n,description:r,inputSchema:Og(o),outputSchema:Og(a),annotations:s,execution:i,_meta:l,handler:d,enabled:!0,disable:()=>h.update({enabled:!1}),enable:()=>h.update({enabled:!0}),remove:()=>h.update({name:null}),update:p=>{typeof p.name<"u"&&p.name!==e&&(typeof p.name=="string"&&mu(p.name),delete this._registeredTools[e],p.name&&(this._registeredTools[p.name]=h)),typeof p.title<"u"&&(h.title=p.title),typeof p.description<"u"&&(h.description=p.description),typeof p.paramsSchema<"u"&&(h.inputSchema=vn(p.paramsSchema)),typeof p.outputSchema<"u"&&(h.outputSchema=vn(p.outputSchema)),typeof p.callback<"u"&&(h.handler=p.callback),typeof p.annotations<"u"&&(h.annotations=p.annotations),typeof p._meta<"u"&&(h._meta=p._meta),typeof p.enabled<"u"&&(h.enabled=p.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=h,this.setToolRequestHandlers(),this.sendToolListChanged(),h}tool(e,...n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let r,o,a,s;if(typeof n[0]=="string"&&(r=n.shift()),n.length>1){let l=n[0];if(fu(l))o=n.shift(),n.length>1&&typeof n[0]=="object"&&n[0]!==null&&!fu(n[0])&&(s=n.shift());else if(typeof l=="object"&&l!==null){if(Object.values(l).some(d=>typeof d=="object"&&d!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=n.shift()}}let i=n[0];return this._createRegisteredTool(e,void 0,r,o,a,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,n,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:a,inputSchema:s,outputSchema:i,annotations:l,_meta:d}=n;return this._createRegisteredTool(e,o,a,s,i,l,{taskSupport:"forbidden"},d,r)}prompt(e,...n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let r;typeof n[0]=="string"&&(r=n.shift());let o;n.length>1&&(o=n.shift());let a=n[0],s=this._createRegisteredPrompt(e,void 0,r,o,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,n,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:a,argsSchema:s}=n,i=this._createRegisteredPrompt(e,o,a,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,n){return this.server.sendLoggingMessage(e,n)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},Sg=class{constructor(e,n){this._callbacks=n,this._uriTemplate=typeof e=="string"?new bs(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}},PP={type:"object",properties:{}};function Pg(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function Cg(t){return"_def"in t||"_zod"in t||Pg(t)}function fu(t){return typeof t!="object"||t===null||Cg(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(Pg)}function Og(t){if(t){if(fu(t))return vn(t);if(!Cg(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function CP(t){let e=jt(t);return e?Object.entries(e).map(([n,r])=>{let o=sp(r),a=ip(r);return{name:n,description:o,required:!a}}):[]}function Xt(t){let n=jt(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let r=la(n);if(typeof r=="string")return r;throw new Error("Schema method literal must be a string")}function Ng(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var Co={completion:{values:[],hasMore:!1}};u();u();u();u();u();import{readFileSync as UP}from"node:fs";import{dirname as FP,join as jP}from"node:path";import{fileURLToPath as GP}from"node:url";u();var be,Do=null;function vs(){return(Do===null||Do.byteLength===0)&&(Do=new Uint8Array(be.memory.buffer)),Do}var Is=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Is.decode();var DP=2146435072,_u=0;function RP(t,e){return _u+=e,_u>=DP&&(Is=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}},Is.decode(),_u=e),Is.decode(vs().subarray(t,t+e))}function gu(t,e){return t=t>>>0,RP(t,e)}function yu(t){let e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){let o=t.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){let o=t.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(t)){let o=t.length,a="[";o>0&&(a+=yu(t[0]));for(let s=1;s<o;s++)a+=", "+yu(t[s]);return a+="]",a}let n=/\[object ([^\]]+)\]/.exec(toString.call(t)),r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}
43
+ ${t.stack}`:r}var Ss=0,As=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},xP=typeof As.encodeInto=="function"?function(t,e){return As.encodeInto(t,e)}:function(t,e){let n=As.encode(t);return e.set(n),{read:t.length,written:n.length}};function Dg(t,e,n){if(n===void 0){let i=As.encode(t),l=e(i.length,1)>>>0;return vs().subarray(l,l+i.length).set(i),Ss=i.length,l}let r=t.length,o=e(r,1)>>>0,a=vs(),s=0;for(;s<r;s++){let i=t.charCodeAt(s);if(i>127)break;a[o+s]=i}if(s!==r){s!==0&&(t=t.slice(s)),o=n(o,r,r=s+t.length*3,1)>>>0;let i=vs().subarray(o+s,o+r),l=xP(t,i);s+=l.written,o=n(o,r,s,1)>>>0}return Ss=s,o}var Ln=null;function Eu(){return(Ln===null||Ln.buffer.detached===!0||Ln.buffer.detached===void 0&&Ln.buffer!==be.memory.buffer)&&(Ln=new DataView(be.memory.buffer)),Ln}function kP(t){return t==null}function LP(t,e){t=t>>>0;let n=Eu(),r=[];for(let o=t;o<t+4*e;o+=4)r.push(be.__wbindgen_export_2.get(n.getUint32(o,!0)));return be.__externref_drop_slice(t,e),r}function Rg(t,e){let n=Dg(t,be.__wbindgen_malloc,be.__wbindgen_realloc),r=Ss,o=be.cut(n,r,kP(e)?16777215:e?1:0);var a=LP(o[0],o[1]).slice();return be.__wbindgen_free(o[0],o[1]*4,4),a}var $P=new Set(["basic","cors","default"]);async function MP(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.ok&&$P.has(t.type)&&t.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}let n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{let n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function xg(){let t={};return t.wbg={},t.wbg.__wbg_Error_0497d5bdba9362e5=function(e,n){return Error(gu(e,n))},t.wbg.__wbg_new_07b483f72211fd66=function(){return new Object},t.wbg.__wbg_set_3f1d0b984ed272ed=function(e,n,r){e[n]=r},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_debug_string=function(e,n){let r=yu(n),o=Dg(r,be.__wbindgen_malloc,be.__wbindgen_realloc),a=Ss;Eu().setInt32(e+4,a,!0),Eu().setInt32(e+0,o,!0)},t.wbg.__wbindgen_init_externref_table=function(){let e=be.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t.wbg.__wbindgen_number_new=function(e){return e},t.wbg.__wbindgen_string_new=function(e,n){return gu(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(gu(e,n))},t}function kg(t,e){return be=t.exports,zP.__wbindgen_wasm_module=e,Ln=null,Do=null,be.__wbindgen_start(),be}function Lg(t){if(be!==void 0)return be;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let e=xg();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));let n=new WebAssembly.Instance(t,e);return kg(n,t)}async function zP(t){if(be!==void 0)return be;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL("jieba_rs_wasm_bg.wasm",import.meta.url));let e=xg();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));let{instance:n,module:r}=await MP(await t,e);return kg(n,r)}var $g=!1,Mg=(t,e)=>{if(!$g){let n=jP(FP(GP(import.meta.url)),"jieba-engine.wasm");Lg({module:UP(n)}),$g=!0}return Rg(t,e)};var ZP=new Set(["a","an","and","are","as","at","be","but","by","for","if","in","into","is","it","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"]),BP=/[a-z0-9]+/g,qP=t=>{let e=t.toLowerCase().replace(/'s\b/g,""),n=[];for(let r of e.matchAll(BP)){let o=r[0];ZP.has(o)||n.push(HP(o))}return n},VP=/[㐀-鿿豈-﫿぀-ヿ가-힯]|[a-z0-9]/i,WP=t=>Mg(t.toLowerCase(),!0).filter(e=>VP.test(e)),bu=t=>{switch(Fn){case"ZION":return WP(t);case"MOMEN":return qP(t);default:throw new Error(`[analyzer] unknown PRODUCT '${Fn}'`)}},$n=(t,e)=>{let n=t[e];return n==="a"||n==="e"||n==="i"||n==="o"||n==="u"?!1:n==="y"?e===0?!0:!$n(t,e-1):!0},Qt=t=>{let e=0,n=!1;for(let r=0;r<t.length;r+=1){let o=!$n(t,r);n&&!o&&(e+=1),n=o}return e},Tu=t=>{for(let e=0;e<t.length;e+=1)if(!$n(t,e))return!0;return!1},zg=t=>{let e=t.length;return e>=2&&t[e-1]===t[e-2]&&$n(t,e-1)},Ug=t=>{let e=t.length;if(e<3||!$n(t,e-1)||$n(t,e-2)||!$n(t,e-3))return!1;let n=t[e-1];return n!=="w"&&n!=="x"&&n!=="y"},Os=(t,e,n)=>t.slice(0,t.length-e.length)+n;function HP(t){let e=t;if(e.length<=2)return e;e.endsWith("sses")?e=Os(e,"sses","ss"):e.endsWith("ies")?e=Os(e,"ies","i"):e.endsWith("ss")||e.endsWith("s")&&(e=e.slice(0,-1));let n=!1;e.endsWith("eed")?Qt(e.slice(0,-3))>0&&(e=e.slice(0,-1)):e.endsWith("ed")&&Tu(e.slice(0,-2))?(e=e.slice(0,-2),n=!0):e.endsWith("ing")&&Tu(e.slice(0,-3))&&(e=e.slice(0,-3),n=!0),n&&(e.endsWith("at")||e.endsWith("bl")||e.endsWith("iz")?e+="e":zg(e)&&!/[lsz]$/.test(e)?e=e.slice(0,-1):Qt(e)===1&&Ug(e)&&(e+="e")),e.endsWith("y")&&Tu(e.slice(0,-1))&&(e=`${e.slice(0,-1)}i`);let r=[["ational","ate"],["tional","tion"],["enci","ence"],["anci","ance"],["izer","ize"],["bli","ble"],["alli","al"],["entli","ent"],["eli","e"],["ousli","ous"],["ization","ize"],["ation","ate"],["ator","ate"],["alism","al"],["iveness","ive"],["fulness","ful"],["ousness","ous"],["aliti","al"],["iviti","ive"],["biliti","ble"],["logi","log"]];for(let[i,l]of r)if(e.endsWith(i)){Qt(e.slice(0,e.length-i.length))>0&&(e=Os(e,i,l));break}let o=[["icate","ic"],["ative",""],["alize","al"],["iciti","ic"],["ical","ic"],["ful",""],["ness",""]];for(let[i,l]of o)if(e.endsWith(i)){Qt(e.slice(0,e.length-i.length))>0&&(e=Os(e,i,l));break}let a=["al","ance","ence","er","ic","able","ible","ant","ement","ment","ent","ou","ism","ate","iti","ous","ive","ize"],s=!1;for(let i of a)if(e.endsWith(i)){let l=e.slice(0,e.length-i.length);Qt(l)>1&&(e=l),s=!0;break}if(!s&&e.endsWith("ion")){let i=e.slice(0,-3);Qt(i)>1&&/[st]$/.test(i)&&(e=i)}if(e.endsWith("e")){let i=e.slice(0,-1),l=Qt(i);(l>1||l===1&&!Ug(i))&&(e=i)}return Qt(e)>1&&zg(e)&&e.endsWith("l")&&(e=e.slice(0,-1)),e}u();var Fg=1.5,jg=.75,YP=t=>{let e=[],n=new Map,r=0;for(let{ref:o,tokens:a}of t){let s=new Map;for(let i of a)s.set(i,(s.get(i)??0)+1);for(let i of s.keys())n.set(i,(n.get(i)??0)+1);e.push({ref:o,tf:s,length:a.length}),r+=a.length}return{docs:e,df:n,avgdl:e.length>0?r/e.length:0}},KP=(t,e)=>{let n=[...new Set(bu(e))],r=t.docs.length;return n.length===0||r===0?[]:t.docs.map(o=>{let a=0;for(let s of n){let i=o.tf.get(s);if(!i)continue;let l=t.df.get(s)??0,d=Math.log(1+(r-l+.5)/(l+.5)),h=i+Fg*(1-jg+jg*o.length/(t.avgdl||1));a+=d*(i*(Fg+1)/h)}return{ref:o.ref,score:a}})};u();var vr={actionflow:"## Actionflow Domain Knowledge\nActionflows are server-side workflows for business logic. They run entirely on the server; the frontend triggers them via \"Request \u2013 Actionflow\" component actions.\n\n### When to Use an Actionflow\nDo not create an Actionflow merely to proxy CRUD. Simple single-table CRUD should run directly from the frontend when table, column, and row permissions fully express the authorization policy. Reserve Actionflows for genuinely server-side, multi-step, transactional, or orchestrated operations: cross-table atomicity, trusted calculations or secrets, loops, AI steps, third-party calls, schedules, webhooks, and database triggers. If data permissions cannot express the authorization rule, enforce it server-side here. A condition on its own is not a reason to build a flow: a check that only decides what the UI does belongs in the frontend, and only a condition that must be guaranteed rather than merely evaluated has to run here, where the client cannot bypass it. That includes authorization checks \u2014 if the rule is already expressed in table, column, and row permissions, the frontend may hold the condition, because permissions are enforced on every request and nothing the client sends can bypass them. Wrapping such a check in a flow adds a hop and a second place for the rule to drift, without making it any harder to circumvent.\n\n### Execution Modes\nSynchronous: all nodes in one synchronous Actionflow invocation execute inside a single database transaction; the caller blocks for the result, and any node error rolls back every DB write from that invocation. Asynchronous: the caller gets a task handle instead of blocking and retrieves the result later \u2014 the flow still computes and returns its declared output; only the failing node's DB writes roll back; required for AI agents and video generation.\n\nEvery flow has a `timeout` in seconds for the whole run, not per node: 30 s by default for a synchronous flow and 120 s for an asynchronous one, whose clock stops while a Delay node waits but keeps running through AI waits. Set it on ADD_ACTION_FLOWS or UPDATE_ACTION_FLOW: at least 1, and at most 60 while the flow is synchronous \u2014 a job that needs longer belongs in an asynchronous flow. GET_ALL_ACTION_FLOWS_INFO and GET_ACTION_FLOW_DETAIL report the timeout in force, default included. When it runs out the flow is cut off inside whatever node is running (a query, custom code, an API call) and fails with a timeout error; a synchronous flow's DB writes roll back. Switching a flow whose timeout is above 60 s to synchronous is refused unless the same UPDATE_ACTION_FLOW call lowers `timeout`.\n\n### Triggers\nWhat fires a flow. Four kinds: Manual (a UI action \u2014 no config), scheduled (cron), database-change event, and webhook. Scheduled and database-change triggers are tool-managed: inspect with `GET_ALL_SCHEDULED_TRIGGERS_INFO` / `GET_ALL_DB_TRIGGERS_INFO`, create with `ADD_SCHEDULED_TRIGGERS` (a Quartz cron \u2014 set a future `endInstant` or it never fires) and `ADD_DB_TRIGGERS` (a table + INSERT/UPDATE/DELETE), each pointing at a flow id from `GET_ALL_ACTION_FLOWS_INFO` (update/delete variants too). Manual triggers need no setup; webhook triggers are managed by the separate `webhook` plugin (`ADD_CALLBACK_TRIGGERS`) \u2014 load it to add or edit an incoming HTTP webhook that fires a flow.\n\n### Node Types\nWhat can be added at a position is the add-node menu there: read it with BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS at that same `afterNodeId` and pass that entry's `node` to ADD_ACTION_FLOW_NODE \u2014 the entry already carries every default for that position, and its config fields are yours to override; its `type` and `templateCodeId` name the menu entry, so never assemble those yourself, and an entry disabled there is refused with the same reason. The menu also carries the deployment's **preset integration nodes** (the `TEMPLATE_CODE` entries \u2014 the current user's ID / WeChat OpenID / Access Token, file/media conversion to Zion native types, SMS, and video/AI generation), whose set varies by deployment. There is no built-in `CURRENT_USER` / `FILES` / `SMS` node type; do not pass those to `ADD_ACTION_FLOW_NODE`.\n\n### AI Conversation Nodes\nAI conversation nodes are valid only in asynchronous Actionflows.\n\n`AI_CREATE_CONVERSATION` creates a new conversation and runs its first turn. Bind the Agent's declared inputs; Start has no free-form message field because the first user message comes from the Agent's configured prompt. When the node completes, `id` is the conversation ID and `data` is the Agent result. For plain output, `data` is text; for structured output, it has the Agent's declared output type. `id` and `data` are the stable fields. Inspect the node's data-binding options for feature-dependent reasoning and media outputs.\n\n`AI_SEND_MESSAGE` continues an existing conversation. Continue returns the same `id` and `data` shape as Start. Bind `conversationId` to the `id` returned by Start, then bind the new message. Continue uses the Agent configuration stored by Start; selecting another Agent on Continue does not switch the conversation. Use the same `configId` as Start so validation and output typing remain correct.\n\n`AI_STOP_RESPONSE` cancels only the response currently being generated. It preserves the conversation, which may later be continued. `AI_DELETE_CONVERSATION` permanently deletes the conversation and its messages. Stop and Delete have no node output.\n\nUse the target node's data-binding options to select the preceding Start or Continue node's `id`; the event's `taskId` is not a conversation ID.\n\nStart and Continue are wait points: the Actionflow does not proceed to the next node until the AI response finishes. A Stop node placed after Start or Continue therefore cannot stop that response.\n\n**Current runtime limitation:** There is currently no safe cancellation path for a response launched by an Actionflow. Do not use Stop for a response launched by an Actionflow. Stop acts only while the stored status is `IN_PROGRESS`; once it is `STREAMING`, Stop does not cancel the response. If Stop reaches an in-progress response, canceling leaves the AI child task processing, so the source Actionflow never resumes.\n\n### Choosing How to Express Logic: nodes \u2192 formulas \u2192 code\nThree tiers, in order of preference:\n1. **Visual nodes** for orchestration \u2014 query / branch / iterate / write / call (Database, Condition, Loop, Set Variable, Call API, Run Actionflow). They take part in the flow's transaction, surface individually in logs and the edit-time error collector, and stay user-editable.\n2. **Formula bindings** for value-level computation. A node value \u2014 a Set Variable value, a mutation column, a condition predicate \u2014 can be a FORMULA binding built with the bindings plugin, and formulas cover far more than people expect: text and regex (extract / match / replace, substring, split, concat), math, date/time arithmetic and formatting, array aggregation / mapping / filtering, JSON value access, and type casts. Prefer a formula over code whenever you are computing a single value.\n3. **Run Code** only for genuinely procedural logic that neither a node nor a formula operator expresses \u2014 e.g. cryptographic hashing / signature building, multi-step algorithms with intermediate state, or assembling / parsing a complex nested payload. Keep it small and fed by node inputs; never collapse a whole flow into one Run Code node.\n\n### Variables\nDeclared at flow level, accessible by all nodes, assigned with \"Set Variable\" node.\n\n### Inputs & Outputs\nInspect a flow first with `GET_ALL_ACTION_FLOWS_INFO` / `GET_ACTION_FLOW_DETAIL` (unless its detail is already provided in your context). Declare typed **input params** with `ADD_ACTION_FLOW_INPUT_PARAMS`; set each param's type to a value copied verbatim from `GET_ACTION_FLOW_SELECTABLE_TYPES` (never hand-build the type string). Every input param, variable, output field and code-node input/output name is an identifier: letters, digits and underscores only, never starting with a digit. The editor enforces the same rule on a manual rename, so a name that breaks it is one the user cannot repair in the UI; put user-facing wording in a displayName or description instead.\n\nA flow returns a **single typed output value**: set its type with `SET_ACTION_FLOW_OUTPUT`\n(type copied from `GET_ACTION_FLOW_SELECTABLE_TYPES`) and clear it with\n`CLEAR_ACTION_FLOW_OUTPUT`; bind the value afterwards at the output's schema path.\n\n### Building & Editing a Flow\nCreate flows with `ADD_ACTION_FLOWS` (each seeds an empty FLOW_START \u2192 FLOW_END), then read node and structure ids from `GET_ACTION_FLOW_DETAIL` before editing. See what can be added after a node with `BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS` at that same position, then add an entry's `node` with `ADD_ACTION_FLOW_NODE`; reorder with `MOVE_ACTION_FLOW_NODES`, remove with `DELETE_ACTION_FLOW_NODES`, and branch a Condition node with `ADD_ACTION_FLOW_BRANCH_ITEM`. When a flow has grown a run of nodes that reads as one step, or the same run is wanted in another flow, extract it with `EXTRACT_ACTION_FLOW_NODES` instead of rebuilding it: the run becomes a new flow with the inputs and output it needs, and a Run Actionflow node calling it stays in place. Every node's displayName should state its business intent ('Insert generation request', 'Decrement like count') rather than the node-type default \u2014 it is optional, and a name left off becomes that default, so omit it only when no better name fits. Edit a node's name or type-scalar config with `UPDATE_ACTION_FLOW_NODE`, but set its data bindings (values, conditions, data sources, mutation fields) with the bindings plugin at the node's schema path \u2014 never inline. A node's schema path is NEVER hand-built: copy it from `ADD_ACTION_FLOW_NODE`'s result or `GET_ACTION_FLOW_DETAIL`'s nodeSchemaPaths (form: server/actionFlows/{i}/allNodes/{j}), then append key segments to reach a binding site inside the node. The key names vary by node type \u2014 an AI node's input arg is `.../allNodes/{j}/inputArgs/<argKey>`, a code node's is `.../allNodes/{j}/inputs/{index}/value`, a mutation column is `.../allNodes/{j}/mutation/object/<columnName>` \u2014 copy the exact keys from `GET_ACTION_FLOW_CONTEXT_INFO`'s currentNode structure, never guess them. Declare flow variables with `ADD_ACTION_FLOW_GLOBAL_VARIABLES` and assign them in a Set Variable node with `ADD_GLOBAL_VARIABLES_NODE_TARGETS`. A Run Code node's `args.<name>` input slots are managed with `ADD_CUSTOM_CODE_NODE_INPUT` (rename/delete variants); its result type is declared with `SET_CUSTOM_CODE_NODE_OUTPUT_TYPE` so downstream nodes can bind to it; fill the code body with `CREATE_CONST_BINDING`. An update or delete Database node is seeded with an always-true filter that matches **every** row \u2014 narrow it with the bindings plugin's request filters before syncing, or the write hits the whole table. A workspace API node's request parameters are pre-seeded on the node when the API is selected \u2014 read the node back and bind ONLY the parameter slots it shows under `event/inputs/<param>`. NEVER invent input keys the read-back does not show: the runtime and editor ignore them.\n\n### Condition Branches\nCondition branches use their left-to-right editor order. At runtime, only the first branch whose condition is true has its branch body executed; branches to its right are not entered. Put an `Always` branch last when fallback behavior is required\u2014an earlier `Always` branch shadows every branch to its right. Do not rely on the no-match behavior; provide an explicit fallback whenever the flow must choose a branch. Only `MUTUAL_EXCLUSION` is supported. `MUTUAL_TOLERANCE` may still appear in generated argument schemas, but tolerance branches are not implemented and fail at runtime. Always set a Condition node's `conditionType` to `MUTUAL_EXCLUSION`.\n\n### Node Input Visibility (Scope)\nWhat a node can bind to is not \"any earlier node\": ztype limits it to the nodes **visible** from that site \u2014 the ones on its straight path back from FLOW_START. The data binding options tree returned with every binding response (its \"Actionflow data\" branch) already applies this rule and is the authoritative list of reachable node outputs; if a node is absent there it is out of scope, so never hand-build a path to reach it.\n\nLoops and Condition branches are **one-way scopes**. From *inside* a block, a node sees the outer scope, the flow inputs, and \u2014 in a Loop \u2014 the current item; but from *outside* the block (any node after the loop's end or after a branch merge) the block's inner nodes are invisible, and sibling branches never see one another. A value produced inside one branch or one loop iteration therefore CANNOT be bound directly by a later node \u2014 it will not appear in that node's options tree.\n\nTo carry a branch- or loop-dependent value past the block, use a **flow variable** \u2014 the only output that crosses a scope boundary. Declare it once with `ADD_ACTION_FLOW_GLOBAL_VARIABLES` (type copied from `GET_ACTION_FLOW_SELECTABLE_TYPES`), assign it *inside* the branch or loop body with a Set Variable node (`ADD_GLOBAL_VARIABLES_NODE_TARGETS`), then read the variable from any later node. Idioms: choose a value by branch \u2014 assign the SAME variable in every branch, then read it after the merge; capture or accumulate across a Loop \u2014 assign the variable inside the loop body, then read it after the loop's end. A branch that never assigns the variable leaves its prior value, so set a sensible default before the branch when every path must yield one.\n\n### Concurrency\nConcurrent invocations of the same flow interleave between nodes; sync-mode ACID rolls back on error but does NOT serialize flows (read committed). Query-a-row, branch, then write based on that read is a race: concurrent calls all act on the same stale read. Where the platform can express the check inside the write, prefer that: put row-local guards in the mutation node's own filter (update where stock >= qty; delete where the key pair matches) and branch on the write's affected rows; use an update node's increment/decrement mode for counters; for insert-if-absent or toggle semantics use a unique constraint (the only DB-enforced constraint kind today) as the insert node's conflict target with action 'none' (`UPDATE_ACTION_FLOW_NODE`'s `onConflict`), then branch on whether the insert returned a row \u2014 a skipped conflict returns no row. Invariants none of these can express (cross-row rules, aggregates) have no atomic form yet; check-then-write is the accepted fallback there.\n\n### Error Handling\nSynchronous: all DB changes roll back on error. Asynchronous: only the failing node's DB changes roll back.\n\n### Versioning\nEach save creates a new version. \"Sync Backend\" required after editing for changes to take effect in production.\n\n### JavaScript Sandbox (Run Code node)\nCustom Code Blocks run in a synchronous GraalJS server sandbox. No async/await, no require(), no browser APIs. All platform interactions go through the global `context` object: context.getArg(key) \u2014 retrieve flow input context.setResult(val) \u2014 pass this node's single result downstream context.runGql(opName, gql, vars, permission) \u2014 execute DB operations context.callThirdPartyApi(apiId, params) \u2014 invoke a workspace API by its apiId (the method name is historical; this project has no third-party API configs) context.callActionFlow(flowId, ver, args) \u2014 run a sub-flow synchronously context.createActionFlowTask(flowId, ver, args) \u2014 trigger a sub-flow async context.getSsoUserInfo() \u2014 get authenticated user profile context.uploadMedia(url, headers) \u2014 stream remote image to asset server context.log(message) \u2014 emit to Log Service\n\n`runGql` takes FOUR arguments and the first one is the operation NAME, not the document: `runGql(\"GetWords\", \"query GetWords { theme_word(where: {...}) { word } }\", {}, {role: \"admin\"})`. The name must match the one declared in the document. `vars` is a JS object (not a JSON string) and `permission` is `{role: \"<role name>\"}` with an optional `sessionVariable` map. Passing the document first is the mistake that costs an afternoon: the arity error, then a String-coercion error naming a type you did not pass, then \"permission should have field role\" are all the same misalignment reported one argument at a time.\n\nIt returns the `data` object directly \u2014 `r.theme_word`, never `r.data.theme_word` \u2014 and it THROWS on a GraphQL error rather than returning an `errors` array, so there is no envelope to branch on. Do not write defensive code for a response shape you have not seen.\n\nThe list above is the methods you will reach for, not the whole API. The complete Context API reference \u2014 every method with its parameters and return shape \u2014 is the \"Develop with Run Code\" developer page: find it with `docs.search`, and read it rather than inferring a signature from an error message. Search by title; the page's path is not the same across products.",agent:`Zion is a powerful no-code development platform that enables developers to build and deploy web, mobile, and WeChat Mini Program (\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F) applications. It integrates a visual drag-and-drop design canvas, an enterprise-grade relational database engine (PostgreSQL), and an event-driven backend logic execution pipeline.
44
44
 
45
45
  This overview details the structural design, data engines, execution pipelines, and safety requirements of the platform.
46
46
 
@@ -67,7 +67,7 @@ A request that names a product or a goal \u2014 "a todo app", "add memberships"
67
67
  * **First release (MVP)**: the smallest thing that opens and shows the idea working \u2014 one role, the people the idea is for, and one happy path, built with exactly the pages and tables that path passes through from start to finish, and nothing it does not. Sign-in only when the idea depends on who someone is. No payments, orders that take money, memberships or points; no schedules or webhooks; no admin side; AI only when the idea itself is AI. The user should see the first page within a few minutes, not after the whole data layer is done.
68
68
  * **Later**: everything else the request asked for, named so it can be picked up next.
69
69
 
70
- State the cut in one line before you build anything, in the language the user writes in \u2014 e.g. "First release: a customer browses products and places an order; membership balance and points come later." A stated cut gets corrected in one sentence; an unstated one is discovered when the user asks where the rest went. When the release has screens and the client has no DESIGN.md, its look is still open: ask it in that same message, so the build starts with the look decided. Then carry only the first release into level two, and name what you deferred rather than dropping it silently: work that disappears without being named reads as you having missed half the request.
70
+ State the cut in one line before you build anything, in the language the user writes in \u2014 e.g. "First release: a customer browses products and places an order; membership balance and points come later." A stated cut gets corrected in one sentence; an unstated one is discovered when the user asks where the rest went. Then carry only the first release into level two, and name what you deferred rather than dropping it silently: work that disappears without being named reads as you having missed half the request.
71
71
 
72
72
  ### 2.2 Level Two \u2014 Build That Release Path By Path
73
73
 
@@ -239,7 +239,7 @@ The Zion editor's interface is in Chinese. These instructions name things in Eng
239
239
  * Email/password
240
240
 
241
241
  ### Timezone & Locale
242
- Product default timezone: **Asia/Shanghai** (UTC+08:00). A project can override it; the zone actually in effect is \`timezone\` in GET_PROJECT_OVERVIEW. Default UI language: Simplified Chinese (zh-CN).`,api:"## API Integration Domain Knowledge\nAn API integration is a saved external HTTP endpoint the project can use as a data source. APIs are organized into **workspaces**: a workspace groups related endpoints and holds shared **constants** (e.g. a base URL or API key) the endpoints reference, so credentials live in one place. The action-flow \"Call API\" node invokes these workspace APIs.\n\n### Anatomy\n- **Workspace**: a named group with a description and a set of `constants`.\n- **API**: an HTTP `method` + URL under a workspace, with request **parameters** (path / query / header / body), typed **response configs** (the result shape downstream binds from), and declared **input variables** (the values a caller supplies).\n\n### Workflow\nList with `GET_ALL_API_WORKSPACES` / `GET_ALL_APIS_INFO`, then `GET_API_DETAIL` to read an API's `apiId`, `workspaceId`, and parameter / response `uniqueId`s before editing \u2014 never fabricate them. Build top-down: `ADD_API_WORKSPACES` \u2192 `ADD_API_WORKSPACE_CONSTANTS` (put API keys / base URLs here, never inline) \u2192 `ADD_APIS` (each under a `workspaceId`) \u2192 `ADD_API_PARAMETERS`, `ADD_API_RESPONSE_CONFIGS`, `ADD_API_INPUT_VARIABLES`. Editing creates a new version; \"Sync Backend\" is required for changes to take effect in production.\n\n### Timeout\nEach API has a request `timeout` in seconds, 1 to 60, 30 when never set; ADD_APIS and UPDATE_API set it and GET_API_DETAIL reports it. Called from an action flow, the request is also cut off when the flow's own timeout runs out, whichever comes first, so raising an API's timeout helps only if the calling flow's timeout leaves room for it.\n\n### Request Bodies\nA body-carrying method needs a body FORMAT, and `SET_API_CONTENT_TYPE` is what sets it \u2014 `UPDATE_API` has no content-type argument and will reject one. `application/json` seeds an empty object type that belongs to this API; `GET_API_DETAIL` reports it as `bodyType`, and you describe it with the 'type' plugin's `ADD_TYPE_DEFINITION_FIELDS`. The two form formats take their fields from `ADD_API_PARAMETERS` instead. Every such switch DISCARDS the body that was there, so pick the format before filling it in \u2014 and never cycle the method away and back to force a reset, which throws the body parameters away with it.\n\nA media field, or an object field carried as a JSON string, cannot travel over HTTP as itself: it needs a conversion, and a media field left without one leaves the API incomplete. `GET_API_CODEC_OPTIONS` says which slots need one and what each allows; `SET_API_CODECS` applies it and `DELETE_API_CODECS` removes it.\n\n### Response Shapes\nA response config's type is what downstream reads the result through, and only an object type puts that result's fields where a binding can see and pick them. A JSON response still yields values \u2014 through the get-value-from-JSON formula \u2014 but the key path is a string you have to already know and spell by hand, nothing in the project lists what the payload holds, and a key that does not match it comes back empty rather than erroring; a text response does not even reach that formula. So whenever the endpoint documents what it returns \u2014 and it usually does \u2014 give the response a shape: `ADD_API_RESPONSE_CONFIGS` / `UPDATE_API_RESPONSE_CONFIGS` with `seedObjectType: true` mint an object type owned by this API and echo its `responseTypeId`, which you then describe with the 'type' plugin's `ADD_TYPE_DEFINITION_FIELDS`, exactly as you do a JSON request body. Add `arrayLevel: 1` where the endpoint returns a list of that shape. Reach for the JSON type only when the body's shape genuinely varies from call to call, and for text only when the response is not JSON at all (a 204 with no content, a plain-text body). A response status's `name` is an identifier \u2014 letters, digits and underscores only, never starting with a digit, and unique within the API \u2014 because it becomes a property of the API result that bindings read by name.\n\n### Types\nEvery `type` argument here is picked, not written: call `GET_API_SELECTABLE_TYPES` for the slot being filled and copy a returned `typeIdentifier` verbatim. A private object type belongs to the one feature that owns it and is never offered to another, so to reuse a shape some other feature owns, publish it with `PUBLISH_OBJECT_TYPE` \u2014 it keeps its id and becomes selectable \u2014 and pick it here. This API's own JSON body type is the exception \u2014 it is already this API's, so describe it in place with `ADD_TYPE_DEFINITION_FIELDS`. Lists are not enumerated \u2014 the nesting has no end \u2014 so a list response or input variable is a returned identifier plus `arrayLevel: 1`; the URL, header and form-body parameters hold one value, take no `arrayLevel`, and accept no list at all.",bindings:"## Data Binding Domain Knowledge\nData binding connects data sources to UI components for display or interaction.\n\n### Concepts\nSchema path: array of keys/indices locating a bindable node in the project JSON schema. Data binding options tree: hierarchical tree of all available data for a given schema path. Never hand-build a schema path for an action-flow node: copy it from the actionflow plugin's add_node result or get_flow_detail's nodeSchemaPaths (form: server/actionFlows/{i}/allNodes/{j}), then append key segments for the binding site inside the node. The binding-site key names VARY BY NODE TYPE (an AI node's input arg lives under inputArgs/<argKey>, a code node's under inputs/<index>/value, a mutation column under mutation/object/<columnName>) \u2014 copy the exact keys from the currentNode structure returned by get_context_info; never guess them.\nType metadata in read results uses exact typeIdentifier values such as `s:p:string` and `u:e:<enumId>`; copy those values verbatim.\n\n### Binding Kinds\nOPTION: bind to an existing path in the data binding options tree. pathInHierarchicalMenu must be the EXACT complete path, and menu labels are locale-dependent display names (a project may render them in Chinese or English) \u2014 so a label can NEVER be guessed. Before the first option binding at a schema path whose tree you have not seen, read it with `BROWSE_DATA_BINDING_OPTIONS` (CRITICAL: Do NOT call `get_options_tree` if the tree is already provided in the context above); afterwards every binding response attaches the refreshed tree for its op's path. Copy every label verbatim from that tree \u2014 never invent, translate, or shorten a label \u2014 and include every intermediate menu level. If the tree root is a named context (e.g., \"List Context\"), include it as the first element. CONST_VALUE: set a literal constant (e.g., \"Submit\", 0, false). FORMULA: compute a value with an operator (text / math / time / array / enum / geography / json groups); discover the available operators before building one. CONDITIONAL: choose the value by branch \u2014 define the branches, then build each branch's predicate.\n\n### Priority\n1. Prefer OPTION (live data) over CONST_VALUE.\n2. No suitable option? Use CONST_VALUE with a reasonable inferred constant.\n3. Component purpose unclear? Skip binding.\n4. A list NESTED INSIDE another list binds from the ancestor's item data, not from a table, so the relational linkage survives. This is about nesting only \u2014 a top-level list binds straight to the table it shows, and prefers that over consuming someone else's page query unless the result set is genuinely shared.\n5. Bind ONLY what the task requires: in an update/insert node's object leave every other column untouched \u2014 never fill it with a Null option or a placeholder constant (Null on a required column breaks the flow at runtime).\n6. Never seed a typed site with a throwaway constant \"for now\" and upgrade later \u2014 bind the real value directly; a constant re-types nothing but still wastes a round.\n7. To unset a bound value that no longer fits, clear it with `CLEAR_DATA_BINDING` rather than overwriting it with a placeholder.\n\n### Iterative Refinement\nPer-op errors are returned keyed by index. Successful bindings have already landed. On rejection, fix ONLY the failing entries by index and re-call.\n\n### Data Sources Available in Zion\nDatabase tables (with filters/sorting/limits), page data sources, page variables, global variables, page parameters, logged-in user, list/component item data, Actionflow inputs/outputs, formula results.\nThis is the product-wide catalog, NOT what is bindable at any given site \u2014 each site exposes only a subset. NEVER assume a category is available: the options tree for the site is authoritative, so read it with `BROWSE_DATA_BINDING_OPTIONS` first and bind only categories it actually lists. If one (e.g. formula data) is absent for that path, it is not valid there \u2014 do not attempt it. (Action flows run strictly on the backend, so page data sources never apply inside a flow node.)\n\n### Request Filters (where / sort)\nA database-query data source \u2014 a list/component request, or an action-flow query / update / delete node \u2014 carries **request filters**. FIRST call `GET_REQUEST_FILTER_CONTEXT` with the request's (or owning node's) schema path: it returns the table's selectable columns (with the `pathComponents` and `allowedOperators` to use) and the filter entries' `whereSchemaPath` / `sortConfigsSchemaPath`, each with a `whereTrack` saying which where tools apply. Copy those paths and column `pathComponents` verbatim \u2014 never hand-build them. Queries and component requests carry a LIST of conditional filters (where + sort groups, each gated by its own condition, always including a system Default filter). An action-flow update/delete node instead carries ONE bare where (`supportsConditionalFilters: false` in the context result) \u2014 edit it via the single entry's `whereSchemaPath` with the where-condition tools only; the filter-group and sort tools do not apply, and insert nodes have no request filter at all.\nTo change a numeric column RELATIVE to its current value (stock, counters, balances), set the column's write mode with `SET_UPDATE_COLUMN_ARITHMETIC` and bind only the DELTA as the column's value \u2014 the database applies it atomically. Never query the current value, compute in a formula, and set it back: that read-modify-write loses concurrent updates. Idiom \u2014 decrease field_a by x: mode 'decrement' on field_a, value x, and a where guard `field_a > x` (or `>= x` when draining to zero is allowed) so the update changes nothing when the stored value is insufficient. That rule generalizes to every mutation this plugin configures \u2014 frontend component mutation events and action-flow nodes alike: when a write's correctness depends on current row state, put the check in the mutation's own where filter and let follow-ups branch on its affected rows, instead of querying first and writing on the stale read (concurrent users race it). Insert-if-absent semantics additionally need a unique constraint \u2014 the only DB-enforced constraint kind today (see the database plugin).\n- Filter groups: `ADD_REQUEST_CONDITIONAL_FILTER` / `UPDATE_REQUEST_CONDITIONAL_FILTER` / `DELETE_REQUEST_CONDITIONAL_FILTER` / `REORDER_REQUEST_CONDITIONAL_FILTERS`. The Default filter cannot be renamed or deleted.\n- Where conditions, `whereTrack: WHERE_CONDITION` \u2014 every filter you add and every new query / update / delete node starts here: `INSERT_CONDITION_BOOL_EXP` at the entry's `whereSchemaPath` (an empty tree is filled in place), `UPDATE_EXPRESSION_CONDITION_OPERATOR` (operators from `GET_EXPRESSION_CONDITION_OPERATORS`), then bind the condition's `target` to the row's column with an OPTION from the options tree at that path and its `value` with a binding (OPTION / CONST_VALUE); shape the expression with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`, `DELETE_CONDITION_BOOL_EXP`.\n- Where conditions, `whereTrack: COLUMN_WHERE` \u2014 an existing column filter: `ADD_REQUEST_FILTER_CONDITION` (column + operator), then fill its comparison value with a binding (OPTION / CONST_VALUE) at the condition's `value` path; shape the expression with `NEST_REQUEST_FILTER_CONDITION`, `TOGGLE_REQUEST_FILTER_CONDITION_AND_OR`, `TOGGLE_REQUEST_FILTER_CONDITION_NOT`, `UPDATE_REQUEST_FILTER_CONDITION_OPERATOR`, `DELETE_REQUEST_FILTER_CONDITION`.\n- Sort: `ADD_REQUEST_SORT_CONFIG` / `UPDATE_REQUEST_SORT_CONFIG` / `DELETE_REQUEST_SORT_CONFIG` / `REORDER_REQUEST_SORT_CONFIGS`.\n\n### Composing text from fragments and variables\nFor any `s:p:string` value that mixes literal fragments with variables \u2014 AI prompt templates, titles, labels, messages \u2014 do NOT build a stringConcat formula. Build the template at the same schema path with operation CONCAT: `CREATE_CONST_BINDING` for a literal fragment, `CREATE_OPTION_BINDING` for a variable. Each CONCAT appends to the end, so the final order is exactly the order you emit entries \u2014 within a call and across consecutive binding calls in the same turn. Emit them in final reading order, interleaving literals and variables \u2014 e.g. const_value \"Hello \", option user, const_value \", order \", option orderId, const_value \" total \", option amount. Never emit all literals then all variables (that puts every label before every variable), and two literal CONCATs in a row merge into one fragment. This produces the same inline template the editor's text fields produce and stays editable there. Reserve formulas for real computation (math, time, regex, arrays) \u2014 never for simple text templating.\nA number, boolean, date, time, datetime or color bound into a `s:p:string` slot is converted for display automatically, so bind the option straight to the slot \u2014 never wrap it in `toText` or any other conversion operator. Only structured values (lists, objects, media) genuinely need one. `BROWSE_DATA_BINDING_OPTIONS` marks an option with `*` only when the target really cannot take it; an unmarked option needs no conversion step.\n\n### Formula & Conditional Bindings\nA FORMULA or CONDITIONAL value is built in several steps at the value's schema path, not in a single call.\n- Formula: call `GET_FORMULA_OPERATORS` at the path, then `CREATE_FORMULA_BINDING` with an operator copied verbatim (the wire token, e.g. `-` not SUBTRACT; operation REPLACE). If the operator needs scalar config (e.g. distance unit, rounding mode), read its shape with `GET_FORMULA_CONFIG_OPTIONS` and pass it or apply it later with `SET_FORMULA_CONFIG`. The create result returns `operandSchemaPaths` \u2014 fill each operand with an OPTION / CONST_VALUE binding at its returned path, copied verbatim; never derive an operand path yourself. A `timezone` operand (e.g. on FORMAT_DATE_TIME) is optional: unbound, the project's default zone applies, so bind it only when the user asks for a specific zone or the viewer's own.\n- Conditional: `CREATE_CONDITIONAL_BINDING` (seed branches with initialBranchNames; operation REPLACE), add more with `INSERT_CONDITIONAL_DATA`. For each branch, build its predicate with `INSERT_CONDITION_BOOL_EXP`, choose the comparison via `GET_EXPRESSION_CONDITION_OPERATORS` + `UPDATE_EXPRESSION_CONDITION_OPERATOR`, fill both operands with OPTION / CONST_VALUE bindings, and shape the expression with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`, `DELETE_CONDITION_BOOL_EXP`; then bind the branch's resulting value. The first branch whose predicate is true wins \u2014 order them with `REORDER_CONDITIONAL_DATA`.\n- There is no string is-empty operator (`_is_empty` accepts lists only, and `\"\"` is not null): test text emptiness as `stringLength(x) > 0` via a formula binding on the operand.\n\n### Page links\nThe global page-link option binds a getPageUrl function binding with no target page, so the link points nowhere until you call `SET_FUNCTION_BINDING_PAGE_URL_TARGET` at the same schema path with the target page's id. Fill each parameter it returns under argSchemaPaths with an OPTION / CONST_VALUE binding at that path, copied verbatim.\n\n### Lists composed item by item\nTo give a list slot a literal list, bind the Custom > Array option at its schema path, then append items with `ADD_CUSTOM_ARRAY_BINDING_ITEMS` \u2014 a binding at an item index that does not exist yet is rejected, so an empty custom array can only grow through that tool. Fill each item it returns under itemSchemaPaths with an OPTION / CONST_VALUE binding, copied verbatim. For a list of lists, each item is a custom array of its own: call `ADD_CUSTOM_ARRAY_BINDING_ITEMS` again at the item's path. Remove items with `DELETE_CUSTOM_ARRAY_BINDING_ITEMS`.",component:"## Component Domain Knowledge\nThe UI is a tree of components organized into pages.\n\n### Identity & Tree Rules\nEvery component has an immutable id and a displayName. Reads return both; write tools verify the {id, displayName} pair and reject a mismatch \u2014 re-read, then retry. A container's children order IS the visual order. A component can never be moved into its own subtree.\n\n### Categories\nLayout (container \u2014 can hold other components via `children`):\n- PAGE: root of each page; created without a parent and registered as a new page.\n- LAYOUT_VIEW: generic Flexbox container; the most common container.\n- MODAL: popup/dialog container; created without a parent, opened/closed via events.\n\nSpecial (complex \u2014 children live in built-in slots seeded at creation and mutated only via the slot tools, never via ADD_COMPONENT / MOVE_COMPONENTS):\n- LIST: repeating list; its \"cell\" slot renders once per data row (optional header/footer).\n- TAB_VIEW: tabbed interface; one child view per tab in tabList.\n- SELECT_VIEW: built-in normal/selected state views.\n- CONDITIONAL_VIEW: one built-in view per condition branch.\n- MAP: optional \"marker\" slot taking a MAP_MARKER.\n\nLeaf/Business (cannot have children): BUTTON, TEXT, IMAGE, VIDEO, LOTTIE, RICH_TEXT, TEXT_INPUT, NUMBER_INPUT, VIDEO_PICKER, FILE_PICKER, SWITCH, MAP_MARKER, CALENDAR, HORIZONTAL_LINE, SHEET, HTML, RICH_TEXT_EDITOR, MIX_IMAGE_PICKER, DATE_TIME_PICKER, DATA_SELECTOR, PROGRESS_BAR. MAP_MARKER can only be placed inside MAP. `GET_SELECTABLE_COMPONENT_TYPES` returns the full creatable catalog with each type's slot fields.\n\n### Hierarchy Rules\nEvery component except PAGE and MODAL must have a Layout Component as its parent. Prefer relative positioning; use absolute/fixed only when truly necessary.\n\n### Layout\nZion uses Flexbox. Layout containers configure: direction (row/column), justify-content (start, space-between, space-evenly, space-around), gap, wrap, overflow (scroll/visible/hidden).\n\n### Responsive Breakpoints\nPhone: 0\u2013767 px (375 px panel) | Tablet: 768\u20131279 px (820 px panel) | Desktop: 1280\u20131920 px (1440 px panel). Desktop is the primary breakpoint and the one every read and write defaults to. A narrower breakpoint stores only its differences from desktop, so a field it does not override renders the desktop value at that width \u2014 an app built without touching phone is not unstyled there, it is desktop-sized there, which is how a 600 px card ends up running off a 375 px screen. The schema and the error center do not show this; a read with `breakpoint` or a phone capture does, so look at phone when you build or restyle a layout the user will open on one, not after every edit. Read what phone actually resolves to by passing `breakpoint` to `GET_COMPONENT_INFO` and `GET_CONTAINER_CHILDREN_INFO`; the read names which fields that breakpoint overrides and which it inherits. Fix one by resending that field with the `breakpoint` param to `UPDATE_COMPONENT_STYLE` \u2014 usually flexDirection 'column' on rows, and widths in % or fill rather than px; a phone `component capture-canvas` shows the result. Resending a value unchanged at a breakpoint pins it there and stops it following desktop, so override only what has to differ.\n\n### Reading the Component Tree\nIds are opaque: copy them verbatim from these read tools and never modify them. A page id (from `GET_ALL_ROOTS_INFO`) is not a component id, and breakpoint keys (phone/tablet/desktop) are tool parameters, never part of an id \u2014 passing something like `<pageId>-desktop` as a component target fails with \"target component not found\".\n\n### Building & Editing the Component Tree\nConstruction workflow: read the target container, pick types with `GET_SELECTABLE_COMPONENT_TYPES`, edit `GET_COMPONENT_TEMPLATE` output and submit it via `ADD_COMPONENT`, then use the ids it echoes instead of re-reading.\nContainer sizing: a LAYOUT_VIEW hugs its content, so a container created WITH its children inside is sized by them and needs no height of its own; an empty one keeps a small minimum height so it stays visible and droppable, and filling it makes that minimum irrelevant. Give a container an explicit height only when you want a fixed-size box or a scroll viewport \u2014 a fixed height its content outgrows clips that content invisibly, and a fixed width crops text mid-word. `UPDATE_COMPONENT_STYLE` merges, so a size you do not name keeps its old value.\nWidth/height `fill` means \"grow along the flex main axis\", so it only makes sense on the axis the parent lays out along: `width: fill` in a row, `height: fill` in a column. On the other axis it would unset the size and let the child shrink to its content, so it is applied as '100%' instead and the result says so. There is no `stretch` alignment to fall back on \u2014 in Zion a component declares its own size rather than having its container negotiate one.\nA row of cards is sized one axis at a time. Along the row, give every child `fill`, or fr shares \u2014 `65fr` and `35fr` \u2014 when the split is deliberate; never percentages, because fr divides what is left after the gap and the padding while `65%` + `35%` claims the whole width and the gap then pushes it over, wrapping or clipping the last column. Across the row, give every child the SAME `minHeight` so they bottom out together: a real `height` would clip the card whose content grows past it, and with no `stretch` to fall back on a shared floor is as close to equal-height cards as this system gets \u2014 a card whose content clears the floor still grows alone, so pick a floor that clears the tallest copy you expect. Set `minWidth` on a child only where that column has a genuine floor: it, not `flexWrap`, is what makes a row break into 2+1 once the container is narrower than the floors plus the gaps. Size the children this way and the container needs nothing beyond `flexDirection`, `gap` and its own width \u2014 `justifyContent` and `alignItems` have no free space left to distribute, so reaching for them to fix a ragged row means the children are the wrong size.\nWhen a sentence reports as clipped horizontally, it is nearly always `textWrap` false (see Typography below): widening the box, or setting `overflowX`, does not make the text reflow.\nA TEXT_INPUT collecting a password needs `password: true` via `UPDATE_COMPONENT_PROPERTIES`; a \"Password\" placeholder alone does not mask anything.\n\n### Bottom Navigation Is The Client's Tab Bar\nOn a mini-program or mobile client, the row of tabs along the bottom of the screen \u2014 Home / Categories / Cart / Me \u2014 is the client's native tab bar: a client setting the runtime draws itself, not components on a page. Whenever such an app has a few top-level sections the user moves between, that is a tab bar, whether or not the request says \"tab bar\" or \"bottom navigation\". Build it this way: one top-level PAGE per section, then `SET_TAB_BAR_ENABLED` and `UPDATE_TAB_BAR_ITEMS` in the same batch to point a slot at each page, with icons from `component tab-bar-icons` \u2014 two to five tabs, one page per tab. Read `GET_TAB_BAR_INFO` first when the client may already have one. Do NOT build the bar out of components \u2014 not a LAYOUT_VIEW pinned to the bottom of each page, not a TAB_VIEW holding every section's content on one page. A component copy has to be repeated on every page and drifts apart, and it is not the bar a mini-program user expects. Leave the bottom of each tab page free for the bar. Build one from components only when the user explicitly asks for a custom bar the native one cannot draw. A web client has no native tab bar; its navigation is components.\n\n### The Style Is Settled Before The First Component\nA client's look is written down in its DESIGN.md \u2014 `/project/DESIGN.md`, or `/project/app/<appExId>/DESIGN.md` in a multi-client project \u2014 and carried by the theme. When it exists, follow it; if its values disagree with the theme and the user has not said which wins, ask which to keep. A client without one has no look decided yet: settle it with the user before the first component \u2014 a direction they gave (words, a screenshot, a design, HTML) is that answer, and when the client already has screens, keeping their look is one of the choices \u2014 then write the DESIGN.md and the theme. The look is the user's decision even though defaults exist, and the platform's creation defaults are what produce the grey-box build, so a request that names no visual direction still gets one. Once settled, the style holds on every screen: a stated direction on two screens and another on the rest reads as a bug rather than a choice.\n\n### The Theme Is The Design System\nEvery style value that has a theme category is sent as that variable's referenceValue, `$$<id>`, never as a literal: colours (backgroundColor, textColor, borderColor, gradient stops, shadow.color) from colour variables, padding/margin/gap from spacings, borderRadius from radii, fontSize, fontWeight and fontFamily from their own categories, and a whole shadow as `shadow: {variable: '$$<id>'}`. The id resolves against the field's category, so `$$md` under padding is the spacing md and under borderRadius the radius md. A literal renders the same today and is pinned to the component it was written on; a reference follows the theme. That difference is the whole point: \"make it rounder\", \"a different font\", \"warmer\" is then a few `UPDATE_THEME_VARIABLES` edits that every screen follows, instead of a sweep that touches every component and still misses some. Only lineHeight, letterSpacing, borderWidth, opacity and sizes have no category and stay literal.\nThat is the default, not a rule over the user:\n- A value the user gives for one component (\"make this button 13px\", \"this banner #ff6600\") is written as that literal on that component \u2014 not rounded to the nearest variable, not turned into a new variable, and not applied by retuning a variable every screen shares. When it is unclear whether they mean this component or the whole app, ask.\n- Change only what the request touches. Existing literals stay literal unless the user asks for the restyle; do not convert them on the side.\n- Add a variable only for a value several components share, never for a one-off.\n`GET_THEME_INFO` shows what the theme holds. A theme already carries colour roles (Primary, Secondary, Tertiary, Text_primary, Text_secondary, Background, Surface, Border, Success, Alert, Error), font sizes h1 through caption that already shrink per breakpoint, weights 100\u2013900, radii sm\u2013full, spacings xs\u2013xl3 and shadows xs\u2013xl2 \u2014 and no font family. Retune those values to the style DESIGN.md records rather than working around them, and add a variable only for a role the theme lacks. When the user later asks for a different look, change the variables, not the components.\nOn a web client a font size, radius or spacing variable holds one value per breakpoint (`{desktop, tablet, phone}`). When one has to differ on phone \u2014 an h1 at 28 on desktop and 24 on phone \u2014 set that on the variable, not as a breakpoint override of fontSize, padding, gap or borderRadius on the components that reference it: an override replaces the reference at that width, so the component stops following the theme there.\n\n### The Palette Is Named Before It Is Spent\nGive a new colour variable a palette level (the theme plugin explains which), not a hex, so it recolours with the rest. A working set is roughly eight roles, named by ROLE, not by colour \u2014 \"surface\", not \"light-grey\":\n- Four neutrals, not two: the page ground, a surface lifted off it, a border a step darker again, and a hairline/divider weaker than the border. Two neutrals is the single most common cause of a flat screen \u2014 with only \"background\" and \"border\" available, every card, input, header and divider ends up drawn with the same one, and nothing separates from anything.\n- Two inks: primary for content, muted for secondary text and labels. Do NOT make muted text by dropping `opacity` on a TEXT \u2014 opacity fades the whole component including anything it contains, and it composites against whatever is behind it, so the same \"muted\" reads differently on a card than on the page. Muted is a colour.\n- One accent, and one status colour (danger) if the app writes data.\nSpend the accent only on the primary action and the active/selected state. The moment it also appears on a heading, an icon and a border, nothing on the screen is being pointed at.\n\n### A Text Role Is Three Values Sent Together\nThe theme has font sizes and font weights but no line height and no combined text style, so a role \u2014 page title, section heading, body, label, caption, rarely more than five \u2014 is a pairing you keep yourself: a size variable, a weight variable and a lineHeight, sent together every time. Asking for a heading means all three; a heading size at body weight is two roles blended. lineHeight is absolute px and does not follow the size: roughly 1.2\xD7 the size for headings, 1.5\xD7 for body copy, and without it anything above the default crops or overlaps. The display sizes shrink on phone while the lineHeight you sent at the main breakpoint does not, so give a heading role a phone lineHeight as well. For the same reason, changing a font size variable does not move the lineHeight of the text that uses it: in the same turn, re-send lineHeight (and the phone lineHeight) on every TEXT and BUTTON of that role, or the larger text crops and overlaps.\n\n### Typography Carries Most Of The Impression\nThe type is the largest coloured area on almost every screen, so it decides the character of the page before any accent does.\n- Typeface is a real choice: the default (DM Sans on web, pingFang SC on mobile) is the face every other project ships with. Choose it by the type mood DESIGN.md records: reference the theme's FONT_FAMILIES variable when one already fits, otherwise add one, and reference it as fontFamily on every TEXT, BUTTON and TEXT_INPUT \u2014 then switching the face later is one edit. A project that predates theme font variables lists its faces in styleScaleFontFamilies. `GET_THEME_INFO` lists the families this client offers under offeredFontFamilies, and only those have font files; any other name renders as the system fallback. One family is a complete answer; two only when clearly distinct in role (a display face and a text face), never two sans faces that differ slightly. If the copy is Chinese, the BODY face has to be a CJK one, not just the headline: a Latin family carries no Chinese glyphs, so every Chinese character falls back to whatever the device has. A display face carries a headline and nothing longer.\n- Hierarchy comes from weight and space as much as from size. Three text roles that differ only in size read as one undifferentiated block; a heading at 600\u2013700 against body at 400 separates at a glance even when the sizes are close.\n- `letterSpacing` is in PIXELS, not em, and goes NEGATIVE on large display type \u2014 roughly -0.5px at a 28\u201332px page title, -1px or beyond as the size grows \u2014 because a face designed at body size is too loose when set large. Body text wants 0. A fractional value like -0.02 changes nothing visible, so sending one and then reporting the tracking as tightened is a false claim. It goes slightly POSITIVE only on small uppercase labels, which are themselves worth avoiding.\n- On a web client, set `maxWidth` on any TEXT holding a paragraph. Unbounded body text stretches to the container and a 1200px-wide line is unreadable regardless of how well it is styled; hold it near 60\u201370 characters, which at body size is roughly 600\u2013680px. A capped column keeps hugging the left edge until its PARENT centres it \u2014 in a column parent (a PAGE's default) that is `alignItems: 'center'`. This is the most-skipped and most-visible typographic fix in a wide desktop layout.\n- Body text needs `textWrap: true` \u2014 false pins it to one line and ellipsises it at the box edge however wide the sentence is. `lineClamp` on top when it must stop after N lines.\n\n### Depth Is One Decision, Applied Once\nThe failure mode is shadow everywhere rather than shadow used well.\n- A card lifts off the page with EITHER a hairline border OR a soft shadow, not both. Pick one for the whole app.\n- Elevation is at most two levels \u2014 resting surface, and the raised thing (modal, dropdown, the one hero card) \u2014 so reference two of the theme's shadow variables and no more. A third level means the second is not doing its job.\n- A real shadow is large, soft and nearly transparent, and offset downward only \u2014 light comes from above: `blur` well above `offsetY`, a colour at low alpha. If the theme's shadows do not read that way, retune those variables rather than drawing a shadow on one component.\n- `inset: true` is for the pressed state of a button and for a well an input sits in. It is the only correct way to make something look recessed rather than raised.\n- `backdropBlur` belongs on overlay chrome that sits over content \u2014 a sticky header, a modal scrim. On an ordinary card it costs paint and buys nothing, since there is nothing behind it to blur.\n- `borderRadiusCorners` exists for the cases a single radius cannot express: a segmented control, a sheet rounded only at the top, a cell at the end of a row. Reach for it there and nowhere else.\n- Radius is hierarchy. If the card, the input, the badge and the button all carry the same radius variable, the screen has told the user nothing about what is what.\n\n### Space Is The Cheapest Thing That Reads As Finished\nThe common failure is far too little of it, and it is not a matter of taste \u2014 the numbers are knowable, and they differ per client. On a web desktop, section padding starts at 64px vertical and goes up, not down; card padding at 20\u201324px; the page gutter at least two spacing steps above the in-card gap, so a card reads as sitting on the page rather than pasted onto it; the phone breakpoint drops sections to 24\u201332px and cards to 16px. A 375px mini-program or mobile screen keeps 16px side margins and 16px card padding, 8px inside a card, 12\u201316px between cards and 24\u201332px between sections \u2014 never the desktop 64 \u2014 with tap targets at least 44 \xD7 44. When a screen feels cramped, the fix is almost always more space AROUND the groups, not less space inside them. Proximity is the actual signal: things that belong together sit closer to each other than to anything else, and if a label is equidistant from its own field and the next one, the layout has lost the reader regardless of how the label is styled.\n\n### Every Interactive Thing Shows It Is One\nOn a web client `UPDATE_COMPONENT_STYLE` takes `variant: 'hover'`, and a build that never sends it is a build where nothing on screen responds to the mouse. That, more than any colour choice, is what makes a page feel like a mockup rather than an application. A hover state on buttons, clickable cards and list rows \u2014 a surface a step lighter or darker is enough \u2014 costs one extra call per component type, not per component, because the same few shapes repeat. A LAYOUT_VIEW with an ON_CLICK handler still shows an arrow cursor until it gets `cursor: 'pointer'`, so the user has no way to know it is a target. A mini-program or mobile client has no cursor, so send no hover variant there: a tappable thing shows itself by shape \u2014 a fill or an outline on a button, a trailing chevron on a row that opens something. On every client, where a SELECT_VIEW or a TAB_VIEW has a selected state, style it. The default selected state is not a design decision, and \"the active tab looks like the inactive ones\" is a bug the user will report in different words.\n\n### Three Things Can Be Conditional \u2014 Pick The Smallest One\nWhen a screen has two modes, do NOT reach for a conditional container first. Ask what actually differs between the modes, and make only that conditional:\n- Conditional DATA (`CREATE_CONDITIONAL_BINDING`) when only VALUES differ \u2014 a label, a title, a placeholder, a colour. One component, one conditional binding whose branches are keyed off the deciding value. This is the default answer.\n- Conditional ACTION when only BEHAVIOR differs \u2014 one button that submits, signs in or signs up depending on the mode. One button, one handler that branches.\n- Conditional VIEW (CONDITIONAL_VIEW) only when the STRUCTURE differs \u2014 different fields, different counts of children. Branches do NOT share children, so anything you put in a branch is duplicated in every other branch. If the two modes share a form, keep the shared form OUTSIDE the CONDITIONAL_VIEW and put only the differing part inside it. Its branch conditions start always-true, so the first branch shows until you narrow them; make the mode a page variable the conditions read and change it with SET_VARIABLE_DATA.\nA \"switchable signup / login\" is therefore conditional data plus a conditional action over ONE shared form \u2014 not two branches each holding a copy of the same fields. Wrapping shared UI in branches is the classic wrong answer: it looks right and silently doubles the tree.\nTAB_VIEW is a different question entirely: use it only when the tab strip itself is the affordance the user should see and click. It renders tab chrome you cannot remove.\nBoth TAB_VIEW and CONDITIONAL_VIEW take `preserveStateOnSwitch`, and it is the same mechanism in both: true keeps every case alive, so a scrolled list, a half-filled input or a loaded query survives switching away and back; false tears the inactive case down and rebuilds it from scratch. Both are created with it ON. Turn it off only when stale state would be wrong (a form that must reset), and remember the cost: every case stays mounted.\n\n### Components That Display a Field of Their Data\nDATA_SELECTOR and SELECT_VIEW name the field they display with `displayDataField`. Binding the dataSource is not enough \u2014 a DATA_SELECTOR or SELECT_VIEW whose data source resolves to a list of objects is invalid until its displayDataField is set. Set it with `UPDATE_COMPONENT_PROPERTIES`, passing the field's plain NAME as a string; the full field reference is resolved for you, so never hand-assemble one.\nLIST does not have a display field: its cell child component renders each row, and that content binds to the list's current item.\nThe candidates appear as selectableDataFields in `GET_COMPONENT_INFO` once the dataSource is bound \u2014 so the order is always: create \u2192 bind dataSource \u2192 read the component \u2192 name the field.\n\n### Page Data: Queries, Variables & Inputs\nPages have NO separate query list \u2014 a page query IS a read-only page variable whose dataSource is a database query. It is for data more than one component reads, or a filter the page owns centrally; a single list showing one filtered table binds that table itself (see Data Bindings below) and needs nothing here:\n- `ADD_COMPONENT_QUERY` attaches a table query to a PAGE or MODAL (limit 1 = single row, >1 = list). Components consume it through data bindings (bindings plugin) at the echoed dataSourceSchemaPath; narrow filters and sorting with the request-filter tools at that same path. The result also reports rolesWithoutSelect: those roles see no rows until they are granted SELECT with the permission plugin's table-permission tool. Tune with `UPDATE_COMPONENT_QUERY` \u2014 which also sets or clears the row limit of the query a LIST, SELECT_VIEW, DATA_SELECTOR or SHEET owns; remove queries and variables alike with `DELETE_COMPONENT_VARIABLES`.\n- When the page has to show changes other users make while it is open (a chat, a live dashboard, an order's status), make the query a subscription: queryType SUBSCRIPTION on `ADD_COMPONENT_QUERY` or `SET_SHEET_DATA_SOURCE`, or switch an existing page query, LIST or SHEET with `UPDATE_COMPONENT_QUERY`. Leave everything else a plain query.\n- Page-local mutable state: `ADD_COMPONENT_VARIABLES`, with each typeIdentifier picked from `GET_COMPONENT_VARIABLE_SELECTABLE_TYPES` \u2014 never hand-assembled. A new variable starts with no value, so give it an initial one at the `defaultValueSchemaPath` the result echoes whenever anything reads it: conditional cases, branch conditions and SET_VARIABLE_DATA values all test the variable against specific values, and none of them match an empty variable. The page then loads with every dependent case unmatched \u2014 blank labels, the fallback branch showing \u2014 and a toggle whose new value is itself conditional on the old one cannot recover, because it has nothing to match either.\n- Page parameters: `ADD_COMPONENT_INPUTS` / `UPDATE_COMPONENT_INPUT` / `DELETE_COMPONENT_INPUTS`. WEB pages take URL query/path params; WECHAT/MOBILE pages and MODALs take general inputs. Navigation and show-modal call sites pass one value per input. A URL_QUERY input can set `ignoreWhenEmpty` so an empty value is left out of the link instead of sent blank; `ADD_COMPONENT_INPUTS` and `UPDATE_COMPONENT_INPUT` both take it, and sending it for any other category is refused.\n- `SET_INITIAL_PAGE_ID` sets the app's home page for the current client.\n\n### SEO Path Ranges\nA WEB page's URL path parameters are its URL_PATH inputs. Under SSR/SSG each one needs a value range so the publisher can generate its URLs: literal values via `SET_SEO_PATH_STATIC_OPTIONS`, or database-backed values via `ADD_SEO_PATH_DB_QUERY` (the chosen column's values become the segments; narrow that source's rows with `GET_REQUEST_FILTER_CONTEXT` and the where tools its `whereTrack` names). Start from `GET_SEO_INFO` and read one page with `GET_SEO_PAGE_DETAIL`. Path ranges are hidden and ignored under CSR, so a CSR client has to switch rendering mode first: `SET_SEO_RENDERING_METHOD` handles CSR to SSG, while SSR is set in the project settings. Renaming a URL_PATH input migrates its range; deleting it removes the range.\n\n### Global SEO\nRendering mode, sitemap mode and robots.txt are client-wide, not per page. Read them with `GET_SEO_INFO`, then switch the mode with `SET_SEO_RENDERING_METHOD` or replace the robots file with `SET_SEO_ROBOTS_TXT`. The sitemap mode is not set directly: the editor derives it from the rendering mode (CSR \u2192 AUTO, SSG \u2192 BY_PATH_DATA, SSR keeps the current value). SSG needs the project's SEO capability \u2014 the tool refuses it when the capability data reports none and proceeds when that data is unavailable; SSR needs a single-tenant server, which the tool refuses because it cannot verify it \u2014 ask the user to switch that in the project settings. Leaving SSG clears the pages generated at publish time.\n\n### Data Bindings on Components\n`GET_COMPONENT_BINDABLE_PROPERTIES` lists every place a component can be bound \u2014 always start there and copy the paths verbatim, never hand-assemble a binding path. It returns two sections: `properties`, the component's own slots, each with its ready-to-use schemaPath, expected type, current binding and scope; and `actionSlots`, the parameter slots of the actions already wired to its events, chained success/failure branches included. `ADD_COMPONENT_ACTIONS` echoes an action's slots when it creates it \u2014 bind them in the same turn when you can, and use `actionSlots` to find them again in any later turn. Fill the echoed paths with the bindings plugin's tools: `BROWSE_DATA_BINDING_OPTIONS` + `CREATE_OPTION_BINDING` for dataSource slots and other dynamic values, `CREATE_CONST_BINDING` for literals. A LIST, SELECT_VIEW or DATA_SELECTOR can take its dataSource either way, and the options tree offers both in one answer: the tables under 'Table', and any page query under 'Context > Current page > Data source'. **Prefer the table** \u2014 a component that owns its data source is filtered, sorted and retyped in one place, and `GET_REQUEST_FILTER_CONTEXT` narrows it at the component's own path. Reach for a page query (`ADD_COMPONENT_QUERY` first) only when the SAME result set is genuinely shared \u2014 two components reading one query, or a filter the page tunes centrally. One component, one filtered list is not a sharing case: adding a page variable there buys nothing and leaves a second thing to keep in step. Inside a list cell (scope \"list-cell:<listId>\") the options tree additionally offers the current list item's fields under 'item-data' \u2014 bind cell children to those instead of re-querying the table.\n\n### Editing Protocol\n- One read of a container covers both adding children to it and editing its own configuration, so `GET_COMPONENT_INFO` and `GET_CONTAINER_CHILDREN_INFO` on the same component is one call wasted. After a conflict, re-read and retry.\n- Wiring behavior: `GET_COMPONENT_SELECTABLE_EVENTS`, then `GET_SELECTABLE_COMPONENT_ACTIONS` for what that event accepts, then `ADD_COMPONENT_ACTIONS`. Anything a specific kind returns beyond its bindableSchemaPaths arrives under that handler's `details`.\n- Pick the kind from `GET_SELECTABLE_COMPONENT_ACTIONS` and take its parameter shape from `ADD_COMPONENT_ACTIONS`'s parameter schema (fetch it first if it was left out as \"schema on request\"), which is the only complete list of the kinds and their fields \u2014 the editor offers far more than the handful named below, including SHOW_TOAST, OPEN_EXTERNAL_LINK, SET_CLIPBOARD, DOWNLOAD_FILE, CALL_PHONE, the payment kinds and the animation kinds. Do not conclude an interaction is impossible because it is not discussed here; the selectable list and the schema decide that. What follows is only the judgment the schema cannot carry.\n- ALERT_DIALOG is the runtime's own confirm box \u2014 a title, a message and two buttons it draws itself, with no MODAL to build or lay out. Use it for \"are you sure?\"; use SHOW_MODAL when the dialog needs your own components in it. Chain what confirming does onto ALERT_DIALOG's ON_CONFIRM branch, or the buttons do nothing.\n- Building a MODAL does not make it reachable. Without a SHOW_MODAL action pointing at it, nothing opens it, and the modal you just laid out is dead UI the user cannot reach.\n- An action that produces a RESULT \u2014 GET_LOCATION, UPLOAD_FILE, GENERATE_QR_CODE and the other result-bearing kinds \u2014 can only keep it through assignToVariable, a writable page variable created with `ADD_COMPONENT_VARIABLES` on the page the component sits on. Their success branches cannot see the result, so an action without assignToVariable runs and throws its answer away. Create the variable first.\n- Which sign-up / sign-in leaves GET_SELECTABLE_COMPONENT_ACTIONS offers follows the project's sign-in settings. When the one a request needs is missing there, the method is off: read GET_AUTHENTICATION_CONFIG_INFO and turn it on with UPDATE_AUTHENTICATION_CONFIG, then list the actions again. Ask the user before turning WeChat on, since it needs their AppID and AppSecret, and before turning off a method the app already uses.\n- SIGN_UP and USER_LOGIN are separate actions, and the password slot on a SIGN_UP decides what the account can sign in with later: leave it unbound and the account has no password, so a USER_LOGIN with credentialType PASSWORD can never succeed for anyone who signed up there. Build the pair together, or sign in with VERIFICATION_CODE.\n- A WeChat mini-program signs its user in by itself. The client is created with a silent WeChat login in its own app-did-load configuration, which the editor will not let anyone delete, so whoever opens the app is already signed in, and the account is created there too. Do NOT build a sign-in or sign-up screen there and do NOT wire a login action: USER_LOGIN offers no WeChat mode at all, the silent login belongs to that configuration alone, and SIGN_IN / SIGN_UP / SIGN_OUT are absent from the mini-program's selectable actions. When the app needs the user's phone number, use OBTAIN_PHONE_NUMBER.\n- MUTATION writes the database without an action flow. rolesWithoutPermission in its result is report-only \u2014 grant the table permission with the permission plugin or the write is denied at runtime, which looks like a silent no-op to the user. rowScope CURRENT_ITEM is valid only inside a LIST cell; refreshOnSuccess is preferable to a separate REFRESH. Once attached, `UPDATE_COMPONENT_MUTATION_ACTION` adds what the editor's panel configures beyond that: batch insert (one row per item of a list), per-column validation checks shown before the request is sent, and an insert's handling of a conflict on a unique or primary key. Reach for batch insert instead of a loop of single inserts, and for validation instead of a CONDITIONAL in front of the MUTATION.\n- CONDITIONAL is how ONE event does different things in different cases: branches in evaluation order, first match wins, each branch narrowed at the echoed conditionSchemaPath and filled by a further `ADD_COMPONENT_ACTIONS` carrying that branch's conditionalBranchId. Leave the last branch always-true as the else. Without it every action on the event fires on every click \u2014 ON_SUCCESS / ON_FAILURE branch on whether a call worked, never on a data condition. Do NOT reach for an action flow to get branching: a flow's BRANCH node runs on the server and cannot navigate, toast or open a modal, so frontend branching belongs here. This decides what HAPPENS; a CONDITIONAL_VIEW decides what is DISPLAYED.\n- There is no per-component conditional visibility \u2014 an ordinary component has no data-driven show/hide flag. To make content appear only when a condition holds, wrap it in a CONDITIONAL_VIEW container and gate the branch with the bindings plugin's condition tools.\n\n### Motion Is One Moment, Not A Coat Of Paint\nZion has animation as ACTIONS, not style fields, so they are attached with `ADD_COMPONENT_ACTIONS` like any other handler: ANIMATION_FADE_EFFECT and ANIMATION_SLIDE_EFFECT (APPEAR / DISAPPEAR, eight directions, a distance defaulting to 150px), ANIMATION_SCALE_EFFECT, ANIMATION_COMMON_EMPHASIS (BOUNCE / PULSE / BLINK), ANIMATION_FLIP_EMPHASIS, and ANIMATION_SCROLLING_INTERACTION. Each takes delay, and the emphasis kinds take repeat or loop.\nThe rules are hard ones, and breaking them shows up as a project error rather than a subtle defect: exactly ONE animation per event, and only on onClick, onHover or onScrollIntoPage \u2014 the runtime reads the last effect it finds on the event and ignores any attached elsewhere. ANIMATION_SCROLLING_INTERACTION is the exception and goes ONLY on onPageScroll, which carries nothing else at all, because the curve is driven by scroll distance. None of them take attachTo and none take bindings, so they cannot be chained onto a success branch.\nSpend motion the way you spend the accent. Movement that answers what a person just did \u2014 a press, an open, a confirm \u2014 is worth it, because it shows what changed. Movement that merely announces that content exists is the generated-page tell: a fade-and-slide on every section as it scrolls into view reads as a template, and it reads that way precisely because it is the first thing reached for. One orchestrated moment on the screen that matters beats an effect on every card, and a screen with no animation at all is a perfectly good answer \u2014 far better than one where everything twitches. The emphasis kinds earn their place on something genuinely needing attention, never as decoration, and BLINK almost never earns it.\n\n### Reading A Screenshot\nA `component capture-canvas` shows what the user will see, which `schema validate`, knowing only invalid schema, cannot. Take one when the request calls for seeing the screen: you built a screen the user will judge, or they asked about its look; a change that only adds or rewires something on an existing screen does not need one. Name the page with `--args '{\"pageId\":\"<id>\"}'`, adding `\"breakpoint\":\"phone\"` for the phone layout. It saves a PNG and prints its path: open that file to look at it. When it reports that no browser could be started, say that you could not see the screen rather than describing it. What it shows is worth reading against: one clear focal point rather than everything at the same weight; related things closer together than unrelated ones; at least three levels of text that differ in weight, not only size; gutters where things would otherwise touch an edge; on web, lines under ~70 characters and something that responds to hover; the accent only on the primary action and the active state; colour, spacing, radius, type and shadow values that are theme references, so a restyle reaches them. Report only what you actually changed. Every claim about appearance \u2014 a heading looks larger, a selected state looks different, spacing was tightened \u2014 must correspond to an `UPDATE_COMPONENT_STYLE` (or creation-time style) call you made in this session. If a requested look was not achievable with the available tools, say which part you skipped and why; do not describe the component's built-in default styling as if you had applied it. A user who is told the work is done stops checking.",database:`## Database Domain Knowledge
242
+ Product default timezone: **Asia/Shanghai** (UTC+08:00). A project can override it; the zone actually in effect is \`timezone\` in GET_PROJECT_OVERVIEW. Default UI language: Simplified Chinese (zh-CN).`,api:"## API Integration Domain Knowledge\nAn API integration is a saved external HTTP endpoint the project can use as a data source. APIs are organized into **workspaces**: a workspace groups related endpoints and holds shared **constants** (e.g. a base URL or API key) the endpoints reference, so credentials live in one place. The action-flow \"Call API\" node invokes these workspace APIs.\n\n### Anatomy\n- **Workspace**: a named group with a description and a set of `constants`.\n- **API**: an HTTP `method` + URL under a workspace, with request **parameters** (path / query / header / body), typed **response configs** (the result shape downstream binds from), and declared **input variables** (the values a caller supplies).\n\n### Workflow\nList with `GET_ALL_API_WORKSPACES` / `GET_ALL_APIS_INFO`, then `GET_API_DETAIL` to read an API's `apiId`, `workspaceId`, and parameter / response `uniqueId`s before editing \u2014 never fabricate them. Build top-down: `ADD_API_WORKSPACES` \u2192 `ADD_API_WORKSPACE_CONSTANTS` (put API keys / base URLs here, never inline) \u2192 `ADD_APIS` (each under a `workspaceId`) \u2192 `ADD_API_PARAMETERS`, `ADD_API_RESPONSE_CONFIGS`, `ADD_API_INPUT_VARIABLES`. Editing creates a new version; \"Sync Backend\" is required for changes to take effect in production.\n\n### Timeout\nEach API has a request `timeout` in seconds, 1 to 60, 30 when never set; ADD_APIS and UPDATE_API set it and GET_API_DETAIL reports it. Called from an action flow, the request is also cut off when the flow's own timeout runs out, whichever comes first, so raising an API's timeout helps only if the calling flow's timeout leaves room for it.\n\n### Request Bodies\nA body-carrying method needs a body FORMAT, and `SET_API_CONTENT_TYPE` is what sets it \u2014 `UPDATE_API` has no content-type argument and will reject one. `application/json` seeds an empty object type that belongs to this API; `GET_API_DETAIL` reports it as `bodyType`, and you describe it with the 'type' plugin's `ADD_TYPE_DEFINITION_FIELDS`. The two form formats take their fields from `ADD_API_PARAMETERS` instead. Every such switch DISCARDS the body that was there, so pick the format before filling it in \u2014 and never cycle the method away and back to force a reset, which throws the body parameters away with it.\n\nA media field, or an object field carried as a JSON string, cannot travel over HTTP as itself: it needs a conversion, and a media field left without one leaves the API incomplete. `GET_API_CODEC_OPTIONS` says which slots need one and what each allows; `SET_API_CODECS` applies it and `DELETE_API_CODECS` removes it.\n\n### Response Shapes\nA response config's type is what downstream reads the result through, and only an object type puts that result's fields where a binding can see and pick them. A JSON response still yields values \u2014 through the get-value-from-JSON formula \u2014 but the key path is a string you have to already know and spell by hand, nothing in the project lists what the payload holds, and a key that does not match it comes back empty rather than erroring; a text response does not even reach that formula. So whenever the endpoint documents what it returns \u2014 and it usually does \u2014 give the response a shape: `ADD_API_RESPONSE_CONFIGS` / `UPDATE_API_RESPONSE_CONFIGS` with `seedObjectType: true` mint an object type owned by this API and echo its `responseTypeId`, which you then describe with the 'type' plugin's `ADD_TYPE_DEFINITION_FIELDS`, exactly as you do a JSON request body. Add `arrayLevel: 1` where the endpoint returns a list of that shape. Reach for the JSON type only when the body's shape genuinely varies from call to call, and for text only when the response is not JSON at all (a 204 with no content, a plain-text body). A response status's `name` is an identifier \u2014 letters, digits and underscores only, never starting with a digit, and unique within the API \u2014 because it becomes a property of the API result that bindings read by name.\n\n### Types\nEvery `type` argument here is picked, not written: call `GET_API_SELECTABLE_TYPES` for the slot being filled and copy a returned `typeIdentifier` verbatim. A private object type belongs to the one feature that owns it and is never offered to another, so to reuse a shape some other feature owns, publish it with `PUBLISH_OBJECT_TYPE` \u2014 it keeps its id and becomes selectable \u2014 and pick it here. This API's own JSON body type is the exception \u2014 it is already this API's, so describe it in place with `ADD_TYPE_DEFINITION_FIELDS`. Lists are not enumerated \u2014 the nesting has no end \u2014 so a list response or input variable is a returned identifier plus `arrayLevel: 1`; the URL, header and form-body parameters hold one value, take no `arrayLevel`, and accept no list at all.",bindings:"## Data Binding Domain Knowledge\nData binding connects data sources to UI components for display or interaction.\n\n### Concepts\nSchema path: array of keys/indices locating a bindable node in the project JSON schema. Data binding options tree: hierarchical tree of all available data for a given schema path. Never hand-build a schema path for an action-flow node: copy it from the actionflow plugin's add_node result or get_flow_detail's nodeSchemaPaths (form: server/actionFlows/{i}/allNodes/{j}), then append key segments for the binding site inside the node. The binding-site key names VARY BY NODE TYPE (an AI node's input arg lives under inputArgs/<argKey>, a code node's under inputs/<index>/value, a mutation column under mutation/object/<columnName>) \u2014 copy the exact keys from the currentNode structure returned by get_context_info; never guess them.\nType metadata in read results uses exact typeIdentifier values such as `s:p:string` and `u:e:<enumId>`; copy those values verbatim.\n\n### Binding Kinds\nOPTION: bind to an existing path in the data binding options tree. pathInHierarchicalMenu must be the EXACT complete path, and menu labels are locale-dependent display names (a project may render them in Chinese or English) \u2014 so a label can NEVER be guessed. Before the first option binding at a schema path whose tree you have not seen, read it with `BROWSE_DATA_BINDING_OPTIONS` (CRITICAL: Do NOT call `get_options_tree` if the tree is already provided in the context above); afterwards every binding response attaches the refreshed tree for its op's path. Copy every label verbatim from that tree \u2014 never invent, translate, or shorten a label \u2014 and include every intermediate menu level. If the tree root is a named context (e.g., \"List Context\"), include it as the first element. CONST_VALUE: set a literal constant (e.g., \"Submit\", 0, false). FORMULA: compute a value with an operator (text / math / time / array / enum / geography / json groups); discover the available operators before building one. CONDITIONAL: choose the value by branch \u2014 define the branches, then build each branch's predicate.\n\n### Priority\n1. Prefer OPTION (live data) over CONST_VALUE.\n2. No suitable option? Use CONST_VALUE with a reasonable inferred constant.\n3. Component purpose unclear? Skip binding.\n4. A list NESTED INSIDE another list binds from the ancestor's item data, not from a table, so the relational linkage survives. This is about nesting only \u2014 a top-level list binds straight to the table it shows, and prefers that over consuming someone else's page query unless the result set is genuinely shared.\n5. Bind ONLY what the task requires: in an update/insert node's object leave every other column untouched \u2014 never fill it with a Null option or a placeholder constant (Null on a required column breaks the flow at runtime).\n6. Never seed a typed site with a throwaway constant \"for now\" and upgrade later \u2014 bind the real value directly; a constant re-types nothing but still wastes a round.\n7. To unset a bound value that no longer fits, clear it with `CLEAR_DATA_BINDING` rather than overwriting it with a placeholder.\n\n### Iterative Refinement\nPer-op errors are returned keyed by index. Successful bindings have already landed. On rejection, fix ONLY the failing entries by index and re-call.\n\n### Data Sources Available in Zion\nDatabase tables (with filters/sorting/limits), page data sources, page variables, global variables, page parameters, logged-in user, list/component item data, Actionflow inputs/outputs, formula results.\nThis is the product-wide catalog, NOT what is bindable at any given site \u2014 each site exposes only a subset. NEVER assume a category is available: the options tree for the site is authoritative, so read it with `BROWSE_DATA_BINDING_OPTIONS` first and bind only categories it actually lists. If one (e.g. formula data) is absent for that path, it is not valid there \u2014 do not attempt it. (Action flows run strictly on the backend, so page data sources never apply inside a flow node.)\n\n### Request Filters (where / sort)\nA database-query data source \u2014 a list/component request, or an action-flow query / update / delete node \u2014 carries **request filters**. FIRST call `GET_REQUEST_FILTER_CONTEXT` with the request's (or owning node's) schema path: it returns the table's selectable columns (with the `pathComponents` and `allowedOperators` to use) and the filter entries' `whereSchemaPath` / `sortConfigsSchemaPath`, each with a `whereTrack` saying which where tools apply. Copy those paths and column `pathComponents` verbatim \u2014 never hand-build them. Queries and component requests carry a LIST of conditional filters (where + sort groups, each gated by its own condition, always including a system Default filter). An action-flow update/delete node instead carries ONE bare where (`supportsConditionalFilters: false` in the context result) \u2014 edit it via the single entry's `whereSchemaPath` with the where-condition tools only; the filter-group and sort tools do not apply, and insert nodes have no request filter at all.\nTo change a numeric column RELATIVE to its current value (stock, counters, balances), set the column's write mode with `SET_UPDATE_COLUMN_ARITHMETIC` and bind only the DELTA as the column's value \u2014 the database applies it atomically. Never query the current value, compute in a formula, and set it back: that read-modify-write loses concurrent updates. Idiom \u2014 decrease field_a by x: mode 'decrement' on field_a, value x, and a where guard `field_a > x` (or `>= x` when draining to zero is allowed) so the update changes nothing when the stored value is insufficient. That rule generalizes to every mutation this plugin configures \u2014 frontend component mutation events and action-flow nodes alike: when a write's correctness depends on current row state, put the check in the mutation's own where filter and let follow-ups branch on its affected rows, instead of querying first and writing on the stale read (concurrent users race it). Insert-if-absent semantics additionally need a unique constraint \u2014 the only DB-enforced constraint kind today (see the database plugin).\n- Filter groups: `ADD_REQUEST_CONDITIONAL_FILTER` / `UPDATE_REQUEST_CONDITIONAL_FILTER` / `DELETE_REQUEST_CONDITIONAL_FILTER` / `REORDER_REQUEST_CONDITIONAL_FILTERS`. The Default filter cannot be renamed or deleted.\n- Where conditions, `whereTrack: WHERE_CONDITION` \u2014 every filter you add and every new query / update / delete node starts here: `INSERT_CONDITION_BOOL_EXP` at the entry's `whereSchemaPath` (an empty tree is filled in place), `UPDATE_EXPRESSION_CONDITION_OPERATOR` (operators from `GET_EXPRESSION_CONDITION_OPERATORS`), then bind the condition's `target` to the row's column with an OPTION from the options tree at that path and its `value` with a binding (OPTION / CONST_VALUE); shape the expression with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`, `DELETE_CONDITION_BOOL_EXP`.\n- Where conditions, `whereTrack: COLUMN_WHERE` \u2014 only filters written before the column style was retired; no new one can be created, so when the user asks for a column condition on a new filter or node, build the same comparison on `WHERE_CONDITION` and say so. To edit such an existing column filter: `ADD_REQUEST_FILTER_CONDITION` (column + operator), then fill its comparison value with a binding (OPTION / CONST_VALUE) at the condition's `value` path; shape the expression with `NEST_REQUEST_FILTER_CONDITION`, `TOGGLE_REQUEST_FILTER_CONDITION_AND_OR`, `TOGGLE_REQUEST_FILTER_CONDITION_NOT`, `UPDATE_REQUEST_FILTER_CONDITION_OPERATOR`, `DELETE_REQUEST_FILTER_CONDITION`.\n- Sort: `ADD_REQUEST_SORT_CONFIG` / `UPDATE_REQUEST_SORT_CONFIG` / `DELETE_REQUEST_SORT_CONFIG` / `REORDER_REQUEST_SORT_CONFIGS`.\n\n### Composing text from fragments and variables\nFor any `s:p:string` value that mixes literal fragments with variables \u2014 AI prompt templates, titles, labels, messages \u2014 do NOT build a stringConcat formula. Build the template at the same schema path with operation CONCAT: `CREATE_CONST_BINDING` for a literal fragment, `CREATE_OPTION_BINDING` for a variable. Each CONCAT appends to the end, so the final order is exactly the order you emit entries \u2014 within a call and across consecutive binding calls in the same turn. Emit them in final reading order, interleaving literals and variables \u2014 e.g. const_value \"Hello \", option user, const_value \", order \", option orderId, const_value \" total \", option amount. Never emit all literals then all variables (that puts every label before every variable), and two literal CONCATs in a row merge into one fragment. This produces the same inline template the editor's text fields produce and stays editable there. Reserve formulas for real computation (math, time, regex, arrays) \u2014 never for simple text templating.\nA number, boolean, date, time, datetime or color bound into a `s:p:string` slot is converted for display automatically, so bind the option straight to the slot \u2014 never wrap it in `toText` or any other conversion operator. Only structured values (lists, objects, media) genuinely need one. `BROWSE_DATA_BINDING_OPTIONS` marks an option with `*` only when the target really cannot take it; an unmarked option needs no conversion step.\n\n### Formula & Conditional Bindings\nA FORMULA or CONDITIONAL value is built in several steps at the value's schema path, not in a single call.\n- Formula: call `GET_FORMULA_OPERATORS` at the path, then `CREATE_FORMULA_BINDING` with an operator copied verbatim (the wire token, e.g. `-` not SUBTRACT; operation REPLACE). If the operator needs scalar config (e.g. distance unit, rounding mode), read its shape with `GET_FORMULA_CONFIG_OPTIONS` and pass it or apply it later with `SET_FORMULA_CONFIG`. The create result returns `operandSchemaPaths` \u2014 fill each operand with an OPTION / CONST_VALUE binding at its returned path, copied verbatim; never derive an operand path yourself. A `timezone` operand (e.g. on FORMAT_DATE_TIME) is optional: unbound, the project's default zone applies, so bind it only when the user asks for a specific zone or the viewer's own.\n- Conditional: `CREATE_CONDITIONAL_BINDING` (seed branches with initialBranchNames; operation REPLACE), add more with `INSERT_CONDITIONAL_DATA`. For each branch, build its predicate with `INSERT_CONDITION_BOOL_EXP`, choose the comparison via `GET_EXPRESSION_CONDITION_OPERATORS` + `UPDATE_EXPRESSION_CONDITION_OPERATOR`, fill both operands with OPTION / CONST_VALUE bindings, and shape the expression with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`, `DELETE_CONDITION_BOOL_EXP`; then bind the branch's resulting value. The first branch whose predicate is true wins \u2014 order them with `REORDER_CONDITIONAL_DATA`.\n- There is no string is-empty operator (`_is_empty` accepts lists only, and `\"\"` is not null): test text emptiness as `stringLength(x) > 0` via a formula binding on the operand.\n\n### Page links\nThe global page-link option binds a getPageUrl function binding with no target page, so the link points nowhere until you call `SET_FUNCTION_BINDING_PAGE_URL_TARGET` at the same schema path with the target page's id. Fill each parameter it returns under argSchemaPaths with an OPTION / CONST_VALUE binding at that path, copied verbatim.\n\n### Lists composed item by item\nTo give a list slot a literal list, bind the Custom > Array option at its schema path, then append items with `ADD_CUSTOM_ARRAY_BINDING_ITEMS` \u2014 a binding at an item index that does not exist yet is rejected, so an empty custom array can only grow through that tool. Fill each item it returns under itemSchemaPaths with an OPTION / CONST_VALUE binding, copied verbatim. For a list of lists, each item is a custom array of its own: call `ADD_CUSTOM_ARRAY_BINDING_ITEMS` again at the item's path. Remove items with `DELETE_CUSTOM_ARRAY_BINDING_ITEMS`.",component:"## Component Domain Knowledge\nThe UI is a tree of components organized into pages.\n\n### Identity & Tree Rules\nEvery component has an immutable id and a displayName. Reads return both; write tools verify the {id, displayName} pair and reject a mismatch \u2014 re-read, then retry. A container's children order IS the visual order. A component can never be moved into its own subtree.\n\n### Categories\nLayout (container \u2014 holds children via `children`):\n- PAGE: root of each page; created without a parent and registered as a new page.\n- LAYOUT_VIEW: generic Flexbox container; the most common container.\n- MODAL: popup/dialog container; created without a parent, opened/closed via events.\n\nSpecial (complex \u2014 children live in built-in slots seeded at creation and mutated only via the slot tools, never via ADD_COMPONENT / MOVE_COMPONENTS):\n- LIST: repeating list; its \"cell\" slot renders once per data row (optional header/footer).\n- TAB_VIEW: tabbed interface; one child view per tab in tabList.\n- SELECT_VIEW: built-in normal/selected state views.\n- CONDITIONAL_VIEW: one built-in view per condition branch.\n- MAP: optional \"marker\" slot taking a MAP_MARKER.\n\nEverything else is a leaf that cannot have children; MAP_MARKER only goes inside MAP. `GET_SELECTABLE_COMPONENT_TYPES` returns the full creatable catalog with each type's slot fields.\n\n### Hierarchy Rules\nEvery component except PAGE and MODAL must have a Layout Component as its parent. Prefer relative positioning; use absolute/fixed only when truly necessary.\n\n### Layout\nZion uses Flexbox. Layout containers configure: direction (row/column), justify-content (start, space-between, space-evenly, space-around), gap, wrap, overflow (scroll/visible/hidden).\n\n### Responsive Breakpoints\nPhone: 0\u2013767 px (375 px panel) | Tablet: 768\u20131279 px (820 px panel) | Desktop: 1280\u20131920 px (1440 px panel). Desktop is the primary breakpoint and the default for every read and write. A narrower breakpoint stores only its differences from desktop, so a field it does not override renders the desktop value there \u2014 an app built without touching phone is not unstyled on phone, it is desktop-sized, which is how a 600 px card runs off a 375 px screen. The schema and the error center do not show this; a read with `breakpoint` or a phone capture does, so look at phone when you build or restyle a layout the user will open on one. Read what phone resolves to by passing `breakpoint` to `GET_COMPONENT_INFO` and `GET_CONTAINER_CHILDREN_INFO`; the read names which fields that breakpoint overrides and which it inherits. Fix one by resending that field with the `breakpoint` param to `UPDATE_COMPONENT_STYLE` \u2014 usually flexDirection 'column' on rows, and widths in % or fill rather than px; a phone `component capture-canvas` shows the result. Resending a value unchanged at a breakpoint pins it there and stops it following desktop, so override only what has to differ.\n\n### Reading the Component Tree\nIds are opaque: copy them verbatim from these read tools and never modify them. A page id (from `GET_ALL_ROOTS_INFO`) is not a component id, and breakpoint keys (phone/tablet/desktop) are tool parameters, never part of an id \u2014 passing `<pageId>-desktop` as a target fails with \"target component not found\".\n\n### Building & Editing the Component Tree\nConstruction workflow: read the target container, pick types with `GET_SELECTABLE_COMPONENT_TYPES`, edit `GET_COMPONENT_TEMPLATE` output and submit it via `ADD_COMPONENT`, then use the ids it echoes instead of re-reading.\nContainer sizing: a LAYOUT_VIEW hugs its content, so a container created WITH its children inside is sized by them and needs no height of its own; an empty one keeps a small minimum height so it stays visible and droppable, and filling it makes that minimum irrelevant. Give a container an explicit height only for a fixed-size box or a scroll viewport \u2014 a fixed height its content outgrows clips that content invisibly, and a fixed width crops text mid-word. `UPDATE_COMPONENT_STYLE` merges, so a size you do not name keeps its old value.\nWidth/height `fill` means \"grow along the flex main axis\", so it only makes sense on the axis the parent lays out along: `width: fill` in a row, `height: fill` in a column. On the other axis it would unset the size and let the child shrink to its content, so it is applied as '100%' instead and the result says so. There is no `stretch` alignment to fall back on \u2014 in Zion a component declares its own size rather than having its container negotiate one.\nA row of cards is sized one axis at a time. Along the row, give every child `fill`, or fr shares \u2014 `65fr` and `35fr` \u2014 when the split is deliberate; never percentages, which claim the whole width and let the gap overflow it. Across the row, give every child the SAME `minHeight` so they bottom out together: a real `height` would clip the card whose content grows past it, and with no `stretch` a shared floor is as close to equal-height cards as this system gets; pick a floor that clears the tallest copy you expect. Set `minWidth` on a child only where that column has a genuine floor: it, not `flexWrap`, is what makes a row break into 2+1 once the container is narrower than the floors plus the gaps. Size the children this way and the container needs nothing beyond `flexDirection`, `gap` and its own width \u2014 `justifyContent` and `alignItems` have no free space left to distribute, so reaching for them to fix a ragged row means the children are the wrong size.\nA sentence clipped horizontally is nearly always `textWrap` false (see Typography below): widening the box, or setting `overflowX`, does not make the text reflow.\nA TEXT_INPUT collecting a password needs `password: true` via `UPDATE_COMPONENT_PROPERTIES`; a \"Password\" placeholder alone does not mask anything.\n\n### Bottom Navigation Is The Client's Tab Bar\nOn a mini-program or mobile client, the row of tabs along the bottom \u2014 Home / Categories / Cart / Me \u2014 is the client's native tab bar: a client setting the runtime draws itself, not components on a page. Whenever such an app has a few top-level sections the user moves between, that is a tab bar, whether or not the request says \"tab bar\" or \"bottom navigation\". Build it with one top-level PAGE per section, then `SET_TAB_BAR_ENABLED` and `UPDATE_TAB_BAR_ITEMS` in the same batch to point a slot at each page, icons from `component tab-bar-icons` \u2014 two to five tabs, one page per tab. Read `GET_TAB_BAR_INFO` first when the client may already have one. Do NOT build the bar out of components \u2014 not a LAYOUT_VIEW pinned to the bottom of each page, not a TAB_VIEW holding every section on one page: a component copy repeats on every page and drifts apart, and it is not the bar a mini-program user expects. Leave the bottom of each tab page free for the bar. Build one from components only when the user explicitly asks for a custom bar the native one cannot draw. A web client has no native tab bar; its navigation is components.\n\n### The Style Is Settled Before The First Component\nA client's look is written down in its DESIGN.md \u2014 `/project/DESIGN.md`, or `/project/app/<appExId>/DESIGN.md` in a multi-client project \u2014 and carried by the theme. When it exists, follow it; if its values disagree with the theme and the user has not said which wins, ask. A client without one gets its look when its first screen is about to be built, not as a question beforehand: the direction the user gave (words, a screenshot, a design, HTML), else the look its existing screens already have, else a recommended one for this kind of app \u2014 then the DESIGN.md and the theme are written, and the reply names the look used and what else is on offer, since the look is the user's to change. The platform's creation defaults are what produce the grey-box build, so a request that names no visual direction still gets one. Once settled, the style holds on every screen: a stated direction on two screens and another on the rest reads as a bug rather than a choice.\n\n### The Theme Is The Design System\nEvery style value that has a theme category is sent as that variable's referenceValue, `$$<id>`, never as a literal: colours (backgroundColor, textColor, borderColor, gradient stops, shadow.color) from colour variables, padding/margin/gap from spacings, borderRadius from radii, fontSize, fontWeight and fontFamily from their own categories, and a whole shadow as `shadow: {variable: '$$<id>'}`. The id resolves against the field's category, so `$$md` under padding is the spacing md and under borderRadius the radius md. A literal renders the same today but is pinned to the component it was written on; a reference follows the theme. That is the point: \"make it rounder\" or \"a different font\" is then a few `UPDATE_THEME_VARIABLES` edits every screen follows, instead of a sweep that touches every component and still misses some. Only lineHeight, letterSpacing, borderWidth, opacity and sizes have no category and stay literal.\nThat is the default, not a rule over the user:\n- A value the user gives for one component (\"make this button 13px\", \"this banner #ff6600\") is written as that literal on that component \u2014 not rounded to a variable, not turned into a new variable, and not applied by retuning a shared one. Ask when it is unclear whether they mean this component or the whole app.\n- Change only what the request touches; existing literals stay literal unless the user asks for the restyle.\n- Add a variable only for a value several components share, never for a one-off.\n`GET_THEME_INFO` shows what the theme holds: colour roles (Primary, Secondary, Tertiary, Text_primary, Text_secondary, Background, Surface, Border, Success, Alert, Error), font sizes h1 through caption that already shrink per breakpoint, weights 100\u2013900, radii sm\u2013full, spacings xs\u2013xl3 and shadows xs\u2013xl2 \u2014 and no font family. Retune those to the style DESIGN.md records rather than working around them, and add a variable only for a role the theme lacks.\nOn a web client a font size, radius or spacing variable holds one value per breakpoint (`{desktop, tablet, phone}`). When one must differ on phone \u2014 an h1 at 28 desktop, 24 phone \u2014 set that on the variable, not as a breakpoint override of fontSize, padding, gap or borderRadius on the components that reference it: an override replaces the reference, so the component stops following the theme there.\n\n### The Palette Is Named Before It Is Spent\nGive a new colour variable a palette level (the theme plugin explains which), not a hex, so it recolours with the rest. A working set is roughly eight roles, named by ROLE \u2014 \"surface\", not \"light-grey\":\n- Four neutrals: the page ground, a surface lifted off it, a border a step darker again, and a hairline weaker than the border. Two neutrals is the single most common cause of a flat screen: every card, input and divider drawn with the same one.\n- Two inks: primary for content, muted for secondary text and labels. Do NOT make muted text by dropping `opacity` on a TEXT \u2014 opacity fades the whole component and composites against what is behind it, so the same \"muted\" reads differently on a card than on the page. Muted is a colour.\n- One accent, and one status colour (danger) if the app writes data.\nSpend the accent only on the primary action and the active/selected state; the moment it also appears on a heading, an icon and a border, nothing is being pointed at.\n\n### A Text Role Is Three Values Sent Together\nThe theme has font sizes and weights but no line height and no combined text style, so a role \u2014 page title, section heading, body, label, caption, rarely more than five \u2014 is a pairing you keep yourself: a size variable, a weight variable and a lineHeight, sent together every time. A heading size at body weight is two roles blended. lineHeight is absolute px: a fontSize sent without it rewrites it to 1.2\xD7 the size rounded up (the result's note gives the px), which suits a heading, so send body copy's lineHeight, nearer 1.5\xD7, with its size. Display sizes shrink on phone while the lineHeight sent at the main breakpoint does not, so give a heading role a phone lineHeight too. For the same reason, changing a font size variable does not move the lineHeight of the text using it: in the same turn, re-send lineHeight (and the phone lineHeight) on every TEXT and BUTTON of that role, or the larger text crops and overlaps.\n\n### Typography Carries Most Of The Impression\nType is the largest coloured area on almost every screen, so it decides the character of the page before any accent does.\n- Typeface is a real choice: the default (DM Sans on web, pingFang SC on mobile) is the face every other project ships with. Choose by the type mood DESIGN.md records: reference the theme's FONT_FAMILIES variable when one fits, otherwise add one, and reference it as fontFamily on every TEXT, BUTTON and TEXT_INPUT \u2014 switching the face later is then one edit. `GET_THEME_INFO` lists the families this client offers under offeredFontFamilies, and only those have font files; any other name falls back to the system font. One family is a complete answer; two only when clearly distinct in role (a display face and a text face). Chinese copy needs a CJK BODY face, not just a CJK headline: a Latin family carries no Chinese glyphs, so every Chinese character falls back to the device font.\n- Hierarchy comes from weight and space as much as size: three roles that differ only in size read as one undifferentiated block, while a heading at 600\u2013700 against body at 400 separates at a glance.\n- `letterSpacing` is in PIXELS, not em, and goes NEGATIVE on large display type \u2014 roughly -0.5px at a 28\u201332px page title, -1px or beyond as the size grows \u2014 because a face designed at body size is too loose when set large. Body text wants 0. A fractional -0.02 changes nothing visible, so reporting the tracking as tightened after sending one is a false claim. It goes slightly POSITIVE only on small uppercase labels.\n- On a web client, set `maxWidth` on any TEXT holding a paragraph: unbounded body text stretches to the container and a 1200px line is unreadable however well styled. Hold it near 60\u201370 characters, roughly 600\u2013680px at body size. A capped column hugs the left edge until its PARENT centres it \u2014 in a column parent (a PAGE's default) that is `alignItems: 'center'`.\n- Body text needs `textWrap: true` \u2014 false pins it to one line and ellipsises it at the box edge however wide the sentence is. Add `lineClamp` when it must stop after N lines.\n\n### Depth Is One Decision, Applied Once\n- A card lifts off the page with EITHER a hairline border OR a soft shadow, not both. Pick one for the whole app.\n- Elevation is at most two levels \u2014 resting surface, and the raised thing (modal, dropdown, the one hero card) \u2014 so reference two of the theme's shadow variables and no more. A third level means the second is not doing its job.\n- A real shadow is large, soft and nearly transparent, offset downward only \u2014 light comes from above: `blur` well above `offsetY`, a colour at low alpha.\n- `inset: true` is for a button's pressed state and for a well an input sits in \u2014 the only correct way to make something look recessed.\n- `backdropBlur` belongs on overlay chrome over content \u2014 a sticky header, a modal scrim. On an ordinary card it costs paint and buys nothing.\n- `borderRadiusCorners` is for what a single radius cannot express: a segmented control, a sheet rounded only at the top, a cell at the end of a row. Nowhere else.\n- Radius is hierarchy. If the card, the input, the badge and the button all carry the same radius variable, nothing separates them.\n\n### Space Is The Cheapest Thing That Reads As Finished\nThe common failure is far too little of it. On a web desktop, section padding starts at 64px vertical and goes up; card padding is 20\u201324px; the page gutter sits at least two spacing steps above the in-card gap, so a card reads as sitting on the page rather than pasted onto it; the phone breakpoint drops sections to 24\u201332px and cards to 16px. A 375px mini-program or mobile screen keeps 16px side margins and 16px card padding, 8px inside a card, 12\u201316px between cards and 24\u201332px between sections \u2014 never the desktop 64 \u2014 with tap targets at least 44 \xD7 44. When a screen feels cramped, the fix is more space AROUND the groups, not less inside them. Proximity is the signal: things that belong together sit closer to each other than to anything else, and a label equidistant from its own field and the next one has lost the reader.\n\n### Every Interactive Thing Shows It Is One\nOn a web client `UPDATE_COMPONENT_STYLE` takes `variant: 'hover'`, and a build that never sends it is a build where nothing responds to the mouse. A hover state on buttons, clickable cards and list rows \u2014 a surface a step lighter or darker is enough \u2014 costs one extra call per component type, not per component. A LAYOUT_VIEW with an ON_CLICK handler still shows an arrow cursor until it gets `cursor: 'pointer'`, so the user cannot tell it is a target. A mini-program or mobile client has no cursor, so send no hover variant there: a tappable thing shows itself by shape \u2014 a fill or outline on a button, a trailing chevron on a row that opens something. On every client, style the selected state of a SELECT_VIEW or TAB_VIEW. The default selected state is not a design decision, and \"the active tab looks like the inactive ones\" is a bug the user will report in different words.\n\n### Three Things Can Be Conditional \u2014 Pick The Smallest One\nWhen a screen has two modes, do NOT reach for a conditional container first. Ask what actually differs, and make only that conditional:\n- Conditional DATA (`CREATE_CONDITIONAL_BINDING`) when only VALUES differ \u2014 a label, a title, a placeholder, a colour. One component, one conditional binding keyed off the deciding value. This is the default answer.\n- Conditional ACTION when only BEHAVIOR differs \u2014 one button that submits, signs in or signs up depending on the mode. One button, one handler that branches.\n- Conditional VIEW (CONDITIONAL_VIEW) only when the STRUCTURE differs \u2014 different fields, different counts of children. Branches do NOT share children, so anything in a branch is duplicated in every other branch: keep a shared form OUTSIDE the CONDITIONAL_VIEW and put only the differing part inside. Its branch conditions start always-true, so the first branch shows until you narrow them; make the mode a page variable the conditions read and change it with SET_VARIABLE_DATA.\nA switchable signup / login is therefore conditional data plus a conditional action over ONE shared form \u2014 not two branches each holding a copy of the same fields. Wrapping shared UI in branches is the classic wrong answer: it looks right and silently doubles the tree.\nTAB_VIEW is a different question: use it only when the tab strip itself is the affordance the user should see and click. It renders tab chrome you cannot remove.\nBoth TAB_VIEW and CONDITIONAL_VIEW take `preserveStateOnSwitch`: true keeps every case alive, so a scrolled list, a half-filled input or a loaded query survives switching away and back; false tears the inactive case down and rebuilds it. Both are created with it ON. Turn it off only when stale state would be wrong (a form that must reset), and remember the cost: every case stays mounted.\n\n### Components That Display a Field of Their Data\nDATA_SELECTOR and SELECT_VIEW name the field they display with `displayDataField`. Binding the dataSource is not enough \u2014 one whose data source resolves to a list of objects is invalid until its displayDataField is set. Set it with `UPDATE_COMPONENT_PROPERTIES`, passing the field's plain NAME as a string; the full field reference is resolved for you, so never hand-assemble one.\nLIST has no display field: its cell child renders each row, and that content binds to the list's current item.\nThe candidates appear as selectableDataFields in `GET_COMPONENT_INFO` once the dataSource is bound, so the order is always: create \u2192 bind dataSource \u2192 read the component \u2192 name the field.\n\n### Page Data: Queries, Variables & Inputs\nPages have NO separate query list \u2014 a page query IS a read-only page variable whose dataSource is a database query. It is for data more than one component reads, or a filter the page owns centrally; a single list showing one filtered table binds that table itself (see Data Bindings below):\n- `ADD_COMPONENT_QUERY` attaches a table query to a PAGE or MODAL (limit 1 = single row, >1 = list). Components consume it through data bindings at the echoed dataSourceSchemaPath; narrow filters and sorting with the request-filter tools at that same path. The result also reports rolesWithoutSelect: those roles see no rows until granted SELECT with the permission plugin's table-permission tool. Tune with `UPDATE_COMPONENT_QUERY` \u2014 which also sets or clears the row limit of the query a LIST, SELECT_VIEW, DATA_SELECTOR or SHEET owns; remove queries and variables alike with `DELETE_COMPONENT_VARIABLES`.\n- When the page has to show changes other users make while it is open (a chat, a live dashboard, an order's status), make the query a subscription: queryType SUBSCRIPTION on `ADD_COMPONENT_QUERY` or `SET_SHEET_DATA_SOURCE`, or switch an existing page query, LIST or SHEET with `UPDATE_COMPONENT_QUERY`. Leave everything else a plain query.\n- Page-local mutable state: `ADD_COMPONENT_VARIABLES`, each typeIdentifier picked from `GET_COMPONENT_VARIABLE_SELECTABLE_TYPES` \u2014 never hand-assembled. A new variable starts with no value, so give it an initial one at the echoed `defaultValueSchemaPath` whenever anything reads it: conditional cases, branch conditions and SET_VARIABLE_DATA values all test against specific values and none match an empty variable, so the page loads with every dependent case unmatched.\n- Page parameters: `ADD_COMPONENT_INPUTS` / `UPDATE_COMPONENT_INPUT` / `DELETE_COMPONENT_INPUTS`. WEB pages take URL query/path params; WECHAT/MOBILE pages and MODALs take general inputs; navigation and show-modal call sites pass one value per input. A URL_QUERY input can set `ignoreWhenEmpty` so an empty value is left out of the link instead of sent blank; both input tools take it, and sending it for any other category is refused.\n- `SET_INITIAL_PAGE_ID` sets the app's home page for the current client.\n\n### SEO Path Ranges\nA WEB page's URL path parameters are its URL_PATH inputs; under SSR/SSG each needs a value range so the publisher can generate URLs: literal values via `SET_SEO_PATH_STATIC_OPTIONS`, database-backed via `ADD_SEO_PATH_DB_QUERY` (the chosen column's values become the segments; narrow that source's rows with `GET_REQUEST_FILTER_CONTEXT` and the where tools its `whereTrack` names). Start from `GET_SEO_INFO`, then `GET_SEO_PAGE_DETAIL` for one page. Ranges are hidden and ignored under CSR \u2014 switch rendering mode first with `SET_SEO_RENDERING_METHOD` (CSR to SSG; SSR is a project setting). Renaming a URL_PATH input migrates its range; deleting it removes the range.\n\n### Global SEO\nRendering mode, sitemap mode and robots.txt are client-wide, not per page. Read them with `GET_SEO_INFO`; switch the mode with `SET_SEO_RENDERING_METHOD` or replace robots.txt with `SET_SEO_ROBOTS_TXT`. The sitemap mode is derived, not set: CSR \u2192 AUTO, SSG \u2192 BY_PATH_DATA, SSR keeps the current value. SSG needs the project's SEO capability \u2014 refused when the capability data reports none, allowed when that data is unavailable; SSR needs a single-tenant server and is always refused here, so ask the user to switch it in the project settings. Leaving SSG clears the pages generated at publish time.\n\n### Page SEO Fields\nPer-page SEO lives on the page's `PageSeoConfig`, not the client: TDK (seoTitle / seoDescription / seoKeywords), seoThumbnail (og:image), canonicalUrl, noindex, excludeFromSitemap, structuredData and sitemapLastmod. Static pages carry them too, so this is not path-range work. **Read first** with `GET_SEO_PAGE_DETAIL` \u2014 each field's binding kind and value, the structured-data shape, the lastmod source \u2014 then set only what is unset, never overwriting a configured field. noindex keeps the page out of search indexes but still reachable; excludeFromSitemap only drops it from the sitemap. A user center, search-result or draft page usually wants both; a crawlable page that should not compete in the sitemap wants excludeFromSitemap alone. canonicalUrl points search engines at the main URL of content reachable at more than one URL. These slots are data-binding leaves, not plain properties: take their schemaPaths from `GET_COMPONENT_BINDABLE_PROPERTIES` and write them with the bindings plugin's `CREATE_*_BINDING` tools, adding `ADD_CUSTOM_ARRAY_BINDING_ITEMS` first when structuredData has no items. Never pass `seoConfig` to a generic property-setting tool \u2014 it is refused, because a partial blob would drop the other fields. sitemapLastmod is not a binding (a fixed date or a table column) and has no write tool yet. Look types up with `GET_ALL_SEO_STRUCTURED_DATA_TYPES_INFO` and `GET_SEO_STRUCTURED_DATA_TYPE_DETAIL`. **Do not touch these fields unless the user asks for SEO** \u2014 an unrequested change to indexing is user-visible.\n\n### Data Bindings on Components\n`GET_COMPONENT_BINDABLE_PROPERTIES` lists every place a component can be bound \u2014 always start there and copy the paths verbatim, never hand-assemble one. It returns `properties`, the component's own slots, each with its ready-to-use schemaPath, expected type, current binding and scope; and `actionSlots`, the parameter slots of the actions already wired to its events, chained success/failure branches included. `ADD_COMPONENT_ACTIONS` echoes an action's slots when it creates it \u2014 bind them in the same turn when you can, and use `actionSlots` to find them again later. Fill the echoed paths with the bindings plugin's tools: `BROWSE_DATA_BINDING_OPTIONS` + `CREATE_OPTION_BINDING` for dataSource slots and other dynamic values, `CREATE_CONST_BINDING` for literals. A LIST, SELECT_VIEW or DATA_SELECTOR can take its dataSource either way, and the options tree offers both in one answer: the tables under 'Table', and any page query under 'Context > Current page > Data source'. **Prefer the table** \u2014 a component that owns its data source is filtered, sorted and retyped in one place, and `GET_REQUEST_FILTER_CONTEXT` narrows it at the component's own path. Reach for a page query (`ADD_COMPONENT_QUERY` first) only when the SAME result set is genuinely shared \u2014 two components reading one query, or a filter the page tunes centrally. One component, one filtered list is not a sharing case: a page variable there buys nothing and leaves a second thing to keep in step. Inside a list cell (scope \"list-cell:<listId>\") the options tree additionally offers the current list item's fields under 'item-data' \u2014 bind cell children to those instead of re-querying the table.\n\n### Editing Protocol\n- One read of a container covers adding children to it and editing its own configuration, so `GET_COMPONENT_INFO` and `GET_CONTAINER_CHILDREN_INFO` on the same component is one call wasted. After a conflict, re-read and retry.\n- Wiring behavior: `GET_COMPONENT_SELECTABLE_EVENTS`, then `GET_SELECTABLE_COMPONENT_ACTIONS` for what that event accepts, then `ADD_COMPONENT_ACTIONS`. Anything a kind returns beyond its bindableSchemaPaths arrives under that handler's `details`.\n- Pick the kind from `GET_SELECTABLE_COMPONENT_ACTIONS` and its parameter shape from `ADD_COMPONENT_ACTIONS`'s parameter schema (fetch it first if it was left out as \"schema on request\") \u2014 the only complete list of kinds and fields. The editor offers far more than the handful named below \u2014 SHOW_TOAST, OPEN_EXTERNAL_LINK, SET_CLIPBOARD, DOWNLOAD_FILE, CALL_PHONE, the payment and animation kinds \u2014 so do not conclude an interaction is impossible because it is not discussed here. What follows is only the judgment the schema cannot carry.\n- ALERT_DIALOG is the runtime's own confirm box \u2014 title, message and two buttons it draws itself, no MODAL to build. Use it for \"are you sure?\"; use SHOW_MODAL when the dialog needs your own components. Chain what confirming does onto its ON_CONFIRM branch, or the buttons do nothing.\n- Building a MODAL does not make it reachable: without a SHOW_MODAL action pointing at it, nothing opens it and the modal is dead UI.\n- An action that produces a RESULT \u2014 GET_LOCATION, UPLOAD_FILE, GENERATE_QR_CODE and the other result-bearing kinds \u2014 keeps it only through assignToVariable, a writable page variable created with `ADD_COMPONENT_VARIABLES` on the page the component sits on. Their success branches cannot see the result, so without assignToVariable the action throws its answer away. Create the variable first.\n- Which sign-up / sign-in leaves GET_SELECTABLE_COMPONENT_ACTIONS offers follows the project's sign-in settings. When the one a request needs is missing, the method is off: read GET_AUTHENTICATION_CONFIG_INFO and turn it on with UPDATE_AUTHENTICATION_CONFIG, then list again. Ask the user before turning WeChat on (it needs their AppID and AppSecret) and before turning off a method the app already uses.\n- SIGN_UP and USER_LOGIN are separate actions, and the password slot on a SIGN_UP decides what the account can sign in with later: leave it unbound and the account has no password, so USER_LOGIN with credentialType PASSWORD can never succeed for anyone who signed up there. Build the pair together, or sign in with VERIFICATION_CODE.\n- A WeChat mini-program signs its user in by itself: the client is created with a silent WeChat login in its own app-did-load configuration, which the editor will not let anyone delete, so whoever opens the app is already signed in and the account is created there. Do NOT build a sign-in or sign-up screen or wire a login action: USER_LOGIN offers no WeChat mode, the silent login belongs to that configuration alone, and SIGN_IN / SIGN_UP / SIGN_OUT are absent from the mini-program's selectable actions. When the app needs the phone number, use OBTAIN_PHONE_NUMBER.\n- MUTATION writes the database without an action flow. rolesWithoutPermission in its result is report-only \u2014 grant the table permission with the permission plugin or the write is denied at runtime, which looks like a silent no-op. rowScope CURRENT_ITEM is valid only inside a LIST cell; refreshOnSuccess beats a separate REFRESH. `UPDATE_COMPONENT_MUTATION_ACTION` adds what the editor's panel configures: batch insert (one row per list item), per-column validation checks shown before the request, and an insert's conflict handling on a unique or primary key. Prefer batch insert to a loop of single inserts, and validation to a CONDITIONAL in front of the MUTATION.\n- CONDITIONAL is how ONE event does different things in different cases: branches in evaluation order, first match wins, each narrowed at the echoed conditionSchemaPath and filled by a further `ADD_COMPONENT_ACTIONS` carrying that branch's conditionalBranchId. Leave the last branch always-true as the else. Without it every action on the event fires on every click \u2014 ON_SUCCESS / ON_FAILURE branch on whether a call worked, never on a data condition. Do NOT reach for an action flow to get branching: a flow's BRANCH node runs on the server and cannot navigate, toast or open a modal. This decides what HAPPENS; a CONDITIONAL_VIEW decides what is DISPLAYED.\n- There is no per-component conditional visibility \u2014 an ordinary component has no data-driven show/hide flag. To show content only when a condition holds, wrap it in a CONDITIONAL_VIEW and gate the branch with the bindings plugin's condition tools.\n\n### Motion Is One Moment, Not A Coat Of Paint\nZion has animation as ACTIONS, not style fields, so they are attached with `ADD_COMPONENT_ACTIONS` like any other handler: ANIMATION_FADE_EFFECT and ANIMATION_SLIDE_EFFECT (APPEAR / DISAPPEAR, eight directions, a distance defaulting to 150px), ANIMATION_SCALE_EFFECT, ANIMATION_COMMON_EMPHASIS (BOUNCE / PULSE / BLINK), ANIMATION_FLIP_EMPHASIS, and ANIMATION_SCROLLING_INTERACTION. Each takes delay; the emphasis kinds take repeat or loop.\nBreaking these rules shows up as a project error rather than a subtle defect: exactly ONE animation per event, and only on onClick, onHover or onScrollIntoPage \u2014 the runtime reads the last effect on the event and ignores any attached elsewhere. ANIMATION_SCROLLING_INTERACTION is the exception: it goes ONLY on onPageScroll, which carries nothing else, because the curve is driven by scroll distance. None take attachTo and none take bindings, so they cannot be chained onto a success branch.\nSpend motion the way you spend the accent. Movement that answers what a person just did \u2014 a press, an open, a confirm \u2014 is worth it, because it shows what changed. Movement that merely announces that content exists is the generated-page tell: a fade-and-slide on every section reads as a template. One orchestrated moment on the screen that matters beats an effect on every card, and no animation at all is a perfectly good answer. The emphasis kinds are for something genuinely needing attention, never decoration, and BLINK almost never earns it.\n\n### Reading A Screenshot\nA `component capture-canvas` shows what the user will see, which `schema validate`, knowing only invalid schema, cannot. Take one when the request calls for seeing the screen: you built a screen the user will judge, or they asked about its look; a change that only adds or rewires something on an existing screen does not need one. Name the page with `--args '{\"pageId\":\"<id>\"}'`, adding `\"breakpoint\":\"phone\"` for the phone layout. It saves a PNG and prints its path: open that file to look at it. When it reports that no browser could be started, say that you could not see the screen rather than describing it. Read it against: one clear focal point rather than everything at the same weight; related things closer together than unrelated ones; at least three levels of text that differ in weight, not only size; gutters where things would otherwise touch an edge; on web, lines under ~70 characters and something that responds to hover; the accent only on the primary action and the active state; colour, spacing, radius, type and shadow values that are theme references, so a restyle reaches them. Report only what you actually changed. Every claim about appearance \u2014 a heading looks larger, a selected state looks different, spacing was tightened \u2014 must correspond to an `UPDATE_COMPONENT_STYLE` (or creation-time style) call you made in this session. If a requested look was not achievable with the available tools, say which part you skipped and why; do not describe a component's built-in default styling as if you had applied it.",database:`## Database Domain Knowledge
243
243
  Zion uses PostgreSQL. Data model changes require "Sync Backend" to take effect online.
244
244
 
245
245
  ### Capabilities & Limitations
@@ -456,7 +456,7 @@ go over HTTP, and a media field without one leaves the webhook incomplete.
456
456
  GET_CALLBACK_CODEC_OPTIONS lists exactly which slots of the request and response bodies need one
457
457
  and which conversions each allows; feed a slot's \`typeIdentifier\` / \`field\` back to
458
458
  SET_CALLBACK_CODECS verbatim, and DELETE_CALLBACK_CODECS to remove one. A slot is a field of a type,
459
- not a path \u2014 the same object type reused twice shares one conversion.`,zai:'## AI Agent (ZAI) Domain Knowledge\nA ZAI config is an LLM-backed agent the app runs via a "Run AI" action / action-flow node (asynchronous only). An agent has a name + description, a model, sampling settings (temperature, maxRound, max output tokens), a system + user **prompt**, and its **output**.\n\n### Reading\n`GET_ZAI_MODEL_OPTIONS` returns the models currently selectable in this project. `GET_ALL_ZAI_CONFIGS_INFO` summarizes every agent; `GET_ZAI_CONFIG_DETAIL` returns one agent\'s full config \u2014 its input args (with their map keys), its prompt components each with the **schema path** of its text binding, its output config and structured-output fields, its database/API contexts (with the query schema paths for the request-filter tools), its knowledge base, and its callable tools.\n\n### Creating & editing\n`ADD_ZAI_CONFIGS` seeds an agent with default empty system + user prompts and plain-text output; adding the first agent also provisions the AI conversation tables/relations/permissions. Edit scalar config (name, description, temperature, maxRound) with `UPDATE_ZAI_CONFIG`. The **model** is required when creating an agent and can be changed via `UPDATE_ZAI_CONFIG`. Call `GET_ZAI_MODEL_OPTIONS` first. If the user did not name a model, choose a selectable model whose capabilities fit the request; prefer the one whose `defaultModel` is true, which matches the editor\'s default. Only models the deployment ships as SYSTEM ever carry that marker \u2014 a project whose catalog is all custom models has none, so treat it as a tie-breaker rather than the thing you look for. Copy its exact `customModelIdentifier` ({id, namespace}). Never fabricate or omit the identifier.\n\n### Running an agent\nA prompt that reads well is not a prompt that works, and structured output is where the difference usually shows; each run is a real model call against the project\'s AI allowance. Inside the editor, `zai.debug_chat` runs the DRAFT agent with the input arguments you give it and returns each turn\'s output \u2014 the same debug run the editor\'s agent tester performs. It needs the editor\'s draft, so it is unavailable outside it; from elsewhere, invoke the DEPLOYED agent through the runtime API instead. Either way each run is a real model call against the project\'s AI allowance, so choose the inputs deliberately rather than looping.\n\n`structuredOutput: true` in `GET_ZAI_MODEL_OPTIONS` is what the model\'s descriptor claims, not something the platform enforces. A model advertising it can still answer with the JSON Schema envelope it was handed instead of an instance of it \u2014 `{"type":"object","properties":{\u2026}}` where you expected `{"scene":"\u2026"}` \u2014 and nothing downstream rejects that, so the agent looks configured and every consumer of its output is wrong. Read one real answer before building on the shape.\n\n### Prompts are bindings, not a ZAI tool\nA prompt\'s text is an ordinary data binding. Read its `valueSchemaPath` from `GET_ZAI_CONFIG_DETAIL` and edit it with the bindings plugin (the CREATE_*_BINDING tools) at that path \u2014 there is no ZAI prompt-edit tool.\n\nAn agent\'s own input args are not top-level options: they hang off `Input`, so the menuPath is `["Context", "Input", "<arg name>"]`, beside `Logged in user` and `Current time`. Binding `["Context", "<arg name>"]` fails with "Can not find option \u2026 in [Logged in user, Current time, Input]", which reads like the arg does not exist rather than like it is one level further down. `BROWSE_DATA_BINDING_OPTIONS` renders the arg under `Input`, but read the level off its menuPath rather than off the indentation.\n\n### System AI conversation tables\nCreating the first agent provisions four protected system tables that store agent runs. They are platform-managed (read-only \u2014 never add fields to or edit them; for a user-facing chat feature build your own tables instead). Their individual roles, in a 1:n chain:\n- `conversation` \u2014 a chat thread with an agent, owned by an account (account \u2192 conversations).\n- `message` \u2014 one turn within a conversation (conversation \u2192 messages); also linked to its account.\n- `message_content` \u2014 a single content block of a message: text or media, image / video / file (message \u2192 contents).\n- `tool_usage_record` \u2014 a record of one tool call made while producing a message, including any error (message \u2192 tool_calls).\n\n### Giving the agent context (what it can read)\nBeyond its prompt, an agent reads context \u2014 all shown by `GET_ZAI_CONFIG_DETAIL`:\n- **Database tables** \u2014 `ADD_ZAI_CONFIG_DB_CONTEXTS` (`UPDATE_ZAI_CONFIG_DB_CONTEXT` / `DELETE_ZAI_CONFIG_DB_CONTEXTS`). Each is a per-table query with column/relation selection; narrow which rows it sees by editing the query\'s `filters` with the request-filter tools at the `querySchemaPath` from `GET_ZAI_CONFIG_DETAIL`.\n- **Knowledge base** \u2014 existing knowledge-base files and retrieval settings are shown by `GET_ZAI_CONFIG_DETAIL`, but Copilot cannot mutate them. Ask the user to manage them in the editor.\n- **External APIs** \u2014 workspace HTTP APIs, via `ADD_ZAI_CONFIG_API_CONTEXTS` (`UPDATE_ZAI_CONFIG_API_CONTEXT` / `DELETE_ZAI_CONFIG_API_CONTEXTS`).\n\n### Giving the agent tools (what it can call)\n`ADD_ZAI_CONFIG_TOOLS` lets the agent call action flows, external APIs, or other agents (`UPDATE_ZAI_CONFIG_TOOL` / `DELETE_ZAI_CONFIG_TOOLS`). Tune a callable tool\'s per-input descriptions with `UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS`.\n### Passing a list into a list-typed input arg\nTo declare a list input, choose a base type from `GET_ZAI_CONFIG_SELECTABLE_TYPES` and set `arrayLevel: 1` (or `arrayLevel: 2` for a list of lists). Fill it where the agent is invoked. In the calling action flow\'s Run-AI node, bind it with an **array-mapping** formula at the input\'s schema path. The agent then runs once over the whole list.\n### Typed input args & output\nDeclare typed inputs with `ADD_ZAI_CONFIG_INPUT_ARGS` (and `UPDATE_ZAI_CONFIG_INPUT_ARGS` / `DELETE_ZAI_CONFIG_INPUT_ARGS`). Each\narg\'s `type` is a `typeIdentifier` copied verbatim from `GET_ZAI_CONFIG_SELECTABLE_TYPES` \u2014 primitives, tables,\nand custom object/enum types are all selectable; `arrayLevel` wraps it as a list (1) or list-of-lists\n(2), for any element type (a list of image is the common multi-image intake \u2014 see "Passing a list into\nan input arg" above). Configure output with `UPDATE_ZAI_CONFIG_OUTPUT`: `isStructured=false` for plain streamed text, or\n`isStructured=true` with an `outputType` (a `typeIdentifier` from `GET_ZAI_CONFIG_SELECTABLE_TYPES`) for a typed\nobject \u2014 for a bespoke object shape, define the object type first with the type-system tools, then\nselect its `typeIdentifier`.'},jg={"query-language":`## Querying Zion data (auto-generated GraphQL over PostgreSQL)
459
+ not a path \u2014 the same object type reused twice shares one conversion.`,zai:'## AI Agent (ZAI) Domain Knowledge\nA ZAI config is an LLM-backed agent the app runs via a "Run AI" action / action-flow node (asynchronous only). An agent has a name + description, a model, sampling settings (temperature, maxRound, max output tokens), a system + user **prompt**, and its **output**.\n\n### Reading\n`GET_ZAI_MODEL_OPTIONS` returns the models currently selectable in this project. `GET_ALL_ZAI_CONFIGS_INFO` summarizes every agent; `GET_ZAI_CONFIG_DETAIL` returns one agent\'s full config \u2014 its input args (with their map keys), its prompt components each with the **schema path** of its text binding, its output config and structured-output fields, its database/API contexts (with the query schema paths for the request-filter tools), its knowledge base, and its callable tools.\n\n### Creating & editing\n`ADD_ZAI_CONFIGS` seeds an agent with default empty system + user prompts and plain-text output; adding the first agent also provisions the AI conversation tables/relations/permissions. Edit scalar config (name, description, temperature, maxRound) with `UPDATE_ZAI_CONFIG`. The **model** is required when creating an agent and can be changed via `UPDATE_ZAI_CONFIG`. Call `GET_ZAI_MODEL_OPTIONS` first. If the user did not name a model, choose a selectable model whose capabilities fit the request; prefer the one whose `defaultModel` is true, which matches the editor\'s default. Only models the deployment ships as SYSTEM ever carry that marker \u2014 a project whose catalog is all custom models has none, so treat it as a tie-breaker rather than the thing you look for. Copy its exact `customModelIdentifier` ({id, namespace}). Never fabricate or omit the identifier.\n\n### Running an agent\nA prompt that reads well is not a prompt that works, and structured output is where the difference usually shows; each run is a real model call against the project\'s AI allowance. Inside the editor, `zai.debug_chat` runs the DRAFT agent with the input arguments you give it and returns each turn\'s output \u2014 the same debug run the editor\'s agent tester performs. It needs the editor\'s draft, so it is unavailable outside it; from elsewhere, invoke the DEPLOYED agent through the runtime API instead. Either way each run is a real model call against the project\'s AI allowance, so choose the inputs deliberately rather than looping.\n\n`structuredOutput: true` in `GET_ZAI_MODEL_OPTIONS` is what the model\'s descriptor claims, not something the platform enforces. A model advertising it can still answer with the JSON Schema envelope it was handed instead of an instance of it \u2014 `{"type":"object","properties":{\u2026}}` where you expected `{"scene":"\u2026"}` \u2014 and nothing downstream rejects that, so the agent looks configured and every consumer of its output is wrong. Read one real answer before building on the shape.\n\n### Prompts are bindings, not a ZAI tool\nA prompt\'s text is an ordinary data binding. Read its `valueSchemaPath` from `GET_ZAI_CONFIG_DETAIL` and edit it with the bindings plugin (the CREATE_*_BINDING tools) at that path \u2014 there is no ZAI prompt-edit tool.\n\nAn agent\'s own input args are not top-level options: they hang off `Input`, so the menuPath is `["Context", "Input", "<arg name>"]`, beside `Logged in user` and `Current time`. Binding `["Context", "<arg name>"]` fails with "Can not find option \u2026 in [Logged in user, Current time, Input]", which reads like the arg does not exist rather than like it is one level further down. `BROWSE_DATA_BINDING_OPTIONS` renders the arg under `Input`, but read the level off its menuPath rather than off the indentation.\n\n### System AI conversation tables\nCreating the first agent provisions four protected system tables that store agent runs. They are platform-managed (read-only \u2014 never add fields to or edit them; for a user-facing chat feature build your own tables instead). Their individual roles, in a 1:n chain:\n- `conversation` \u2014 a chat thread with an agent, owned by an account (account \u2192 conversations).\n- `message` \u2014 one turn within a conversation (conversation \u2192 messages); also linked to its account.\n- `message_content` \u2014 a single content block of a message: text or media, image / video / file (message \u2192 contents).\n- `tool_usage_record` \u2014 a record of one tool call made while producing a message, including any error (message \u2192 tool_calls).\n\n### Giving the agent context (what it can read)\nBeyond its prompt, an agent reads context \u2014 all shown by `GET_ZAI_CONFIG_DETAIL`:\n- **Database tables** \u2014 `ADD_ZAI_CONFIG_DB_CONTEXTS` (`UPDATE_ZAI_CONFIG_DB_CONTEXT` / `DELETE_ZAI_CONFIG_DB_CONTEXTS`). Each is a per-table query with column/relation selection; narrow which rows it sees by editing the query\'s `filters` with the request-filter tools at the `querySchemaPath` from `GET_ZAI_CONFIG_DETAIL`.\n- **Knowledge base** \u2014 existing knowledge-base files and retrieval settings are shown by `GET_ZAI_CONFIG_DETAIL`, but Copilot cannot mutate them. Ask the user to manage them in the editor.\n- **External APIs** \u2014 workspace HTTP APIs, via `ADD_ZAI_CONFIG_API_CONTEXTS` (`UPDATE_ZAI_CONFIG_API_CONTEXT` / `DELETE_ZAI_CONFIG_API_CONTEXTS`).\n\n### Giving the agent tools (what it can call)\n`ADD_ZAI_CONFIG_TOOLS` lets the agent call action flows, external APIs, or other agents (`UPDATE_ZAI_CONFIG_TOOL` / `DELETE_ZAI_CONFIG_TOOLS`). Tune a callable tool\'s per-input descriptions with `UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS`.\n### Passing a list into a list-typed input arg\nTo declare a list input, choose a base type from `GET_ZAI_CONFIG_SELECTABLE_TYPES` and set `arrayLevel: 1` (or `arrayLevel: 2` for a list of lists). Fill it where the agent is invoked. In the calling action flow\'s Run-AI node, bind it with an **array-mapping** formula at the input\'s schema path. The agent then runs once over the whole list.\n### Typed input args & output\nDeclare typed inputs with `ADD_ZAI_CONFIG_INPUT_ARGS` (and `UPDATE_ZAI_CONFIG_INPUT_ARGS` / `DELETE_ZAI_CONFIG_INPUT_ARGS`). Each\narg\'s `type` is a `typeIdentifier` copied verbatim from `GET_ZAI_CONFIG_SELECTABLE_TYPES` \u2014 primitives, tables,\nand custom object/enum types are all selectable; `arrayLevel` wraps it as a list (1) or list-of-lists\n(2), for any element type (a list of image is the common multi-image intake \u2014 see "Passing a list into\nan input arg" above). Configure output with `UPDATE_ZAI_CONFIG_OUTPUT`: `isStructured=false` for plain streamed text, or\n`isStructured=true` with an `outputType` (a `typeIdentifier` from `GET_ZAI_CONFIG_SELECTABLE_TYPES`) for a typed\nobject \u2014 for a bespoke object shape, define the object type first with the type-system tools, then\nselect its `typeIdentifier`.'},Gg={"query-language":`## Querying Zion data (auto-generated GraphQL over PostgreSQL)
460
460
  The schema is generated from the data model. Every name and type derived from a table follows
461
461
  from the rules below and what the data-model read reports for it \u2014 each column's apiName and
462
462
  type, each relation, each unique constraint's name (the primary key's is [table]_pkey) \u2014 so a
@@ -699,7 +699,7 @@ getImageListByIds(imageIds:_int8){ id exId url urlInfo{ urlExpireAt } } \u2014 e
699
699
  getImageListByExIds(imageExIds:[String]) \u2014 then rewrite each src. Cache by urlExpireAt and
700
700
  never write a resolved URL back into the column. Writing is the mirror image: upload through
701
701
  the two-step above, then emit src="fz_image_<imageId>". An external URL left in the body is
702
- stored verbatim and leaves the picture depending on a host nobody here controls.`};u();function Gg(t){let e=wr[t];if(!e)throw new Error(`No guide available for '${t}'.`);return e}var ye={projectExId:c.string().optional().describe("The project to act on. Defaults to the project set by set_current_project."),appExId:c.string().nullable().optional().describe("A client app INSIDE the project (web / WeChat mini program / mobile) \u2014 never the project's own exId. Leave unset for the project's current client, pinned by create_project / set_current_project: that session holds the client's pages and the project's backend, which is what UI work needs. Pass null for the project's own document alone \u2014 its backend. Other values come from project metadata \u2192 apps[], entries whose appExId is non-null (the null entry is the project itself). A session reaches one client; a sibling client's pages live in another document, so re-pin to work on it."),appVersionExId:c.string().nullable().optional().describe("A specific version of the app named by appExId. Leave unset for the current version.")},Os=t=>({content:[{type:"text",text:t.ok?t.message??JSON.stringify(t.data??{},null,2):JSON.stringify({error:t.error??"Unknown error",data:t.data},null,2)}],isError:!t.ok}),Do=(t,e,n,r,o)=>{t.registerTool(e,{description:n,inputSchema:r},o)},Zg=(t,e,n)=>{for(let r of e)Do(t,r.name,r.description,r.inputSchema??{},async(o,a)=>Os(await n({name:r.command,args:o},a.signal)))},Bg=(t,e,n)=>{for(let r of e){let{ops:o}=r,a={op:c.enum(Object.keys(o)),...r.inputSchema??{}};Do(t,r.name,r.description,a,async(s,i)=>{let{op:l,...d}=s;return Os(await n({name:o[String(l)],args:d},i.signal))})}};var WP=t=>({content:[{type:"text",text:t}],isError:!1});var qg=(t,e,n)=>{for(let r of e){let o={...ye,op:c.enum(r.ops),args:c.record(c.any()).optional()};Do(t,r.name,r.description,o,async(a,s)=>{let{op:i,projectExId:l,appExId:d,appVersionExId:h,args:p}=a;return Os(await n({name:"schema.ztype_tool_calls",args:{projectExId:l,appExId:d,appVersionExId:h,toolCalls:[{toolCallId:`${r.name}-${String(i)}-${Date.now()}`,name:String(i),args:p??{}}]}},s?.signal))})}},Vg=t=>{let e=Object.keys(wr);Do(t,"guide","Load the domain guide for a backend capability \u2014 the rules, conventions, and gotchas for a plugin area (database, type, bindings, actionflow, api, zai, component, permissions, payments, logs, agent). Call before editing an unfamiliar area, or when a meta-tool call is rejected.",{plugin:c.enum(e)},async n=>WP(Gg(String(n.plugin))))},Wg=(t,e)=>{Do(t,"agent_command","Advanced escape hatch for directly invoking an internal agent command.",{name:c.string(),args:c.record(c.any()).optional()},async(n,r)=>Os(await e({name:String(n.name),args:n.args??{}},r.signal)))};u();var Ns=[{name:"schema_action_menu",tier:"catalog",description:"\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=GET_SELECTABLE_COMPONENT_ACTIONS \u2014 The frontend actions attachable to a component event, as the same category tree the editor's action picker shows \u2014 already filtered to this client's platform, what this product ships, the project's configured authentication, and what the event accepts. A few actions belong to one product only, so an absence can mean that rather than a missing capability. Each leaf carries the `eventType` it resolved to here (a leaf like SIGN_IN becomes whichever login the project configured) and the `path` to address it. A leaf's `kind` is what you send to ADD_COMPONENT_ACTIONS to attach it. A leaf with no `kind` cannot be attached by that tool at all \u2014 say so and let the user add it in the editor, rather than attaching some other action that looks close. `kind` is necessary but not sufficient: several leaves share one kind (SIGN_IN and SIGN_OUT are both USER_LOGIN, and each sign-in method is that same kind under a different identifier), so send the leaf's `itemArgs` verbatim in the same item alongside `kind` \u2014 a kind sent without them is a valid call for the OTHER action and is not refused. A leaf's `alternativeKinds` are further kinds the same leaf builds, as the editor's own panel switches between them (SET_VARIABLE writes a page or modal variable with SET_VARIABLE_DATA, or a client variable with SET_GLOBAL_DATA). Where a kind still cannot express the leaf you picked the write says so; follow that error instead of substituting a different action.",ops:{GET_SELECTABLE_COMPONENT_ACTIONS:"GET_SELECTABLE_COMPONENT_ACTIONS"},inputSchema:{componentId:c.string().optional(),eventType:c.string().optional()}},{name:"schema_actionflow",tier:"core",description:`Action flows \u2014 flow-level (addressed by actionFlowId). Discover types via op=SELECTABLE_TYPES and ids via op=GET_DETAIL. AI nodes require isAsync=true.
702
+ stored verbatim and leaves the picture depending on a host nobody here controls.`};u();function Zg(t){let e=vr[t];if(!e)throw new Error(`No guide available for '${t}'.`);return e}var ge={projectExId:c.string().optional().describe("The project to act on. Defaults to the project set by set_current_project."),appExId:c.string().nullable().optional().describe("A client app INSIDE the project (web / WeChat mini program / mobile) \u2014 never the project's own exId. Leave unset for the project's current client, pinned by create_project / set_current_project: that session holds the client's pages and the project's backend, which is what UI work needs. Pass null for the project's own document alone \u2014 its backend. Other values come from project metadata \u2192 apps[], entries whose appExId is non-null (the null entry is the project itself). A session reaches one client; a sibling client's pages live in another document, so re-pin to work on it."),appVersionExId:c.string().nullable().optional().describe("A specific version of the app named by appExId. Leave unset for the current version.")},JP=t=>t.ok?t.message??JSON.stringify(t.data??{},null,2):JSON.stringify({error:t.error??"Unknown error",data:t.data},null,2),Ns=t=>({content:[...t.agentFiles?[{type:"text",text:t.agentFiles}]:[],{type:"text",text:JP(t)}],isError:!t.ok}),Ro=(t,e,n,r,o)=>{t.registerTool(e,{description:n,inputSchema:r},o)},Bg=(t,e,n)=>{for(let r of e)Ro(t,r.name,r.description,r.inputSchema??{},async(o,a)=>Ns(await n({name:r.command,args:o},a.signal)))},qg=(t,e,n)=>{for(let r of e){let{ops:o}=r,a={op:c.enum(Object.keys(o)),...r.inputSchema??{}};Ro(t,r.name,r.description,a,async(s,i)=>{let{op:l,...d}=s;return Ns(await n({name:o[String(l)],args:d},i.signal))})}};var XP=t=>({content:[{type:"text",text:t}],isError:!1});var Vg=(t,e,n)=>{for(let r of e){let o={...ge,op:c.enum(r.ops),args:c.record(c.any()).optional()};Ro(t,r.name,r.description,o,async(a,s)=>{let{op:i,projectExId:l,appExId:d,appVersionExId:h,args:p}=a;return Ns(await n({name:"schema.ztype_tool_calls",args:{projectExId:l,appExId:d,appVersionExId:h,toolCalls:[{toolCallId:`${r.name}-${String(i)}-${Date.now()}`,name:String(i),args:p??{}}]}},s?.signal))})}},Wg=t=>{let e=Object.keys(vr);Ro(t,"guide","Load the domain guide for a backend capability \u2014 the rules, conventions, and gotchas for a plugin area (database, type, bindings, actionflow, api, zai, component, permissions, payments, logs, agent). Call before editing an unfamiliar area, or when a meta-tool call is rejected.",{plugin:c.enum(e)},async n=>XP(Zg(String(n.plugin))))},Hg=(t,e)=>{Ro(t,"agent_command","Advanced escape hatch for directly invoking an internal agent command.",{name:c.string(),args:c.record(c.any()).optional()},async(n,r)=>Ns(await e({name:String(n.name),args:n.args??{}},r.signal)))};u();var Ps=[{name:"schema_action_menu",tier:"catalog",description:"\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=GET_SELECTABLE_COMPONENT_ACTIONS \u2014 The frontend actions attachable to a component event, as the same category tree the editor's action picker shows \u2014 already filtered to this client's platform, what this product ships, the project's configured authentication, and what the event accepts. A few actions belong to one product only, so an absence can mean that rather than a missing capability. Each leaf carries the `eventType` it resolved to here (a leaf like SIGN_IN becomes whichever login the project configured) and the `path` to address it. A leaf's `kind` is what you send to ADD_COMPONENT_ACTIONS to attach it. A leaf with no `kind` cannot be attached by that tool at all \u2014 say so and let the user add it in the editor, rather than attaching some other action that looks close. `kind` is necessary but not sufficient: several leaves share one kind (SIGN_IN and SIGN_OUT are both USER_LOGIN, and each sign-in method is that same kind under a different identifier), so send the leaf's `itemArgs` verbatim in the same item alongside `kind` \u2014 a kind sent without them is a valid call for the OTHER action and is not refused. A leaf's `alternativeKinds` are further kinds the same leaf builds, as the editor's own panel switches between them (SET_VARIABLE writes a page or modal variable with SET_VARIABLE_DATA, or a client variable with SET_GLOBAL_DATA). Where a kind still cannot express the leaf you picked the write says so; follow that error instead of substituting a different action.",ops:{GET_SELECTABLE_COMPONENT_ACTIONS:"GET_SELECTABLE_COMPONENT_ACTIONS"},inputSchema:{componentId:c.string().optional(),eventType:c.string().optional()}},{name:"schema_actionflow",tier:"core",description:`Action flows \u2014 flow-level (addressed by actionFlowId). Discover types via op=SELECTABLE_TYPES and ids via op=GET_DETAIL. AI nodes require isAsync=true.
703
703
  Changes apply immediately; use schema_undo to revert the last change. Ops:
704
704
  - op=ADD \u2014 Result echoes each new flow's id.
705
705
  - op=ADD_GLOBAL_VARS \u2014 Result echoes each new variable's minted key. These are the flow's own variables, visible inside it only; a variable the client's pages share is ADD_CLIENT_VARIABLES.
@@ -742,7 +742,7 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
742
742
  - op=UPDATE_CUSTOM_CODE_NODE_INPUT (req: actionFlowId, name, nodeId)`,ops:{ADD_BRANCH_ITEM:"ADD_ACTION_FLOW_BRANCH_ITEM",ADD_NODE:"ADD_ACTION_FLOW_NODE",ADD_CODE_INPUT:"ADD_CUSTOM_CODE_NODE_INPUT",ADD_VAR_TARGETS:"ADD_GLOBAL_VARIABLES_NODE_TARGETS",BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS:"BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS",DELETE_NODES:"DELETE_ACTION_FLOW_NODES",DELETE_CODE_INPUT:"DELETE_CUSTOM_CODE_NODE_INPUT",DELETE_VAR_TARGETS:"DELETE_GLOBAL_VARIABLES_NODE_TARGETS",DUPLICATE_ACTION_FLOW_NODES:"DUPLICATE_ACTION_FLOW_NODES",EXTRACT_ACTION_FLOW_NODES:"EXTRACT_ACTION_FLOW_NODES",CONTEXT_INFO:"GET_ACTION_FLOW_CONTEXT_INFO",MOVE_ACTION_FLOW_NODES:"MOVE_ACTION_FLOW_NODES",REORDER_ACTION_FLOW_BRANCH_ITEMS:"REORDER_ACTION_FLOW_BRANCH_ITEMS",UPDATE_NODE:"UPDATE_ACTION_FLOW_NODE",UPDATE_CUSTOM_CODE_NODE_INPUT:"UPDATE_CUSTOM_CODE_NODE_INPUT"},inputSchema:{actionFlowId:c.string().optional(),afterNodeId:c.string().optional(),arrayLevel:c.number().optional(),branchSeparationId:c.string().optional(),config:c.any().optional(),displayName:c.string().optional(),groupId:c.string().optional(),name:c.string().optional(),newName:c.string().optional(),node:c.any().optional(),nodeId:c.string().optional(),nodeIds:c.array(c.any()).optional(),reorderedBranchItemIds:c.array(c.any()).optional(),replaceSource:c.boolean().optional(),schemaPath:c.array(c.any()).optional(),sourceActionFlowId:c.string().optional(),sourceNodeIds:c.array(c.any()).optional(),type:c.string().optional(),ungrouped:c.boolean().optional(),variableKeys:c.array(c.any()).optional()}},{name:"schema_api",tier:"core",description:"Third-party API integrations: workspaces, APIs, parameters, input variables, response configs, and workspace constants.\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD \u2014 Result echoes each new API's id.\n- op=ADD_INPUT_VARIABLES \u2014 Result echoes each new variable's minted key (the update/delete tools take it).\n- op=ADD_PARAMETERS \u2014 Result echoes each parameter's `schemaPath` \u2014 the value slot for the CREATE_*_BINDING tools, which is how a parameter takes a workspace constant instead of a literal.\n- op=ADD_RESPONSE_CONFIGS \u2014 Result echoes each new config's uniqueId, and the `responseTypeId` of every object type `seedObjectType` minted \u2014 pass that to ADD_TYPE_DEFINITION_FIELDS to describe the response.\n- op=ADD_WORKSPACES \u2014 Result echoes each new workspace's id.\n- op=ADD_WORKSPACE_CONSTANTS \u2014 A constant is created without a value. Result echoes each one's value `schemaPath` (read it back later from GET_API_WORKSPACE_DETAIL), and that slot takes CREATE_CONST_BINDING and nothing else \u2014 no variable, secret, formula or condition, matching the editor's constants table. To let a request use a value the project already holds, bind it on the API's parameter or URL instead.\n- op=DELETE \u2014 Also drops each API from every role's allow-list and deletes the private object types its body and responses owned.\n- op=DELETE_CODECS \u2014 Removes the value conversion from body slots. A media field left without one has no wire representation, so the editor flags it as incomplete.\n- op=DELETE_INPUT_VARIABLES (req: apiId, variableNames)\n- op=DELETE_PARAMETERS (req: apiId, items)\n- op=DELETE_RESPONSE_CONFIGS (req: apiId, uniqueIds)\n- op=DELETE_WORKSPACES \u2014 Deletes API workspaces and everything inside them: the APIs go too \u2014 dropped from every role's allow-list, along with the private object types their bodies and responses owned. Pass `transferToWorkspaceId` to move the APIs and constants into a surviving workspace instead. The result lists what was destroyed.\n- op=DELETE_WORKSPACE_CONSTANTS (req: constantNames, workspaceId)\n- op=DUPLICATE \u2014 Duplicate an API, together with the private object types it owns (its JSON request body and each response type), into the same workspace right after the source or into another one. To regroup an API without copying it use MOVE_APIS_TO_WORKSPACE. The result echoes the new API's id.\n- op=LIST\n- op=LIST_WORKSPACES\n- op=GET_CODEC_OPTIONS \u2014 Lists the request-body and response fields that can carry a value conversion, with the conversions legal at each. Feed a slot's `typeIdentifier`/`field` back to SET_API_CODECS verbatim.\n- op=GET_DETAIL (req: apiId|schemaPath)\n- op=GET_SELECTABLE_TYPES \u2014 List the types one API slot accepts. Every `type` an API tool takes must be a `typeIdentifier` copied from here verbatim. To use a type that is not listed, create it with ADD_OBJECT_TYPE_DEFINITIONS / ADD_ENUM_DEFINITIONS (leave `private` unset, or it stays out of every list) and call this again; to reuse an existing *private* type, publish it first with PUBLISH_OBJECT_TYPE. Lists are not enumerated \u2014 the nesting has no end \u2014 so a list is a listed identifier plus the target parameter's `arrayLevel` (1 = list, 2 = list of lists), never brackets written into the identifier; the URL, header and form-body slots carry no `arrayLevel` and take no list at all. An option is offered in its optional form (`null|\u2026`); drop the `null|` to make that slot required, and note the wrapper you pass is the one the list itself gets.\n- op=GET_WORKSPACE_DETAIL \u2014 One workspace in full: its constants \u2014 each with the value `schemaPath` CREATE_CONST_BINDING writes, the only binding that slot takes \u2014 and the APIs it holds. GET_ALL_API_WORKSPACES carries no such path, since one per constant across every workspace is replayed every turn.\n- op=MOVES_TO_WORKSPACE (req: apiIds, targetWorkspaceId)\n- op=SET_CODECS \u2014 Sets how a body slot's value is converted on the wire. Pick the slot and encoder from GET_API_CODEC_OPTIONS. A slot is a field of a type, not a path \u2014 the same object type reused twice shares one conversion.\n- op=SET_CONTENT_TYPE \u2014 Picks the request body's format, discarding the previous body. 'application/json' seeds an empty object type \u2014 describe it with ADD_TYPE_DEFINITION_FIELDS on the `bodyType` GET_API_DETAIL reports; the form formats take their fields from ADD_API_PARAMETERS.\n- op=UPDATE (req: apiId)\n- op=UPDATE_INPUT_VARIABLES (req: apiId, items)\n- op=UPDATE_PARAMETERS (req: apiId, items)\n- op=UPDATE_RESPONSE_CONFIGS \u2014 Result echoes the `responseTypeId` of every object type `seedObjectType` minted \u2014 pass that to ADD_TYPE_DEFINITION_FIELDS to describe the response. Retyping a response deletes the private object type it owned.\n- op=UPDATE_WORKSPACE (req: workspaceId)\n- op=UPDATE_WORKSPACE_CONSTANTS (req: items, workspaceId)",ops:{ADD:"ADD_APIS",ADD_INPUT_VARIABLES:"ADD_API_INPUT_VARIABLES",ADD_PARAMETERS:"ADD_API_PARAMETERS",ADD_RESPONSE_CONFIGS:"ADD_API_RESPONSE_CONFIGS",ADD_WORKSPACES:"ADD_API_WORKSPACES",ADD_WORKSPACE_CONSTANTS:"ADD_API_WORKSPACE_CONSTANTS",DELETE:"DELETE_APIS",DELETE_CODECS:"DELETE_API_CODECS",DELETE_INPUT_VARIABLES:"DELETE_API_INPUT_VARIABLES",DELETE_PARAMETERS:"DELETE_API_PARAMETERS",DELETE_RESPONSE_CONFIGS:"DELETE_API_RESPONSE_CONFIGS",DELETE_WORKSPACES:"DELETE_API_WORKSPACES",DELETE_WORKSPACE_CONSTANTS:"DELETE_API_WORKSPACE_CONSTANTS",DUPLICATE:"DUPLICATE_API",LIST:"GET_ALL_APIS_INFO",LIST_WORKSPACES:"GET_ALL_API_WORKSPACES",GET_CODEC_OPTIONS:"GET_API_CODEC_OPTIONS",GET_DETAIL:"GET_API_DETAIL",GET_SELECTABLE_TYPES:"GET_API_SELECTABLE_TYPES",GET_WORKSPACE_DETAIL:"GET_API_WORKSPACE_DETAIL",MOVES_TO_WORKSPACE:"MOVE_APIS_TO_WORKSPACE",SET_CODECS:"SET_API_CODECS",SET_CONTENT_TYPE:"SET_API_CONTENT_TYPE",UPDATE:"UPDATE_API",UPDATE_INPUT_VARIABLES:"UPDATE_API_INPUT_VARIABLES",UPDATE_PARAMETERS:"UPDATE_API_PARAMETERS",UPDATE_RESPONSE_CONFIGS:"UPDATE_API_RESPONSE_CONFIGS",UPDATE_WORKSPACE:"UPDATE_API_WORKSPACE",UPDATE_WORKSPACE_CONSTANTS:"UPDATE_API_WORKSPACE_CONSTANTS"},inputSchema:{apiId:c.string().optional(),apiIds:c.array(c.any()).optional(),clearContentType:c.boolean().optional(),constantNames:c.array(c.any()).optional(),contentType:c.enum(["application/json","application/x-www-form-urlencoded","multipart/form-data"]).optional(),description:c.string().optional(),detail:c.enum(["SUMMARY","FULL"]).optional(),displayName:c.string().optional(),items:c.array(c.any()).optional(),method:c.enum(["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"]).optional(),paginationEnabled:c.boolean().optional(),responseConfigId:c.string().optional(),schemaPath:c.array(c.any()).optional(),slot:c.enum(["INPUT_VARIABLE","PATH_PARAMETER","QUERY_PARAMETER","HEADER_PARAMETER","FORM_BODY_PARAMETER","JSON_BODY","RESPONSE_BODY","WORKSPACE_CONSTANT"]).optional(),sourceApiId:c.string().optional(),target:c.enum(["REQUEST_BODY","RESPONSE_BODY"]).optional(),targetWorkspaceId:c.string().optional(),timeout:c.number().optional(),transferToWorkspaceId:c.string().optional(),uniqueIds:c.array(c.any()).optional(),url:c.string().optional(),useAsData:c.boolean().optional(),variableNames:c.array(c.any()).optional(),workspaceId:c.string().optional(),workspaceIds:c.array(c.any()).optional()}},{name:"schema_authentication",tier:"catalog",description:`
743
743
  Changes apply immediately; use schema_undo to revert the last change. Ops:
744
744
  - op=GET_AUTHENTICATION_CONFIG_INFO \u2014 The project's sign-in settings: which account methods (username, email, phone), WeChat and SSO providers are on, and each one's sign-in validity. These switches decide which sign-up / sign-in actions GET_SELECTABLE_COMPONENT_ACTIONS offers, so read this when a login action you need is missing there.
745
- - op=UPDATE_AUTHENTICATION_CONFIG \u2014 Turn sign-in methods on or off and set their validity and WeChat credentials; omitted methods and fields are left as they are. Turning a method off leaves the sign-up / sign-in actions already built on it in place but takes the method away from the app's users, so check with the user before switching off a method the app already uses.`,ops:{GET_AUTHENTICATION_CONFIG_INFO:"GET_AUTHENTICATION_CONFIG_INFO",UPDATE_AUTHENTICATION_CONFIG:"UPDATE_AUTHENTICATION_CONFIG"},inputSchema:{email:c.record(c.any()).optional(),phone:c.record(c.any()).optional(),ssoConfigs:c.array(c.any()).optional(),username:c.record(c.any()).optional(),wechat:c.record(c.any()).optional()}},{name:"schema_binding_inspect",tier:"core",description:`Inspect a data-binding location (schemaPath: DiffPathComponents) \u2014 selectable options, expected type, and formula operators/config. Feed a returned path into schema_create_binding.
745
+ - op=UPDATE_AUTHENTICATION_CONFIG \u2014 Turn sign-in methods on or off and set their validity and WeChat credentials; omitted methods and fields are left as they are. Turning a method off leaves the sign-up / sign-in actions already built on it in place but takes the method away from the app's users, so check with the user before switching off a method the app already uses. No tool can change WeCom sign-in or the SSO providers' own settings; the user changes them in the sign-in settings themselves.`,ops:{GET_AUTHENTICATION_CONFIG_INFO:"GET_AUTHENTICATION_CONFIG_INFO",UPDATE_AUTHENTICATION_CONFIG:"UPDATE_AUTHENTICATION_CONFIG"},inputSchema:{email:c.record(c.any()).optional(),phone:c.record(c.any()).optional(),ssoConfigs:c.array(c.any()).optional(),username:c.record(c.any()).optional(),wechat:c.record(c.any()).optional()}},{name:"schema_binding_inspect",tier:"core",description:`Inspect a data-binding location (schemaPath: DiffPathComponents) \u2014 selectable options, expected type, and formula operators/config. Feed a returned path into schema_create_binding.
746
746
  Changes apply immediately; use schema_undo to revert the last change. Ops:
747
747
  - op=BINDING_OPTIONS \u2014 Browse the data options bindable at the schema path as a size-budgeted tree. Options marked '*' exist but mismatch the slot's type \u2014 bind them via a formula/conversion (GET_FORMULA_OPERATORS + CREATE_FORMULA_BINDING), not CREATE_OPTION_BINDING. Subtrees ending in '\u2026 menuPath=[\u2026]' were omitted for size: call again with that menuPath to fetch them. CREATE_OPTION_BINDING's pathInHierarchicalMenu = the menuPath you drilled into (if any) + the option's path in this result; pick it from the tree, never hand-built.
748
748
  - op=BINDING_TYPE \u2014 Report the value type the binding slot at the schema path expects \u2014 check it before creating a binding there.
@@ -865,17 +865,19 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
865
865
  - op=UPDATE_ROLE_API_PERMISSION (req: roleName)
866
866
  - op=UPDATE_ROLE_PAYMENT_PERMISSION \u2014 Set a role's payment permission: allowAll alone, or one billing-method map per model. Legacy projects take allowedPaymentTypeAndMethod; payment-config projects take allowedPaymentConfigIdAndMethod (ids from GET_PAYMENT_CONFIGS). In that map every id must exist and every method must be one its config's provider supports; it is also where payment config grants live. A map belonging to the other model is rejected, and allowAll cannot be combined with either map. Omit a map to keep its current entries; allowAll=true clears both.
867
867
  - op=UPDATE_ROLE_TABLE_PERMISSION \u2014 Grant or revoke one role's operations across any number of tables, with per-operation column sets. Newly granted operations get an always-true row condition; the result reports every addressed table's resulting grant and the schema path of each condition, so narrowing one needs no further read.
868
- - op=UPDATE_ROLE_ZAI_PERMISSION (req: roleName)`,ops:{ACTIVATE_ROLE_PERMISSION:"ACTIVATE_ROLE_PERMISSION",ADD_ROLES:"ADD_ROLES",DELETE_ROLES:"DELETE_ROLES",GET_ALL_ROLES_INFO:"GET_ALL_ROLES_INFO",GET_ROLE_DETAIL:"GET_ROLE_DETAIL",GET_TABLE_PERMISSION:"GET_TABLE_PERMISSION",SET_ROLE_PERMISSION_CHECK:"SET_ROLE_PERMISSION_CHECK",UPDATE_ROLE:"UPDATE_ROLE",UPDATE_ROLE_ACTION_FLOW_PERMISSION:"UPDATE_ROLE_ACTION_FLOW_PERMISSION",UPDATE_ROLE_API_PERMISSION:"UPDATE_ROLE_API_PERMISSION",UPDATE_ROLE_PAYMENT_PERMISSION:"UPDATE_ROLE_PAYMENT_PERMISSION",UPDATE_ROLE_TABLE_PERMISSION:"UPDATE_ROLE_TABLE_PERMISSION",UPDATE_ROLE_ZAI_PERMISSION:"UPDATE_ROLE_ZAI_PERMISSION"},inputSchema:{allowAll:c.boolean().optional(),allowedActionFlowIds:c.array(c.any()).optional(),allowedApiIds:c.array(c.any()).optional(),allowedPaymentConfigIdAndMethod:c.record(c.any()).optional(),allowedPaymentTypeAndMethod:c.record(c.any()).optional(),allowedZAiIds:c.array(c.any()).optional(),blocks:c.array(c.any()).optional(),category:c.enum(["ACTION_FLOW","ZAI"]).optional(),denyAllTables:c.boolean().optional(),description:c.string().optional(),detail:c.enum(["SUMMARY","FULL"]).optional(),items:c.array(c.any()).optional(),roleName:c.string().optional(),roleNames:c.array(c.any()).optional(),tableDisplayNames:c.array(c.any()).optional(),tables:c.array(c.any()).optional(),targetId:c.string().optional()}},{name:"schema_request_filter",tier:"core",description:"Request filters (conditional filters / where-conditions / sort) addressed by schemaPath. Start from op=CONTEXT for selectable columns and sub-paths \u2014 never hand-build paths. A filter whose whereTrack is WHERE_CONDITION is edited at its whereSchemaPath with schema_condition_expr; this facade's condition ops (ADD_CONDITION etc.) edit COLUMN_WHERE filters only. Condition values are DataBindings (fill with schema_create_binding).\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD_FILTER \u2014 Add a conditional filter to the request's list. A new filter starts empty on the condition-expression `whereCondition` by default, edited with the condition tools; pass `whereTrack: COLUMN_WHERE` only when the user explicitly asks for the column-comparison `where`. The echo's `whereTrack` is the track it landed on. Result echoes the new filter's id and its whereSchemaPath / sortConfigsSchemaPath anchors.\n- op=ADD_CONDITION \u2014 Result echoes the new condition's schema path and its value binding's schema path (for the CREATE_*_BINDING tools).\n- op=ADD_SORT (req: field, schemaPath)\n- op=DELETE_FILTER (req: id, schemaPath)\n- op=DELETE_CONDITION (req: schemaPath)\n- op=DELETE_SORT (req: index, schemaPath)\n- op=DUPLICATE_REQUEST_CONDITIONAL_FILTER \u2014 Copy one conditional filter \u2014 its gating condition together with the where/sort it turns on \u2014 onto another query or mutation. The copy keeps the source's where track, so the echo's `whereTrack` is the source's, not the target's. Columns the target's table does not have are blanked rather than carried over, so re-check the copy's conditions when the two requests read different tables. The result echoes the copy's id and schema paths.\n- op=CONTEXT \u2014 Entry point for editing a query/mutation request's conditions and sorting. Pass the request's or owning node's schema path (e.g. from GET_ACTION_FLOW_NODE_DETAIL, or a ZAI db-context's querySchemaPath); returns the conditional filters with their whereSchemaPath / sortConfigsSchemaPath anchors, selectableColumns with allowed operators, and updateColumnArithmetic modes \u2014 everything the *_REQUEST_* tools take. Each filter's whereSchemaPath addresses the track its `whereTrack` names. Left unset, that is the track the filter is edited on: COLUMN_WHERE while it holds a non-empty column-comparison `where` and no `whereCondition`, WHERE_CONDITION otherwise; passing `whereTrack` forces one track onto every filter. WHERE_CONDITION addresses `whereCondition`: a condition tree edited with the condition tools (a bare always-true condition, which is what an emptied tree holds, takes UPDATE_EXPRESSION_CONDITION_OPERATOR directly, and INSERT_CONDITION_BOOL_EXP seeds an absent tree or fills the bare one in place). COLUMN_WHERE addresses the column-comparison `where`, edited with the *_REQUEST_FILTER_CONDITION tools from the selectableColumns pathComponents. selectableColumns is listed on either track because the sort tools take their columns from it too. On an un-migrated request still holding a bare top-level `where`, conditionalFilters is empty and whereSchemaPath addresses that where \u2014 edit it in place on COLUMN_WHERE; requesting WHERE_CONDITION there is rejected. An aggregate value binding (a relation's count/sum/... \u2014 its path ends in an aggregation) carries its own row filter: pass the binding's schema path to get that where the same way (no conditional filters, no sort), and the same track decides whether its whereSchemaPath addresses `where` or `whereCondition`; having no sort, it lists selectableColumns only on COLUMN_WHERE.\n- op=NEST_CONDITION (req: schemaPath)\n- op=REORDER_FILTERS (req: reorderedIds, schemaPath)\n- op=REORDER_SORT (req: reorderedIndexes, schemaPath)\n- op=SET_UPDATE_COLUMN_ARITHMETIC (req: columnDisplayName, mode, schemaPath)\n- op=TOGGLE_CONDITION_AND_OR (req: schemaPath)\n- op=TOGGLE_CONDITION_NOT (req: schemaPath)\n- op=UPDATE_FILTER (req: id, name, schemaPath)\n- op=UPDATE_REQUEST_FILTER_CONDITION_COLUMN (req: columnPathComponents, schemaPath)\n- op=SET_CONDITION_OPERATOR (req: operator, schemaPath)\n- op=UPDATE_SORT (req: index, schemaPath)",ops:{ADD_FILTER:"ADD_REQUEST_CONDITIONAL_FILTER",ADD_CONDITION:"ADD_REQUEST_FILTER_CONDITION",ADD_SORT:"ADD_REQUEST_SORT_CONFIG",DELETE_FILTER:"DELETE_REQUEST_CONDITIONAL_FILTER",DELETE_CONDITION:"DELETE_REQUEST_FILTER_CONDITION",DELETE_SORT:"DELETE_REQUEST_SORT_CONFIG",DUPLICATE_REQUEST_CONDITIONAL_FILTER:"DUPLICATE_REQUEST_CONDITIONAL_FILTER",CONTEXT:"GET_REQUEST_FILTER_CONTEXT",NEST_CONDITION:"NEST_REQUEST_FILTER_CONDITION",REORDER_FILTERS:"REORDER_REQUEST_CONDITIONAL_FILTERS",REORDER_SORT:"REORDER_REQUEST_SORT_CONFIGS",SET_UPDATE_COLUMN_ARITHMETIC:"SET_UPDATE_COLUMN_ARITHMETIC",TOGGLE_CONDITION_AND_OR:"TOGGLE_REQUEST_FILTER_CONDITION_AND_OR",TOGGLE_CONDITION_NOT:"TOGGLE_REQUEST_FILTER_CONDITION_NOT",UPDATE_FILTER:"UPDATE_REQUEST_CONDITIONAL_FILTER",UPDATE_REQUEST_FILTER_CONDITION_COLUMN:"UPDATE_REQUEST_FILTER_CONDITION_COLUMN",SET_CONDITION_OPERATOR:"UPDATE_REQUEST_FILTER_CONDITION_OPERATOR",UPDATE_SORT:"UPDATE_REQUEST_SORT_CONFIG"},inputSchema:{afterId:c.string().optional(),calculation:c.enum(["EUCLIDEAN","COSINE"]).optional(),columnDisplayName:c.string().optional(),columnPathComponents:c.array(c.any()).optional(),field:c.array(c.any()).optional(),id:c.string().optional(),index:c.number().optional(),mode:c.enum(["set","increment","decrement"]).optional(),name:c.string().optional(),operator:c.string().optional(),reorderedIds:c.array(c.any()).optional(),reorderedIndexes:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional(),sort:c.enum(["descending","ascending"]).optional(),sourceId:c.string().optional(),sourceSchemaPath:c.array(c.any()).optional(),type:c.enum(["BASIC","VECTOR"]).optional(),value:c.record(c.any()).optional(),whereTrack:c.enum(["COLUMN_WHERE","WHERE_CONDITION"]).optional()}},{name:"schema_secret",tier:"catalog",description:"\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD_SECRET_CONFIGS \u2014 Registers secret entries in the schema. The plaintext value is NOT passed here and never stored in the schema: you must first upload the value out of band (the backend `saveSecret` mutation) to obtain its opaque `secretKey` handle, then pass that handle. A secret added without a `secretKey` has no value set and stays incomplete until one is supplied via UPDATE_SECRET_CONFIG. Result echoes each new secret's id.\n- op=DELETE_SECRET_CONFIGS (req: secretIds)\n- op=GET_ALL_SECRET_CONFIGS \u2014 Lists every secret: id, displayName, description, and `hasValue` (whether its value handle is set). The stored value handle itself is withheld.\n- op=UPDATE_SECRET_CONFIG \u2014 Updates a secret's metadata and/or value handle (incremental \u2014 omitted fields are left unchanged). You cannot set a plaintext value here: to change the value, re-upload it out of band (the backend `saveSecret` mutation) to obtain a new `secretKey` handle, then pass it as `secretKey`.",ops:{ADD_SECRET_CONFIGS:"ADD_SECRET_CONFIGS",DELETE_SECRET_CONFIGS:"DELETE_SECRET_CONFIGS",GET_ALL_SECRET_CONFIGS:"GET_ALL_SECRET_CONFIGS",UPDATE_SECRET_CONFIG:"UPDATE_SECRET_CONFIG"},inputSchema:{description:c.string().optional(),displayName:c.string().optional(),items:c.array(c.any()).optional(),secretId:c.string().optional(),secretIds:c.array(c.any()).optional(),secretKey:c.string().optional()}},{name:"schema_seo",tier:"catalog",description:`
868
+ - op=UPDATE_ROLE_ZAI_PERMISSION (req: roleName)`,ops:{ACTIVATE_ROLE_PERMISSION:"ACTIVATE_ROLE_PERMISSION",ADD_ROLES:"ADD_ROLES",DELETE_ROLES:"DELETE_ROLES",GET_ALL_ROLES_INFO:"GET_ALL_ROLES_INFO",GET_ROLE_DETAIL:"GET_ROLE_DETAIL",GET_TABLE_PERMISSION:"GET_TABLE_PERMISSION",SET_ROLE_PERMISSION_CHECK:"SET_ROLE_PERMISSION_CHECK",UPDATE_ROLE:"UPDATE_ROLE",UPDATE_ROLE_ACTION_FLOW_PERMISSION:"UPDATE_ROLE_ACTION_FLOW_PERMISSION",UPDATE_ROLE_API_PERMISSION:"UPDATE_ROLE_API_PERMISSION",UPDATE_ROLE_PAYMENT_PERMISSION:"UPDATE_ROLE_PAYMENT_PERMISSION",UPDATE_ROLE_TABLE_PERMISSION:"UPDATE_ROLE_TABLE_PERMISSION",UPDATE_ROLE_ZAI_PERMISSION:"UPDATE_ROLE_ZAI_PERMISSION"},inputSchema:{allowAll:c.boolean().optional(),allowedActionFlowIds:c.array(c.any()).optional(),allowedApiIds:c.array(c.any()).optional(),allowedPaymentConfigIdAndMethod:c.record(c.any()).optional(),allowedPaymentTypeAndMethod:c.record(c.any()).optional(),allowedZAiIds:c.array(c.any()).optional(),blocks:c.array(c.any()).optional(),category:c.enum(["ACTION_FLOW","ZAI"]).optional(),denyAllTables:c.boolean().optional(),description:c.string().optional(),detail:c.enum(["SUMMARY","FULL"]).optional(),items:c.array(c.any()).optional(),roleName:c.string().optional(),roleNames:c.array(c.any()).optional(),tableDisplayNames:c.array(c.any()).optional(),tables:c.array(c.any()).optional(),targetId:c.string().optional()}},{name:"schema_request_filter",tier:"core",description:"Request filters (conditional filters / where-conditions / sort) addressed by schemaPath. Start from op=CONTEXT for selectable columns and sub-paths \u2014 never hand-build paths. A filter whose whereTrack is WHERE_CONDITION is edited at its whereSchemaPath with schema_condition_expr; this facade's condition ops (ADD_CONDITION etc.) edit COLUMN_WHERE filters only. Condition values are DataBindings (fill with schema_create_binding).\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD_FILTER \u2014 Add a conditional filter to the request's list. A new filter starts as an empty condition-expression `whereCondition`, edited with the condition tools. A new column-comparison `where` can no longer be created: when the user asks for a column filter, build the same comparison in this whereCondition and tell them the column style is retired. Result echoes the new filter's id and its whereSchemaPath / sortConfigsSchemaPath anchors.\n- op=ADD_CONDITION \u2014 Result echoes the new condition's schema path and its value binding's schema path (for the CREATE_*_BINDING tools).\n- op=ADD_SORT (req: field, schemaPath)\n- op=DELETE_FILTER (req: id, schemaPath)\n- op=DELETE_CONDITION (req: schemaPath)\n- op=DELETE_SORT (req: index, schemaPath)\n- op=DUPLICATE_REQUEST_CONDITIONAL_FILTER \u2014 Copy one conditional filter \u2014 its gating condition together with the where/sort it turns on \u2014 onto another query or mutation. The copy keeps the source's where track, so the echo's `whereTrack` is the source's, not the target's. Columns the target's table does not have are blanked rather than carried over, so re-check the copy's conditions when the two requests read different tables. The result echoes the copy's id and schema paths.\n- op=CONTEXT \u2014 Entry point for editing a query/mutation request's conditions and sorting. Pass the request's or owning node's schema path (e.g. from GET_ACTION_FLOW_NODE_DETAIL, or a ZAI db-context's querySchemaPath); returns the conditional filters with their whereSchemaPath / sortConfigsSchemaPath anchors, selectableColumns with allowed operators, and updateColumnArithmetic modes \u2014 everything the *_REQUEST_* tools take. Each filter's whereSchemaPath addresses the track its `whereTrack` names. Left unset, that is the track the filter is edited on: COLUMN_WHERE while it holds a non-empty column-comparison `where` and no `whereCondition`, WHERE_CONDITION otherwise; passing `whereTrack` forces one track onto every filter. WHERE_CONDITION addresses `whereCondition`: a condition tree edited with the condition tools (a bare always-true condition, which is what an emptied tree holds, takes UPDATE_EXPRESSION_CONDITION_OPERATOR directly, and INSERT_CONDITION_BOOL_EXP seeds an absent tree or fills the bare one in place). COLUMN_WHERE addresses the column-comparison `where`, edited with the *_REQUEST_FILTER_CONDITION tools from the selectableColumns pathComponents. selectableColumns is listed on either track because the sort tools take their columns from it too. On an un-migrated request still holding a bare top-level `where`, conditionalFilters is empty and whereSchemaPath addresses that where \u2014 edit it in place on COLUMN_WHERE; requesting WHERE_CONDITION there is rejected. An aggregate value binding (a relation's count/sum/... \u2014 its path ends in an aggregation) carries its own row filter: pass the binding's schema path to get that where the same way (no conditional filters, no sort), and the same track decides whether its whereSchemaPath addresses `where` or `whereCondition`; having no sort, it lists selectableColumns only on COLUMN_WHERE.\n- op=NEST_CONDITION (req: schemaPath)\n- op=REORDER_FILTERS (req: reorderedIds, schemaPath)\n- op=REORDER_SORT (req: reorderedIndexes, schemaPath)\n- op=SET_UPDATE_COLUMN_ARITHMETIC (req: columnDisplayName, mode, schemaPath)\n- op=TOGGLE_CONDITION_AND_OR (req: schemaPath)\n- op=TOGGLE_CONDITION_NOT (req: schemaPath)\n- op=UPDATE_FILTER (req: id, name, schemaPath)\n- op=UPDATE_REQUEST_FILTER_CONDITION_COLUMN (req: columnPathComponents, schemaPath)\n- op=SET_CONDITION_OPERATOR (req: operator, schemaPath)\n- op=UPDATE_SORT (req: index, schemaPath)",ops:{ADD_FILTER:"ADD_REQUEST_CONDITIONAL_FILTER",ADD_CONDITION:"ADD_REQUEST_FILTER_CONDITION",ADD_SORT:"ADD_REQUEST_SORT_CONFIG",DELETE_FILTER:"DELETE_REQUEST_CONDITIONAL_FILTER",DELETE_CONDITION:"DELETE_REQUEST_FILTER_CONDITION",DELETE_SORT:"DELETE_REQUEST_SORT_CONFIG",DUPLICATE_REQUEST_CONDITIONAL_FILTER:"DUPLICATE_REQUEST_CONDITIONAL_FILTER",CONTEXT:"GET_REQUEST_FILTER_CONTEXT",NEST_CONDITION:"NEST_REQUEST_FILTER_CONDITION",REORDER_FILTERS:"REORDER_REQUEST_CONDITIONAL_FILTERS",REORDER_SORT:"REORDER_REQUEST_SORT_CONFIGS",SET_UPDATE_COLUMN_ARITHMETIC:"SET_UPDATE_COLUMN_ARITHMETIC",TOGGLE_CONDITION_AND_OR:"TOGGLE_REQUEST_FILTER_CONDITION_AND_OR",TOGGLE_CONDITION_NOT:"TOGGLE_REQUEST_FILTER_CONDITION_NOT",UPDATE_FILTER:"UPDATE_REQUEST_CONDITIONAL_FILTER",UPDATE_REQUEST_FILTER_CONDITION_COLUMN:"UPDATE_REQUEST_FILTER_CONDITION_COLUMN",SET_CONDITION_OPERATOR:"UPDATE_REQUEST_FILTER_CONDITION_OPERATOR",UPDATE_SORT:"UPDATE_REQUEST_SORT_CONFIG"},inputSchema:{afterId:c.string().optional(),calculation:c.enum(["EUCLIDEAN","COSINE"]).optional(),columnDisplayName:c.string().optional(),columnPathComponents:c.array(c.any()).optional(),field:c.array(c.any()).optional(),id:c.string().optional(),index:c.number().optional(),mode:c.enum(["set","increment","decrement"]).optional(),name:c.string().optional(),operator:c.string().optional(),reorderedIds:c.array(c.any()).optional(),reorderedIndexes:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional(),sort:c.enum(["descending","ascending"]).optional(),sourceId:c.string().optional(),sourceSchemaPath:c.array(c.any()).optional(),type:c.enum(["BASIC","VECTOR"]).optional(),value:c.record(c.any()).optional(),whereTrack:c.enum(["COLUMN_WHERE","WHERE_CONDITION"]).optional()}},{name:"schema_secret",tier:"catalog",description:"\nChanges apply immediately; use schema_undo to revert the last change. Ops:\n- op=ADD_SECRET_CONFIGS \u2014 Registers secret entries in the schema. The plaintext value is NOT passed here and never stored in the schema: you must first upload the value out of band (the backend `saveSecret` mutation) to obtain its opaque `secretKey` handle, then pass that handle. A secret added without a `secretKey` has no value set and stays incomplete until one is supplied via UPDATE_SECRET_CONFIG. Result echoes each new secret's id.\n- op=DELETE_SECRET_CONFIGS (req: secretIds)\n- op=GET_ALL_SECRET_CONFIGS \u2014 Lists every secret: id, displayName, description, and `hasValue` (whether its value handle is set). The stored value handle itself is withheld.\n- op=UPDATE_SECRET_CONFIG \u2014 Updates a secret's metadata and/or value handle (incremental \u2014 omitted fields are left unchanged). You cannot set a plaintext value here: to change the value, re-upload it out of band (the backend `saveSecret` mutation) to obtain a new `secretKey` handle, then pass it as `secretKey`.",ops:{ADD_SECRET_CONFIGS:"ADD_SECRET_CONFIGS",DELETE_SECRET_CONFIGS:"DELETE_SECRET_CONFIGS",GET_ALL_SECRET_CONFIGS:"GET_ALL_SECRET_CONFIGS",UPDATE_SECRET_CONFIG:"UPDATE_SECRET_CONFIG"},inputSchema:{description:c.string().optional(),displayName:c.string().optional(),items:c.array(c.any()).optional(),secretId:c.string().optional(),secretIds:c.array(c.any()).optional(),secretKey:c.string().optional()}},{name:"schema_seo",tier:"catalog",description:`
869
869
  Changes apply immediately; use schema_undo to revert the last change. Ops:
870
- - op=ADD_SEO_PATH_DB_QUERY \u2014 Add a database-backed source to one URL path parameter: the selected column's values become path segments. The source starts with the mandatory Default filter; add real filters at the returned querySchemaPath with GET_REQUEST_FILTER_CONTEXT and the *_REQUEST_FILTER_CONDITION tools. Only the first selected column is read.
870
+ - op=ADD_SEO_PATH_DB_QUERY \u2014 Add a database-backed source to one URL path parameter: the selected column's values become path segments. The source starts with the mandatory Default filter, an empty \`whereCondition\`; narrow it by reading the returned querySchemaPath with GET_REQUEST_FILTER_CONTEXT and building the condition at its whereSchemaPath with INSERT_CONDITION_BOOL_EXP and the other condition tools. Only the first selected column is read.
871
871
  - op=DELETE_SEO_PATH_DB_QUERY (req: index, pageId, pathData)
872
872
  - op=DELETE_SEO_PATH_RANGE \u2014 Remove the whole range entry of one URL path parameter, both its literal values and its database-backed sources.
873
- - op=GET_SEO_INFO \u2014 SEO context for this client: the rendering method, the sitemap mode, the robots.txt content, and every top-level page that declares URL path parameters, with whether each parameter's path range is configured. Configured means at least one literal value or database source is present, not that the range yields values: a disabled database source still counts, so check each source's enabled flag in GET_SEO_PAGE_DETAIL before treating a page as publish-ready. Path ranges apply only to SSR/SSG; a CSR client hides and ignores them.
874
- - op=GET_SEO_PAGE_DETAIL \u2014 One page's SEO path ranges: each URL path parameter's literal values and database-backed sources, each source with the index that addresses it and the querySchemaPath to read or edit its filters with GET_REQUEST_FILTER_CONTEXT. Read this before editing.
873
+ - op=GET_ALL_SEO_STRUCTURED_DATA_TYPES_INFO \u2014 List every type in the bundled schema.org vocabulary with its topLevel flag and what it extends, sorted by name \u2014 the vocabulary GET_SEO_STRUCTURED_DATA_TYPE_DETAIL takes a name from. This is a static vocabulary shipped with the build, independent of the current project, and it deliberately does not expand each type's properties.
874
+ - op=GET_SEO_INFO \u2014 SEO context for this client: the rendering method, the sitemap mode, the robots.txt content, and every top-level page \u2014 static ones included \u2014 with whether each URL path parameter's path range is configured and whether the page carries a page SEO config. Configured means at least one literal value or database source is present, not that the range yields values: a disabled database source still counts, so check each source's enabled flag in GET_SEO_PAGE_DETAIL before treating a page as publish-ready. Path ranges apply only to SSR/SSG; a CSR client hides and ignores them.
875
+ - op=GET_SEO_PAGE_DETAIL \u2014 One page's SEO path ranges and page SEO fields: each URL path parameter's literal values and database-backed sources, each source with the index that addresses it and the querySchemaPath to read or edit its filters with GET_REQUEST_FILTER_CONTEXT, plus the page's TDK / thumbnail / canonicalUrl / noindex / excludeFromSitemap bindings, its structuredData shape and its sitemapLastmod source. seo is absent when the page never configured any of them; a slot that concatenates several pieces reports composite and a summary covering every piece. Read this before editing.
876
+ - op=GET_SEO_STRUCTURED_DATA_TYPE_DETAIL \u2014 One schema.org type's allowed shape: topLevel, extends, members (the enumeration values an enum type declares, empty otherwise), and every property it accepts \u2014 its own plus the ones inherited from its ancestors \u2014 each with the raw range list, an image flag for ImageObject ranges, and the ranges split into vocabulary types (nestedTypes) and scalars (scalarTypes). This is the static schema.org vocabulary, independent of the current project: it says what a type may hold, not what a page's structuredData currently holds. A property can take several values; the vocabulary carries no multi-value marker, so its ranges are all it says.
875
877
  - op=SET_SEO_PATH_STATIC_OPTIONS \u2014 Replace the literal values of one URL path parameter. Send [] to clear the static values; database-backed sources are left untouched.
876
878
  - op=SET_SEO_RENDERING_METHOD \u2014 Switch this WEB client's rendering method. The sitemap generation mode follows the editor: CSR selects the automatic mode, SSG the path-data mode, and SSR keeps the current one. SSG requires the project's SEO capability: the tool refuses it when the capability data reports none, and proceeds when that data is unavailable. SSR requires a single-tenant server and is always refused here, so it has to be set in the project settings. Leaving SSG clears the generated pages on the next publish.
877
879
  - op=SET_SEO_ROBOTS_TXT \u2014 Replace this WEB client's robots.txt content. The rendering method and sitemap mode are left untouched; send an empty string to clear the file.
878
- - op=UPDATE_SEO_PATH_DB_QUERY \u2014 Incrementally update one database-backed path source by index; send at least one of tableDisplayName, columnDisplayName or enable. Changing the table reseeds the query and clears its filters, as the editor does; changing only the column keeps them.`,ops:{ADD_SEO_PATH_DB_QUERY:"ADD_SEO_PATH_DB_QUERY",DELETE_SEO_PATH_DB_QUERY:"DELETE_SEO_PATH_DB_QUERY",DELETE_SEO_PATH_RANGE:"DELETE_SEO_PATH_RANGE",GET_SEO_INFO:"GET_SEO_INFO",GET_SEO_PAGE_DETAIL:"GET_SEO_PAGE_DETAIL",SET_SEO_PATH_STATIC_OPTIONS:"SET_SEO_PATH_STATIC_OPTIONS",SET_SEO_RENDERING_METHOD:"SET_SEO_RENDERING_METHOD",SET_SEO_ROBOTS_TXT:"SET_SEO_ROBOTS_TXT",UPDATE_SEO_PATH_DB_QUERY:"UPDATE_SEO_PATH_DB_QUERY"},inputSchema:{columnDisplayName:c.string().optional(),content:c.string().optional(),enable:c.boolean().optional(),index:c.number().optional(),options:c.array(c.any()).optional(),pageId:c.string().optional(),pathData:c.string().optional(),renderingMethod:c.enum(["CSR","SSR","SSG"]).optional(),tableDisplayName:c.string().optional()}},{name:"schema_tab_bar",tier:"catalog",description:`
880
+ - op=UPDATE_SEO_PATH_DB_QUERY \u2014 Incrementally update one database-backed path source by index; send at least one of tableDisplayName, columnDisplayName or enable. Changing the table reseeds the query and clears its filters, as the editor does; changing only the column keeps them.`,ops:{ADD_SEO_PATH_DB_QUERY:"ADD_SEO_PATH_DB_QUERY",DELETE_SEO_PATH_DB_QUERY:"DELETE_SEO_PATH_DB_QUERY",DELETE_SEO_PATH_RANGE:"DELETE_SEO_PATH_RANGE",GET_ALL_SEO_STRUCTURED_DATA_TYPES_INFO:"GET_ALL_SEO_STRUCTURED_DATA_TYPES_INFO",GET_SEO_INFO:"GET_SEO_INFO",GET_SEO_PAGE_DETAIL:"GET_SEO_PAGE_DETAIL",GET_SEO_STRUCTURED_DATA_TYPE_DETAIL:"GET_SEO_STRUCTURED_DATA_TYPE_DETAIL",SET_SEO_PATH_STATIC_OPTIONS:"SET_SEO_PATH_STATIC_OPTIONS",SET_SEO_RENDERING_METHOD:"SET_SEO_RENDERING_METHOD",SET_SEO_ROBOTS_TXT:"SET_SEO_ROBOTS_TXT",UPDATE_SEO_PATH_DB_QUERY:"UPDATE_SEO_PATH_DB_QUERY"},inputSchema:{columnDisplayName:c.string().optional(),content:c.string().optional(),enable:c.boolean().optional(),index:c.number().optional(),options:c.array(c.any()).optional(),pageId:c.string().optional(),pathData:c.string().optional(),renderingMethod:c.enum(["CSR","SSR","SSG"]).optional(),tableDisplayName:c.string().optional(),typeName:c.string().optional()}},{name:"schema_tab_bar",tier:"catalog",description:`
879
881
  Changes apply immediately; use schema_undo to revert the last change. Ops:
880
882
  - op=GET_TAB_BAR_INFO \u2014 The native tab bar of this client: whether it is on, its colours, and each slot with the page it opens, its label and whether it has icons. Take this before changing anything about the bottom navigation \u2014 the slot count is fixed and a page can be opened by only one tab, so the slots are what a change has to be expressed against.
881
883
  - op=SET_TAB_BAR_ENABLED \u2014 Show or hide this client's native tab bar \u2014 the bottom navigation the mini-program draws itself, not components on a page. Turning it on for the first time creates empty slots and shows none of them, so pair it with UPDATE_TAB_BAR_ITEMS in the same batch or the user sees no change.
@@ -972,7 +974,7 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
972
974
  - op=UPDATE_ZAI_CONFIG_INPUT_ARGS (req: configId, items)
973
975
  - op=UPDATE_ZAI_CONFIG_OUTPUT (req: configId)
974
976
  - op=UPDATE_ZAI_CONFIG_TOOL (req: configId, toolId)
975
- - op=UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS (req: configId, toolId)`,ops:{ADD_ZAI_CONFIGS:"ADD_ZAI_CONFIGS",ADD_ZAI_CONFIG_API_CONTEXTS:"ADD_ZAI_CONFIG_API_CONTEXTS",ADD_ZAI_CONFIG_DB_CONTEXTS:"ADD_ZAI_CONFIG_DB_CONTEXTS",ADD_ZAI_CONFIG_INPUT_ARGS:"ADD_ZAI_CONFIG_INPUT_ARGS",ADD_ZAI_CONFIG_TOOLS:"ADD_ZAI_CONFIG_TOOLS",DELETE_ZAI_CONFIGS:"DELETE_ZAI_CONFIGS",DELETE_ZAI_CONFIG_API_CONTEXTS:"DELETE_ZAI_CONFIG_API_CONTEXTS",DELETE_ZAI_CONFIG_DB_CONTEXTS:"DELETE_ZAI_CONFIG_DB_CONTEXTS",DELETE_ZAI_CONFIG_INPUT_ARGS:"DELETE_ZAI_CONFIG_INPUT_ARGS",DELETE_ZAI_CONFIG_TOOLS:"DELETE_ZAI_CONFIG_TOOLS",DUPLICATE_ZAI_CONFIG:"DUPLICATE_ZAI_CONFIG",GET_ALL_ZAI_CONFIGS_INFO:"GET_ALL_ZAI_CONFIGS_INFO",GET_ZAI_CONFIG_DETAIL:"GET_ZAI_CONFIG_DETAIL",GET_ZAI_CONFIG_SELECTABLE_TYPES:"GET_ZAI_CONFIG_SELECTABLE_TYPES",GET_ZAI_MODEL_OPTIONS:"GET_ZAI_MODEL_OPTIONS",UPDATE_ZAI_CONFIG:"UPDATE_ZAI_CONFIG",UPDATE_ZAI_CONFIG_API_CONTEXT:"UPDATE_ZAI_CONFIG_API_CONTEXT",UPDATE_ZAI_CONFIG_DB_CONTEXT:"UPDATE_ZAI_CONFIG_DB_CONTEXT",UPDATE_ZAI_CONFIG_INPUT_ARGS:"UPDATE_ZAI_CONFIG_INPUT_ARGS",UPDATE_ZAI_CONFIG_OUTPUT:"UPDATE_ZAI_CONFIG_OUTPUT",UPDATE_ZAI_CONFIG_TOOL:"UPDATE_ZAI_CONFIG_TOOL",UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS:"UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS"},inputSchema:{addRelations:c.array(c.any()).optional(),apiId:c.string().optional(),apiIds:c.array(c.any()).optional(),argKeys:c.array(c.any()).optional(),arrayLevel:c.number().optional(),clearLimit:c.boolean().optional(),columns:c.array(c.any()).optional(),configId:c.string().optional(),configIds:c.array(c.any()).optional(),customModelIdentifier:c.record(c.any()).optional(),description:c.string().optional(),enable:c.boolean().optional(),ignoreNullValuesFromContext:c.boolean().optional(),imageInputQuality:c.enum(["LOW","HIGH"]).optional(),inputDescriptionConfigs:c.record(c.any()).optional(),isStreaming:c.boolean().optional(),isStructured:c.boolean().optional(),items:c.array(c.any()).optional(),limit:c.number().optional(),maxRound:c.number().optional(),maxTokenSize:c.number().optional(),name:c.string().optional(),outputDescriptionConfig:c.record(c.any()).optional(),outputType:c.string().optional(),relationPath:c.array(c.any()).optional(),removeRelations:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional(),selectedFieldsByType:c.record(c.any()).optional(),slot:c.enum(["INPUT","OUTPUT"]).optional(),sourceZAiConfigId:c.string().optional(),tableDisplayName:c.string().optional(),tableDisplayNames:c.array(c.any()).optional(),temperature:c.number().optional(),toolId:c.string().optional(),toolIds:c.array(c.any()).optional()}}],NU={ADD_VIEWS:"DATA_MODEL_VIEW_2610",ANALYZE_VIEW_SQL:"DATA_MODEL_VIEW_2610",DELETE_VIEWS:"DATA_MODEL_VIEW_2610",GET_VIEWS_INFO:"DATA_MODEL_VIEW_2610",GET_VIEW_PERMISSION:"DATA_MODEL_VIEW_2610",UPDATE_ROLE_VIEW_PERMISSION:"DATA_MODEL_VIEW_2610",UPDATE_VIEWS:"DATA_MODEL_VIEW_2610"};var HP={"actionflow.list_node_templates":{description:"List the preset action-flow integration nodes (the TEMPLATE_CODE catalog \u2014 e.g. SMS, video/AI generation) for planning: each template\u2019s templateCodeId, displayName, group, async flag, and input/output param types. To add one, read schema_actionflow_node op=BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS at the position and pass that entry\u2019s `node` to op=ADD_NODE. A TEMPLATE_CODE node already in the schema carries one of these templateCodeIds; never rewrite it to an id from anywhere else.",tool:{name:"list_actionflow_node_templates"},cli:{path:"actionflow list-node-templates"}},"component.tab_bar_icons":{description:"The preset tab-bar icons this deployment ships, as name and media exId \u2014 home, cart, chat, profile and the rest. A tab that is shown needs an icon for both its normal and its selected state or the project reports an error, and the exIds are hashids of media rows that cannot be derived from an icon\u2019s name, so take them from here before schema_tab_bar op=UPDATE_TAB_BAR_ITEMS \u2014 that tool rejects a value that could not be an exId rather than letting the mini-program build fail over a file it cannot find. To use an icon that is not in the list, upload it in the editor and use the exId it is stored under.",tool:{name:"get_tab_bar_icons"},cli:{path:"component tab-bar-icons"}},"component.capture_canvas":{description:"Screenshot a page or component as it renders, once the latest schema change has been applied, and save it as a PNG whose path it prints. pageId picks the page; componentId crops to one component, or renders it alone with mode ISOLATED; breakpoint picks a breakpoint other than the primary one; out sets the file path. Renders in a headless Chrome or Edge on this machine. A shot that can't be taken comes back as unavailable with a reason and a note instead of a path.",cli:{path:"component capture-canvas"}},"workspace.set":{description:"Set the workspace root for local credentials, daemon registry, and project context.",tool:{name:"set_current_working_directory",inputSchema:{cwd:c.string()}}},"auth.login":{description:"Start browser login and save credentials.",cli:{path:"login"}},"auth.logout":{description:"Delete local credentials and unload schema sessions.",cli:{path:"logout"}},"auth.whoami":{description:"Show the currently authenticated account token payload.",cli:{path:"whoami"}},"auth.reauth":{description:"Delete credentials and start login again.",cli:{path:"reauth"}},"account.profile":{description:"Fetch current account and organization/project-space metadata used for project creation.",tool:{name:"get_account_profile"},cli:{path:"account profile",alias:"account me"}},"projects.search":{description:"List/search projects with pagination.",tool:{name:"get_projects",inputSchema:{projectName:c.string().optional(),cursor:c.string().nullable().optional(),limit:c.number().optional()}},cli:{path:"projects search"}},"projects.list":{description:"List projects.",cli:{path:"projects list"}},"project.create":{description:"Create a new blank project in the current account organization and wait for it to appear in search. A project is a backend plus at most one client app, named by appType \u2014 pick it with the user: the free plan pays for one client. WEB, WECHAT_MINI_PROGRAM (Zion only) and MOBILE (iOS) each create a client this project hosts: build its pages with these tools, or deploy your own build to a WEB client with site deploy. BACKEND_ONLY creates no client, for a front end hosted elsewhere that calls the project's generated GraphQL API. These tools cannot add a client to an existing project, and a second one is a paid client slot bought in the console, so pick the client the user wants now. It comes back as builtInApp, already current, so UI calls need no appExId.",tool:{name:"create_project",inputSchema:{projectName:c.string(),appType:c.enum(["WEB","WECHAT_MINI_PROGRAM","MOBILE","BACKEND_ONLY"]),appName:c.string().optional(),projectSpaceType:c.string().optional(),organizationExId:c.string().optional(),category:c.string().nullable().optional(),wait:c.boolean().optional(),timeoutMs:c.number().optional()}},cli:{path:"project create"}},"project.set_current":{description:"Set the project every later call defaults to. With no appExId it also makes that project\u2019s only client current (the client session holds its pages and the project backend both), and a project with no client defaults to its backend document. A project with several clients is refused, listing them, and leaves the current project as it was: pages belong to one client, so pass appExId to name it \u2014 or appExId: null to address the backend alone.",tool:{name:"set_current_project",inputSchema:{projectExId:c.string(),appExId:c.string().nullable().optional()}},cli:{path:"project set-current"}},"project.get_current":{description:"Get the current project context: the pinned project and the client app calls default to (appExId null means they address the project\u2019s own backend document).",tool:{name:"get_current_project"},cli:{path:"project current",alias:"project get-current"}},"project.detail":{description:"Fetch the project's detail payload: app list, project config, the backend document's latest schema metadata, and deployment info. Answers for the project itself, not for the current client \u2014 pass appExId to get one client app's own detail instead.",cli:{path:"project detail"}},"project.metadata":{description:"Fetch a lean project summary: identity, platforms, publish/deploy state (incl. hasUndeployedChanges), configured integrations, plan, capabilities, and RPS. Pass raw=true for the full unshaped payload. Deploy state belongs to the project's backend document, so naming a client with appExId leaves it out.",cli:{path:"project metadata",alias:"project inspect"}},"project.resources":{description:"Fetch project resource consumption, plan/capability limits, RPS stats, and optional resource history.",cli:{path:"project resources"}},"project.rename":{description:"Rename a project.",tool:{name:"rename_project",inputSchema:{...ye,projectName:c.string()}},cli:{path:"project rename"}},"project.rename_app":{description:"Rename an app inside a project.",tool:{name:"rename_project_app",inputSchema:{projectExId:c.string(),appExId:c.string(),appName:c.string()}},cli:{path:"project rename-app"}},"project.delete":{description:"Delete a project. IRREVERSIBLE: requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve. Set MCP_HITL=off to fall back to the confirmProjectExId/force text gate in headless automation.",tool:{name:"delete_project",inputSchema:{projectExId:c.string(),confirmProjectExId:c.string().optional(),force:c.boolean().optional()}},cli:{path:"project delete"}},"project.reset":{description:"Reset a project. IRREVERSIBLE: requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve. Set MCP_HITL=off to fall back to the confirmProjectExId/force text gate in headless automation.",tool:{name:"reset_project",inputSchema:{projectExId:c.string(),confirmProjectExId:c.string().optional(),force:c.boolean().optional(),languageType:c.string().optional()}},cli:{path:"project reset"}},"project.sync_backend":{description:"Save the schema and deploy/sync the project runtime backend. Returns ztype diagnostics and blocks on backend validation errors by default.",tool:{name:"sync_backend",inputSchema:{...ye,buildTarget:c.string().optional(),validateMultiClient:c.boolean().optional(),allowValidationErrors:c.boolean().optional()}},cli:{path:"project sync-backend",alias:"project deploy-backend"}},"schema.load":{description:"Load a project's CRDT schema into the daemon's in-memory headless schema session.",cli:{path:"schema load"}},"schema.reload":{description:"Force reload a project schema session from the backend CRDT model and patch log.",cli:{path:"schema reload"}},"schema.status":{description:"Show daemon schema sessions and TTL state.",tool:{name:"schema_status"},cli:{path:"schema status"}},"schema.state":{description:"Read the daemon's schema revision, stale state, and latest semantic schema-change event for a project.",cli:{path:"schema state"}},"schema.events":{description:"Read recent semantic schema-change events observed by the daemon for a project.",cli:{path:"schema events"}},"schema.sync":{description:"Catch up schema CRDT patches from the backend for the loaded project session.",cli:{path:"schema sync"}},"schema.snapshot":{description:"Return the data model of the loaded schema (tables, relations, enum types). Pass full=true for the entire raw ZSchema document (UI tree + all server configs), which is much larger.",cli:{path:"schema snapshot"}},"schema.validate":{description:"Run ztype validation/type checks against the loaded schema and return stable/beta/backend diagnostics.",cli:{path:"schema validate",alias:"schema type-check"}},"bridge.flow_definition":{description:"Resolve an action flow to the definition the debug mutation takes, plus its terminal end node. Derived from the draft CRDT, so it answers with no editor tab attached.",cli:{path:"bridge flow-definition"}},"bridge.debug_flow":{description:"Run an action flow definition as a debug run with the project admin credential and return every node's output in run order, the same run the editor's flow debugger performs. A run still going when the time is up comes back with what it has and timedOut set.",cli:{path:"bridge debug-flow"}},"bridge.agent_definition":{description:"Resolve an AI agent to the definition, custom model config and type definitions its debug conversation takes, derived from the draft CRDT.",cli:{path:"bridge agent-definition"}},"bridge.trigger_bindings":{description:"List database and scheduled trigger bindings with their flow names, table names and enabled state, derived from the draft CRDT.",cli:{path:"bridge trigger-bindings"}},"bridge.deploy_status":{description:"Compare the draft schema against the last deployed server schema and report which of the eleven server areas differ. Unlike project.inspect this diffs content against the *draft*, so unsaved edits count as pending changes.",cli:{path:"bridge deploy-status"}},"bridge.project_errors":{description:"List the project validation errors and warnings in the shape the editor reports them, newest ztype run, capped by limit. Same union and order as the editor panel.",cli:{path:"bridge project-errors"}},"bridge.sync_backend":{description:"Save the draft schema, deploy the backend and wait for the pipeline, reporting the outcome in the shape the editor reports it. A deploy already running is waited for, not restarted.",cli:{path:"bridge sync-backend"}},"bridge.clipped_components":{description:"Measure which components on a page render clipped (content larger than their box), in the shape the editor reports. Renders the canvas in a headless browser owned by the daemon, after it has applied the latest schema patch.",cli:{path:"bridge clipped-components"}},"bridge.capture_canvas":{description:"Screenshot a page or component as the editor canvas renders it and store it as the agent session's media. Same headless renderer and patch wait as bridge clipped-components.",cli:{path:"bridge capture-canvas"}},"schema.ztype_tool_calls":{description:"Run ztype Copilot tool calls against the loaded schema as one atomic batch: either every call lands or none does, and `applied` reports which. A batch ztype rejects, or whose patch trips validation, reports errors with errorCode/failedIndex and applies nothing \u2014 pass force to apply over a DEPENDENCY_CONFLICT. Use schema_undo to revert the last change.",tool:{name:"ztype_tool_calls",inputSchema:{...ye,toolCalls:c.array(c.record(c.any())),verbose:c.boolean().optional(),readState:c.record(c.any()).optional(),force:c.boolean().optional()}},cli:{path:"schema tool-call",alias:"schema tool-calls"}},"schema.undo":{description:"Undo the most recent schema change made in this session by applying a reverse CRDT patch. Refuses if a concurrent edit touched the same path. Pairs with schema_redo.",tool:{name:"schema_undo",inputSchema:{...ye}},cli:{path:"schema undo"}},"schema.redo":{description:"Re-apply the schema change most recently undone via schema_undo in this session.",tool:{name:"schema_redo",inputSchema:{...ye}},cli:{path:"schema redo"}},"secret.save_value":{description:"Prompt the user (native GUI dialog) to set a secret's plaintext value, store it, and attach the handle so the secret reports hasValue:true. Provide secretId (an existing secret) OR displayName (create a new one). The value is typed into the dialog and never passes through this tool call or the model. Requires a desktop session (fails on headless/SSH/CI).",tool:{name:"save_secret_value",inputSchema:{...ye,secretId:c.string().optional(),displayName:c.string().optional(),description:c.string().optional()}},cli:{path:"secret save-value"}},"runtime.graphql":{description:"Run a raw GraphQL operation against the deployed project's runtime backend (the auto-generated data/actionflow/AI API), as admin.",tool:{name:"runtime_graphql",inputSchema:{...ye,query:c.string(),variables:c.record(c.any()).optional()}},cli:{path:"runtime graphql"}},"runtime.run_code":{description:"Execute a JavaScript snippet in the deployed project's Run Code sandbox and return its result. Database writes are reverted unless updateDb is true, so this is the cheap way to check what a Run Code node will actually return before wiring it into a flow. Runs on the admin surface, as admin.",tool:{name:"runtime_run_code",inputSchema:{...ye,jsCode:c.string(),args:c.record(c.any()).optional(),updateDb:c.boolean().optional()}},cli:{path:"runtime run-code"}},"runtime.query":{description:"Query rows from a deployed project's runtime table.",cli:{path:"runtime query"}},"runtime.aggregate":{description:"Count rows matching a filter in a deployed project's runtime table \u2014 the cheapest assertion available.",cli:{path:"runtime aggregate"}},"runtime.insert":{description:"Insert one or more rows into a deployed project's runtime table.",cli:{path:"runtime insert"}},"runtime.update":{description:"Update rows in a deployed project's runtime table.",cli:{path:"runtime update"}},"runtime.delete":{description:"Delete rows from a deployed project's runtime table. Requires where unless allowDeleteAll=true.",cli:{path:"runtime delete"}},"logs.search":{description:`Fetch recent runtime logs from the project's log endpoint. Window is \xB15 minutes around requestCreatedAt (ISO-8601, defaults to now). types: GATEWAY, ACTION_FLOW, ACTION_FLOW_NODE, ACTION_FLOW_CONTEXT_LOG, DEPLOYMENT, TPA, TRIGGER, SQL_GENERATION, GQL, ZAI. levels: INFO, WARNING, ERROR. customQueryCondition is an Elasticsearch condition (e.g. 'traceId: "abc-123"').`,tool:{name:"search_logs",inputSchema:{...ye,requestCreatedAt:c.string().optional(),types:c.array(c.string()).optional(),levels:c.array(c.string()).optional(),customQueryCondition:c.string().optional(),limit:c.number().optional()}},cli:{path:"logs search"}},"docs.search":{description:"Full-text search the bundled product documentation. Returns the best-matching pages as { path, title, url }, where url is the public HTTPS docs link you can cite. Use docs.get_page with a returned path to read a page.",tool:{name:"search_docs",inputSchema:{query:c.string(),limit:c.number().optional()}},cli:{path:"docs search"}},"docs.get_page":{description:'Fetch a documentation page as markdown by its path (as returned by docs.search, e.g. "/02_design/01_layout_concepts").',tool:{name:"get_doc_page",inputSchema:{path:c.string()}},cli:{path:"docs get-page"}},"platform.graphql":{description:"Raw GraphQL passthrough to the platform backend (projects, accounts, deployments \u2014 the editor/meta API, not the deployed runtime). Queries pass through unchanged; mutations are refused except a short allow list for client builds and code component versions, which the refusal names.",tool:{name:"platform_graphql",inputSchema:{query:c.string(),variables:c.record(c.any()).optional()}},cli:{path:"platform graphql"}},"web.fetch_doc":{description:"Fetch a web page or spec by URL for reading. Returns the page content (HTML converted to Markdown; long pages are windowed \u2014 pass `offset` with the same url to keep reading, guided by `totalLength`/`truncated`), same-site `pageLinks` to explore the documentation further, and any OpenAPI/Swagger `specLinks` found. Explore iteratively by fetching returned links, within a budget of 15 fetches per session (`fetchesRemaining`). Build the endpoints you read about with the api schema ops.",tool:{name:"fetch_api_doc",inputSchema:{url:c.string(),offset:c.number().optional()}},cli:{path:"web fetch-doc"}},"site.deploy":{description:"Deploy a built frontend directory (e.g. ./dist) to the project\u2019s hosted static site and return the live url. Scans the directory, declares the manifest, uploads every asset to object storage, and switches the site over in one call \u2014 the agent never handles checksums or upload urls itself. `target` is BETA (default) or PROD; a PROD deploy takes the site live and requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve, and `force` does NOT approve it. Set MCP_HITL=off to fall back to the confirmProjectExId text gate in headless automation. An interrupted run resumes automatically when the directory is unchanged; pass `force` to discard it and start over. `dryRun` reports what would be uploaded without creating a deployment. The total size must fit the project\u2019s remaining object storage, and the directory must contain an index.html.",tool:{name:"deploy_static_site",inputSchema:{...ye,dir:c.string(),target:c.string().optional(),dryRun:c.boolean().optional(),force:c.boolean().optional(),concurrency:c.number().optional(),confirmProjectExId:c.string().optional()}},cli:{path:"site deploy"}},"site.status":{description:"Report the project\u2019s static site: the currently live deployment (with its url) and any upload still in progress. Use to find the site url, or to see whether an interrupted deploy is still resumable.",tool:{name:"get_static_site_status",inputSchema:{...ye,target:c.string().optional()}},cli:{path:"site status"}},"site.abort":{description:"Abandon an in-progress static site upload and delete whatever it already uploaded. Targets the current in-progress deployment unless `deploymentExId` names one. The live site is untouched.",tool:{name:"abort_static_site_deployment",inputSchema:{...ye,target:c.string().optional(),deploymentExId:c.string().optional()}},cli:{path:"site abort"}},"wechat.deploy":{description:"Upload a locally-developed WeChat mini program source tree (the directory holding app.json) to the project and start the server-side build that commits it to WeChat as the \u4F53\u9A8C\u7248 (trial version). Scans the directory, declares the manifest, uploads every file to object storage, and hands off to the build job in one call \u2014 the agent never handles checksums or upload urls itself. By default it then WAITS for the build and returns the trial version number plus the path of the trial QR code image it saved (`wait: false` returns as soon as the build starts; `timeoutSeconds` bounds the wait). Requires the project to have granted Zion third-party platform authorization. An interrupted run resumes automatically when the directory is unchanged; pass `force` to discard it and start over. `dryRun` reports what would be uploaded without creating a deployment. This does NOT submit for audit or release \u2014 it only produces a trial version to verify; submitting it for review and releasing it are done by the user in the editor, not from here.",tool:{name:"deploy_wechat_source_code",inputSchema:{...ye,dir:c.string(),dryRun:c.boolean().optional(),force:c.boolean().optional(),wait:c.boolean().optional(),timeoutSeconds:c.number().optional(),qrOut:c.string().optional(),concurrency:c.number().optional()}},cli:{path:"wechat deploy"}},"wechat.status":{description:"Report the project\u2019s WeChat mini program source upload: any upload still in progress and any build already running (with its deploymentRecordExId and start time). Use to poll a build after `wechat deploy`, or to see whether an interrupted upload is still resumable.",tool:{name:"get_wechat_source_code_status",inputSchema:{...ye}},cli:{path:"wechat status"}},"wechat.abort":{description:"Abandon an in-progress WeChat mini program source upload and delete whatever it already uploaded. Targets the current in-progress deployment unless `deploymentExId` names one. A deployment that already reached BUILDING cannot be aborted.",tool:{name:"abort_wechat_source_code_deployment",inputSchema:{...ye,deploymentExId:c.string().optional()}},cli:{path:"wechat abort"}},"wechat.qrcode":{description:"Save the WeChat trial version (\u4F53\u9A8C\u7248) QR code of the project\u2019s mini program to a local image file and return its path, along with the trial version number and the time it was committed. The QR code is written to disk rather than returned inline because it is a JPEG. Available once a `wechat deploy` build has succeeded; scanning it opens the trial version on a phone whose WeChat id is bound as a tester.",tool:{name:"get_wechat_trial_qrcode",inputSchema:{...ye,out:c.string().optional()}},cli:{path:"wechat qrcode"}}},Hg=Object.entries(HP).map(([t,e])=>({command:t,...e})),Yg=[{name:"schema_session",description:"Schema session lifecycle for the loaded project. op: LOAD (warm the in-memory CRDT session) | RELOAD (force reload from backend) | SYNC (catch up patches) | SNAPSHOT (return the data model: tables, relations, enum types; pass full=true for the entire raw document) | VALIDATE (ztype type checks, stable/beta/backend diagnostics). Edits do not go live until sync_backend.",ops:{LOAD:"schema.load",RELOAD:"schema.reload",SYNC:"schema.sync",SNAPSHOT:"schema.snapshot",VALIDATE:"schema.validate"},inputSchema:{...ye,full:c.boolean().optional()}},{name:"schema_observe",description:"Read the daemon's schema change-state for a project. op: STATE (revision, stale flag, latest change event) | EVENTS (recent semantic schema-change events; afterEventId/limit paginate).",ops:{STATE:"schema.state",EVENTS:"schema.events"},inputSchema:{projectExId:c.string().optional(),afterEventId:c.string().nullable().optional(),limit:c.number().optional()}},{name:"auth",description:"Authentication. op: LOGIN (browser login + save credentials) | LOGOUT (delete credentials, unload sessions) | WHOAMI (show authenticated account token payload) | REAUTH (delete credentials and log in again).",ops:{LOGIN:"auth.login",LOGOUT:"auth.logout",WHOAMI:"auth.whoami",REAUTH:"auth.reauth"}},{name:"project_inspect",description:"Inspect a project. op: DETAIL (app list, project config, latest schema metadata, deployment) | METADATA (plan/capability, deployment, app list, schema metadata, RPS summary) | RESOURCES (resource consumption, plan limits, RPS, optional history). includeSecrets applies to DETAIL/METADATA; refresh/resourceType/nonRealTimeDisplayedResourceTypes apply to RESOURCES.",ops:{DETAIL:"project.detail",METADATA:"project.metadata",RESOURCES:"project.resources"},inputSchema:{...ye,includeSecrets:c.boolean().optional(),refresh:c.boolean().optional(),resourceType:c.string().optional(),nonRealTimeDisplayedResourceTypes:c.array(c.string()).optional()}}];u();u();var YP={schema_table:"database",schema_view:"database",schema_common:"database",schema_overview:"database",schema_type:"type",schema_binding_inspect:"bindings",schema_create_binding:"bindings",schema_conditional_branch:"bindings",schema_custom_array_binding:"bindings",schema_condition_expr:"bindings",schema_request_filter:"bindings",schema_actionflow:"actionflow",schema_actionflow_node:"actionflow",schema_trigger:"actionflow",schema_api:"api",schema_component:"component",schema_action_menu:"component",schema_theme:"component",schema_tab_bar:"component",schema_seo:"component",schema_client_variables:"component",schema_verification_code_config:"component",schema_authentication:"component",schema_permission:"permissions",schema_secret:"secret",schema_zai_config:"zai",schema_callback:"webhook",schema_payment:"payments"},Kg=t=>YP[t]??"UNMAPPED",KP={database:'Edit the data model \u2014 tables, columns, relations, unique constraints, display names. op is a schema ToolName from the enum; args is its payload. Call guide {plugin:"database"} first for the rules and per-op arg shapes.',type:'Edit enums and object/custom type definitions. op is a schema ToolName; args is its payload. Call guide {plugin:"type"} for the rules and arg shapes.',bindings:'Create and edit data bindings \u2014 option/const/formula/conditional bindings, boolean condition expressions, and request filters (where + sort), all addressed by schemaPath. op is a schema ToolName; args is its payload. Call guide {plugin:"bindings"} for the rules and arg shapes.',actionflow:'Edit server-side action flows \u2014 flows, nodes, branches, I/O, global variables, and triggers (scheduled / database-change). op is a schema ToolName; args is its payload. Call guide {plugin:"actionflow"} for the rules and arg shapes.',api:'Edit the API-integration library \u2014 workspaces, APIs, request parameters, response configs, input variables, and workspace constants. op is a schema ToolName; args is its payload. Call guide {plugin:"api"} for the rules and arg shapes.',secret:'Register, update, and delete project secrets (API keys and tokens) by handle \u2014 never their plaintext. op is a schema ToolName; args is its payload. Call guide {plugin:"secret"} for the rules and arg shapes.',zai:'Edit ZAI AI-agent configs \u2014 agents, input args, and model settings. op is a schema ToolName; args is its payload. Call guide {plugin:"zai"} for the rules and arg shapes.',component:`Build and edit the UI \u2014 pages, containers, components, slots, properties, styles and responsive breakpoints, plus the design system (color themes, style scale), the client's app-wide variables, SEO path ranges, and custom verification-code delivery channels. op is a schema ToolName; args is its payload. Call guide {plugin:"component"} first for the tree rules, component templates, and per-op arg shapes.`,permissions:'Edit roles and their table, API, action-flow, AI, and payment permissions. op is a schema ToolName; args is its payload. Call guide {plugin:"permissions"} for the rules and arg shapes.',webhook:'Edit incoming HTTP triggers (webhooks, called callbacks in the schema) \u2014 the bound action flow, request and response body shapes, body codecs, and the provider protocol. op is a schema ToolName; args is its payload. Call guide {plugin:"webhook"} for the rules and arg shapes.',payments:'Design and wire up payments: pick the model the project uses (legacy activation or payment configs), configure providers and credentials, and bind the callback fulfillment flows. op is a schema ToolName; args is its payload. Call guide {plugin:"payments"} for the rules and arg shapes.'},Jg=(()=>{let t=new Map;for(let e of Ns){let n=Kg(e.name);if(n==="UNMAPPED")continue;let r=t.get(n)??new Set;for(let o of Object.values(e.ops))r.add(o);t.set(n,r)}return[...t.entries()].map(([e,n])=>({name:e,description:KP[e]??`Edit ${e}.`,ops:[...n].sort()})).sort((e,n)=>e.name.localeCompare(n.name))})(),MU=Ns.filter(t=>Kg(t.name)==="UNMAPPED").map(t=>t.name);function JP(){let t=[];for(let e of Hg){if(!e.tool)continue;let{name:n,aliases:r,inputSchema:o}=e.tool;t.push({name:n,description:e.description,command:e.command,inputSchema:o});for(let a of r??[])t.push({name:a.name,description:a.description??e.description,command:e.command,inputSchema:o})}return t}function ZU(t,e){Zg(t,JP(),e),Bg(t,Yg,e),qg(t,Jg,e),Vg(t),Wg(t,e)}u();u();var XP={productName:"Zion",utcOffset:"+08:00",accountTable:"\u5E10\u6237(\u8D26\u6237)",paymentTables:"\u652F\u4ED8, \u5468\u671F\u6027\u652F\u4ED8, \u9000\u6B3E",aiTables:"\u4F1A\u8BDD, \u6D88\u606F, \u5DE5\u5177\u4F7F\u7528\u8BB0\u5F55, \u6D88\u606F\u5185\u5BB9",displayNameRule:'user-visible; use the natural Chinese name as the displayName and derive the English snake_case apiName from it (e.g. displayName "\u7528\u6237\u540D" \u2192 apiName "user_name").',enumDisplayNameRule:'use a natural Chinese phrase (enum displayName "\u8BA2\u5355\u72B6\u6001", option displayName "\u5F85\u5904\u7406"); the enum id and option values stay English.',runtimeGraphqlUrl:t=>Fn().zeroApiUrlTemplate.replace("{projectExId}",t)},QP={productName:"Momen",utcOffset:"+00:00",accountTable:"account",paymentTables:"payment_record, recurring_payment, refund",aiTables:"conversation, message, tool_usage_record, message_content",displayNameRule:'user-visible; prefer it IDENTICAL to the apiName (e.g. apiName "first_name" \u2192 displayName "first_name").',enumDisplayNameRule:'keep it close to the name/value itself (enum displayName \u2248 the enum name, e.g. "OrderStatus"; an option displayName \u2248 its value, e.g. "PENDING").',runtimeGraphqlUrl:t=>Fn().zeroApiUrlTemplate.replace("{projectExId}",t)},Ps=()=>{switch(Un){case"MOMEN":return QP;case"ZION":return XP;default:throw new Error(`[product-context] unknown PRODUCT '${Un}'`)}};u();function Xg({brand:t,zeroApiUrl:e}){let n=e.replace(/^http:/,"ws:").replace(/^https:/,"wss:").replace("/api/graphql-v2","/api/graphql-subscription");return{brand:t,zeroApiUrl:e,zeroSubscriptionUrl:n}}function Qg(t){let e=t.brand==="Zion"?"Zion apps conventionally sign up / log in by phone number (SMS code); email and username work too.":"Momen apps conventionally sign up / log in by email; phone (SMS code) and username work too.";return`## App-user authentication (for the frontend you generate)
977
+ - op=UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS (req: configId, toolId)`,ops:{ADD_ZAI_CONFIGS:"ADD_ZAI_CONFIGS",ADD_ZAI_CONFIG_API_CONTEXTS:"ADD_ZAI_CONFIG_API_CONTEXTS",ADD_ZAI_CONFIG_DB_CONTEXTS:"ADD_ZAI_CONFIG_DB_CONTEXTS",ADD_ZAI_CONFIG_INPUT_ARGS:"ADD_ZAI_CONFIG_INPUT_ARGS",ADD_ZAI_CONFIG_TOOLS:"ADD_ZAI_CONFIG_TOOLS",DELETE_ZAI_CONFIGS:"DELETE_ZAI_CONFIGS",DELETE_ZAI_CONFIG_API_CONTEXTS:"DELETE_ZAI_CONFIG_API_CONTEXTS",DELETE_ZAI_CONFIG_DB_CONTEXTS:"DELETE_ZAI_CONFIG_DB_CONTEXTS",DELETE_ZAI_CONFIG_INPUT_ARGS:"DELETE_ZAI_CONFIG_INPUT_ARGS",DELETE_ZAI_CONFIG_TOOLS:"DELETE_ZAI_CONFIG_TOOLS",DUPLICATE_ZAI_CONFIG:"DUPLICATE_ZAI_CONFIG",GET_ALL_ZAI_CONFIGS_INFO:"GET_ALL_ZAI_CONFIGS_INFO",GET_ZAI_CONFIG_DETAIL:"GET_ZAI_CONFIG_DETAIL",GET_ZAI_CONFIG_SELECTABLE_TYPES:"GET_ZAI_CONFIG_SELECTABLE_TYPES",GET_ZAI_MODEL_OPTIONS:"GET_ZAI_MODEL_OPTIONS",UPDATE_ZAI_CONFIG:"UPDATE_ZAI_CONFIG",UPDATE_ZAI_CONFIG_API_CONTEXT:"UPDATE_ZAI_CONFIG_API_CONTEXT",UPDATE_ZAI_CONFIG_DB_CONTEXT:"UPDATE_ZAI_CONFIG_DB_CONTEXT",UPDATE_ZAI_CONFIG_INPUT_ARGS:"UPDATE_ZAI_CONFIG_INPUT_ARGS",UPDATE_ZAI_CONFIG_OUTPUT:"UPDATE_ZAI_CONFIG_OUTPUT",UPDATE_ZAI_CONFIG_TOOL:"UPDATE_ZAI_CONFIG_TOOL",UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS:"UPDATE_ZAI_CONFIG_TOOL_DESCRIPTION_CONFIGS"},inputSchema:{addRelations:c.array(c.any()).optional(),apiId:c.string().optional(),apiIds:c.array(c.any()).optional(),argKeys:c.array(c.any()).optional(),arrayLevel:c.number().optional(),clearLimit:c.boolean().optional(),columns:c.array(c.any()).optional(),configId:c.string().optional(),configIds:c.array(c.any()).optional(),customModelIdentifier:c.record(c.any()).optional(),description:c.string().optional(),enable:c.boolean().optional(),ignoreNullValuesFromContext:c.boolean().optional(),imageInputQuality:c.enum(["LOW","HIGH"]).optional(),inputDescriptionConfigs:c.record(c.any()).optional(),isStreaming:c.boolean().optional(),isStructured:c.boolean().optional(),items:c.array(c.any()).optional(),limit:c.number().optional(),maxRound:c.number().optional(),maxTokenSize:c.number().optional(),name:c.string().optional(),outputDescriptionConfig:c.record(c.any()).optional(),outputType:c.string().optional(),relationPath:c.array(c.any()).optional(),removeRelations:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional(),selectedFieldsByType:c.record(c.any()).optional(),slot:c.enum(["INPUT","OUTPUT"]).optional(),sourceZAiConfigId:c.string().optional(),tableDisplayName:c.string().optional(),tableDisplayNames:c.array(c.any()).optional(),temperature:c.number().optional(),toolId:c.string().optional(),toolIds:c.array(c.any()).optional()}}],LU={ADD_FORMULA_PARAMETERS:"FORMULA_INPUT_2609",ADD_VIEWS:"DATA_MODEL_VIEW_2610",ANALYZE_VIEW_SQL:"DATA_MODEL_VIEW_2610",DELETE_FORMULA_PARAMETERS:"FORMULA_INPUT_2609",DELETE_VIEWS:"DATA_MODEL_VIEW_2610",GET_FORMULA_PARAMETER_SELECTABLE_TYPES:"FORMULA_INPUT_2609",GET_VIEWS_INFO:"DATA_MODEL_VIEW_2610",GET_VIEW_PERMISSION:"DATA_MODEL_VIEW_2610",SEED_FORMULA_ARGUMENTS:"FORMULA_INPUT_2609",UPDATE_FORMULA_PARAMETERS:"FORMULA_INPUT_2609",UPDATE_ROLE_VIEW_PERMISSION:"DATA_MODEL_VIEW_2610",UPDATE_VIEWS:"DATA_MODEL_VIEW_2610"};var Cs=c.string().describe("Absolute path, starting with /project or /user."),Yg=c.string().optional().describe("Directory or file, starting with /project or /user; omit for both."),Kg=c.string().optional().describe("Only paths matching this glob, relative to path (or absolute when it starts with /): * and ? stay within a folder, ** crosses folders, {a,b} is either."),Jg={READ_FILE:{path:Cs,offset:c.number().optional().describe("1-indexed line to start from."),limit:c.number().optional().describe("How many lines to return.")},WRITE_FILE:{path:Cs,content:c.string().describe("The whole new content.")},EDIT_FILE:{path:Cs,old_string:c.string().describe("Exact text to replace; must match the current file verbatim."),new_string:c.string().describe("The replacement text."),replace_all:c.boolean().optional().describe("Replace every occurrence instead of requiring exactly one.")},LIST_FILES:{path:Yg,glob:Kg},GREP_FILES:{pattern:c.string().describe("Regular expression on PostgreSQL's engine: \\d \\w \\s, classes, lookaround and backreferences work, \\b means a word boundary; \\p{...} and named groups do not."),path:Yg,glob:Kg,type:c.string().optional().describe("Only files of this type, like rg --type: md, txt, html, css, js, ts, json, jsonl, yaml, toml, xml, csv, sql, py, sh."),output_mode:c.enum(["FILES_WITH_MATCHES","CONTENT","COUNT"]).optional().describe("FILES_WITH_MATCHES (default) lists matching files, CONTENT prints matching lines, COUNT prints path:count."),ignore_case:c.boolean().optional(),line_number:c.boolean().optional().describe("CONTENT only: prefix line numbers. Defaults to true."),before_context:c.number().optional(),after_context:c.number().optional(),context:c.number().optional(),only_matching:c.boolean().optional(),multiline:c.boolean().optional().describe("Let a match span lines, like rg -U --multiline-dotall."),head_limit:c.number().optional().describe("At most this many output lines or entries; 100 by default, 0 for all."),offset:c.number().optional().describe("Skip this many output lines or entries first, to page.")},RENAME_FILE:{old_path:c.string().describe("The file or directory to move."),new_path:c.string().describe("Where it goes; must not exist yet.")},DELETE_FILE:{path:Cs,recursive:c.boolean().optional().describe("Required to delete a directory and everything under it.")}},Mn=(t,e)=>({path:t,inputSchema:{...ge,...Jg[e]}}),QP={"actionflow.list_node_templates":{description:"List the preset action-flow integration nodes (the TEMPLATE_CODE catalog \u2014 e.g. SMS, video/AI generation) for planning: each template\u2019s templateCodeId, displayName, group, async flag, and input/output param types. To add one, read schema_actionflow_node op=BROWSE_ACTION_FLOW_ADD_NODE_OPTIONS at the position and pass that entry\u2019s `node` to op=ADD_NODE. A TEMPLATE_CODE node already in the schema carries one of these templateCodeIds; never rewrite it to an id from anywhere else.",tool:{name:"list_actionflow_node_templates"},cli:{path:"actionflow list-node-templates"}},"component.tab_bar_icons":{description:"The preset tab-bar icons this deployment ships, as name and media exId \u2014 home, cart, chat, profile and the rest. A tab that is shown needs an icon for both its normal and its selected state or the project reports an error, and the exIds are hashids of media rows that cannot be derived from an icon\u2019s name, so take them from here before schema_tab_bar op=UPDATE_TAB_BAR_ITEMS \u2014 that tool rejects a value that could not be an exId rather than letting the mini-program build fail over a file it cannot find. To use an icon that is not in the list, upload it in the editor and use the exId it is stored under.",tool:{name:"get_tab_bar_icons"},cli:{path:"component tab-bar-icons"}},"component.capture_canvas":{description:"Screenshot a page or component as it renders, once the latest schema change has been applied, and save it as a PNG whose path it prints. pageId picks the page; componentId crops to one component, or renders it alone with mode ISOLATED; breakpoint picks a breakpoint other than the primary one; out sets the file path. Renders in a headless Chrome or Edge on this machine. A shot that can't be taken comes back as unavailable with a reason and a note instead of a path.",cli:{path:"component capture-canvas"}},"workspace.set":{description:"Set the workspace root for local credentials, daemon registry, and project context.",tool:{name:"set_current_working_directory",inputSchema:{cwd:c.string()}}},"auth.login":{description:"Start browser login and save credentials.",cli:{path:"login"}},"auth.logout":{description:"Delete local credentials and unload schema sessions.",cli:{path:"logout"}},"auth.whoami":{description:"Show the currently authenticated account token payload.",cli:{path:"whoami"}},"auth.reauth":{description:"Delete credentials and start login again.",cli:{path:"reauth"}},"account.profile":{description:"Fetch current account and organization/project-space metadata used for project creation.",tool:{name:"get_account_profile"},cli:{path:"account profile",alias:"account me"}},"projects.search":{description:"List/search projects with pagination.",tool:{name:"get_projects",inputSchema:{projectName:c.string().optional(),cursor:c.string().nullable().optional(),limit:c.number().optional()}},cli:{path:"projects search"}},"projects.list":{description:"List projects.",cli:{path:"projects list"}},"project.create":{description:"Create a new blank project in the current account organization and wait for it to appear in search. A project is a backend plus at most one client app, named by appType \u2014 pick it with the user: the free plan pays for one client. WEB, WECHAT_MINI_PROGRAM (Zion only) and MOBILE (iOS) each create a client this project hosts: build its pages with these tools, or deploy your own build to a WEB client with site deploy. BACKEND_ONLY creates no client, for a front end hosted elsewhere that calls the project's generated GraphQL API. These tools cannot add a client to an existing project, and a second one is a paid client slot bought in the console, so pick the client the user wants now. It comes back as builtInApp, already current, so UI calls need no appExId.",tool:{name:"create_project",inputSchema:{projectName:c.string(),appType:c.enum(["WEB","WECHAT_MINI_PROGRAM","MOBILE","BACKEND_ONLY"]),appName:c.string().optional(),projectSpaceType:c.string().optional(),organizationExId:c.string().optional(),category:c.string().nullable().optional(),wait:c.boolean().optional(),timeoutMs:c.number().optional()}},cli:{path:"project create"}},"project.set_current":{description:"Set the project every later call defaults to. With no appExId it also makes that project\u2019s only client current (the client session holds its pages and the project backend both), and a project with no client defaults to its backend document. A project with several clients is refused, listing them, and leaves the current project as it was: pages belong to one client, so pass appExId to name it \u2014 or appExId: null to address the backend alone.",tool:{name:"set_current_project",inputSchema:{projectExId:c.string(),appExId:c.string().nullable().optional()}},cli:{path:"project set-current"}},"project.get_current":{description:"Get the current project context: the pinned project and the client app calls default to (appExId null means they address the project\u2019s own backend document).",tool:{name:"get_current_project"},cli:{path:"project current",alias:"project get-current"}},"project.detail":{description:"Fetch the project's detail payload: app list, project config, the backend document's latest schema metadata, and deployment info. Answers for the project itself, not for the current client \u2014 pass appExId to get one client app's own detail instead.",cli:{path:"project detail"}},"project.metadata":{description:"Fetch a lean project summary: identity, platforms, publish/deploy state (incl. hasUndeployedChanges), configured integrations, plan, capabilities, and RPS. Pass raw=true for the full unshaped payload. Deploy state belongs to the project's backend document, so naming a client with appExId leaves it out.",cli:{path:"project metadata",alias:"project inspect"}},"project.resources":{description:"Fetch project resource consumption, plan/capability limits, RPS stats, and optional resource history.",cli:{path:"project resources"}},"project.rename":{description:"Rename a project.",tool:{name:"rename_project",inputSchema:{...ge,projectName:c.string()}},cli:{path:"project rename"}},"project.rename_app":{description:"Rename an app inside a project.",tool:{name:"rename_project_app",inputSchema:{projectExId:c.string(),appExId:c.string(),appName:c.string()}},cli:{path:"project rename-app"}},"project.delete":{description:"Delete a project. IRREVERSIBLE: requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve. Set MCP_HITL=off to fall back to the confirmProjectExId/force text gate in headless automation.",tool:{name:"delete_project",inputSchema:{projectExId:c.string(),confirmProjectExId:c.string().optional(),force:c.boolean().optional()}},cli:{path:"project delete"}},"project.reset":{description:"Reset a project. IRREVERSIBLE: requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve. Set MCP_HITL=off to fall back to the confirmProjectExId/force text gate in headless automation.",tool:{name:"reset_project",inputSchema:{projectExId:c.string(),confirmProjectExId:c.string().optional(),force:c.boolean().optional(),languageType:c.string().optional()}},cli:{path:"project reset"}},"project.sync_backend":{description:"Save the schema and deploy/sync the project runtime backend. Returns ztype diagnostics and blocks on backend validation errors by default.",tool:{name:"sync_backend",inputSchema:{...ge,buildTarget:c.string().optional(),validateMultiClient:c.boolean().optional(),allowValidationErrors:c.boolean().optional()}},cli:{path:"project sync-backend",alias:"project deploy-backend"}},"schema.load":{description:"Load a project's CRDT schema into the daemon's in-memory headless schema session.",cli:{path:"schema load"}},"schema.reload":{description:"Force reload a project schema session from the backend CRDT model and patch log.",cli:{path:"schema reload"}},"schema.status":{description:"Show daemon schema sessions and TTL state.",tool:{name:"schema_status"},cli:{path:"schema status"}},"schema.state":{description:"Read the daemon's schema revision, stale state, and latest semantic schema-change event for a project.",cli:{path:"schema state"}},"schema.events":{description:"Read recent semantic schema-change events observed by the daemon for a project.",cli:{path:"schema events"}},"schema.sync":{description:"Catch up schema CRDT patches from the backend for the loaded project session.",cli:{path:"schema sync"}},"schema.snapshot":{description:"Return the data model of the loaded schema (tables, relations, enum types). Pass full=true for the entire raw ZSchema document (UI tree + all server configs), which is much larger.",cli:{path:"schema snapshot"}},"schema.validate":{description:"Run ztype validation/type checks against the loaded schema and return stable/beta/backend diagnostics.",cli:{path:"schema validate",alias:"schema type-check"}},"bridge.flow_definition":{description:"Resolve an action flow to the definition the debug mutation takes, plus its terminal end node. Derived from the draft CRDT, so it answers with no editor tab attached.",cli:{path:"bridge flow-definition"}},"bridge.debug_flow":{description:"Run an action flow definition as a debug run with the project admin credential and return every node's output in run order, the same run the editor's flow debugger performs. A run still going when the time is up comes back with what it has and timedOut set.",cli:{path:"bridge debug-flow"}},"bridge.agent_definition":{description:"Resolve an AI agent to the definition, custom model config and type definitions its debug conversation takes, derived from the draft CRDT.",cli:{path:"bridge agent-definition"}},"bridge.trigger_bindings":{description:"List database and scheduled trigger bindings with their flow names, table names and enabled state, derived from the draft CRDT.",cli:{path:"bridge trigger-bindings"}},"bridge.deploy_status":{description:"Compare the draft schema against the last deployed server schema and report which of the eleven server areas differ. Unlike project.inspect this diffs content against the *draft*, so unsaved edits count as pending changes.",cli:{path:"bridge deploy-status"}},"bridge.project_errors":{description:"List the project validation errors and warnings in the shape the editor reports them, newest ztype run, capped by limit. Same union and order as the editor panel.",cli:{path:"bridge project-errors"}},"bridge.sync_backend":{description:"Save the draft schema, deploy the backend and wait for the pipeline, reporting the outcome in the shape the editor reports it. A deploy already running is waited for, not restarted.",cli:{path:"bridge sync-backend"}},"bridge.save_version_history":{description:"Take a named version of the project for the copilot (its run checkpoint or its own save), both documents in one group, in the shape the editor reports. Reports UNCHANGED when nothing changed since the last one, and NOT_SAVED where version history is off.",cli:{path:"bridge save-version-history"}},"bridge.clipped_components":{description:"Measure which components on a page render clipped (content larger than their box), in the shape the editor reports. Renders the canvas in a headless browser owned by the daemon, after it has applied the latest schema patch.",cli:{path:"bridge clipped-components"}},"bridge.capture_canvas":{description:"Screenshot a page or component as the editor canvas renders it and store it as the agent session's media. Same headless renderer and patch wait as bridge clipped-components.",cli:{path:"bridge capture-canvas"}},"schema.ztype_tool_calls":{description:"Run ztype Copilot tool calls against the loaded schema as one atomic batch: either every call lands or none does, and `applied` reports which. A batch ztype rejects, or whose patch trips validation, reports errors with errorCode/failedIndex and applies nothing \u2014 pass force to apply over a DEPENDENCY_CONFLICT. Use schema_undo to revert the last change.",tool:{name:"ztype_tool_calls",inputSchema:{...ge,toolCalls:c.array(c.record(c.any())),verbose:c.boolean().optional(),readState:c.record(c.any()).optional(),force:c.boolean().optional()}},cli:{path:"schema tool-call",alias:"schema tool-calls"}},"schema.undo":{description:"Undo the most recent schema change made in this session by applying a reverse CRDT patch. Refuses if a concurrent edit touched the same path. Pairs with schema_redo.",tool:{name:"schema_undo",inputSchema:{...ge}},cli:{path:"schema undo"}},"schema.redo":{description:"Re-apply the schema change most recently undone via schema_undo in this session.",tool:{name:"schema_redo",inputSchema:{...ge}},cli:{path:"schema redo"}},"secret.save_value":{description:"Prompt the user (native GUI dialog) to set a secret's plaintext value, store it, and attach the handle so the secret reports hasValue:true. Provide secretId (an existing secret) OR displayName (create a new one). The value is typed into the dialog and never passes through this tool call or the model. Requires a desktop session (fails on headless/SSH/CI).",tool:{name:"save_secret_value",inputSchema:{...ge,secretId:c.string().optional(),displayName:c.string().optional(),description:c.string().optional()}},cli:{path:"secret save-value"}},"runtime.graphql":{description:"Run a raw GraphQL operation against the deployed project's runtime backend (the auto-generated data/actionflow/AI API), as admin.",tool:{name:"runtime_graphql",inputSchema:{...ge,query:c.string(),variables:c.record(c.any()).optional()}},cli:{path:"runtime graphql"}},"runtime.run_code":{description:"Execute a JavaScript snippet in the deployed project's Run Code sandbox and return its result. Database writes are reverted unless updateDb is true, so this is the cheap way to check what a Run Code node will actually return before wiring it into a flow. Runs on the admin surface, as admin.",tool:{name:"runtime_run_code",inputSchema:{...ge,jsCode:c.string(),args:c.record(c.any()).optional(),updateDb:c.boolean().optional()}},cli:{path:"runtime run-code"}},"runtime.query":{description:"Query rows from a deployed project's runtime table.",cli:{path:"runtime query"}},"runtime.aggregate":{description:"Count rows matching a filter in a deployed project's runtime table \u2014 the cheapest assertion available.",cli:{path:"runtime aggregate"}},"runtime.insert":{description:"Insert one or more rows into a deployed project's runtime table.",cli:{path:"runtime insert"}},"runtime.update":{description:"Update rows in a deployed project's runtime table.",cli:{path:"runtime update"}},"runtime.delete":{description:"Delete rows from a deployed project's runtime table. Requires where unless allowDeleteAll=true.",cli:{path:"runtime delete"}},"logs.search":{description:`Fetch recent runtime logs from the project's log endpoint. Window is \xB15 minutes around requestCreatedAt (ISO-8601, defaults to now). types: GATEWAY, ACTION_FLOW, ACTION_FLOW_NODE, ACTION_FLOW_CONTEXT_LOG, DEPLOYMENT, TPA, TRIGGER, SQL_GENERATION, GQL, ZAI. levels: INFO, WARNING, ERROR. customQueryCondition is an Elasticsearch condition (e.g. 'traceId: "abc-123"').`,tool:{name:"search_logs",inputSchema:{...ge,requestCreatedAt:c.string().optional(),types:c.array(c.string()).optional(),levels:c.array(c.string()).optional(),customQueryCondition:c.string().optional(),limit:c.number().optional()}},cli:{path:"logs search"}},"docs.search":{description:"Full-text search the bundled product documentation. Returns the best-matching pages as { path, title, url }, where url is the public HTTPS docs link you can cite. Use docs.get_page with a returned path to read a page.",tool:{name:"search_docs",inputSchema:{query:c.string(),limit:c.number().optional()}},cli:{path:"docs search"}},"docs.get_page":{description:'Fetch a documentation page as markdown by its path (as returned by docs.search, e.g. "/02_design/01_layout_concepts").',tool:{name:"get_doc_page",inputSchema:{path:c.string()}},cli:{path:"docs get-page"}},"platform.graphql":{description:"Raw GraphQL passthrough to the platform backend (projects, accounts, deployments \u2014 the editor/meta API, not the deployed runtime). Queries pass through unchanged; mutations are refused except a short allow list for client builds and code component versions, which the refusal names.",tool:{name:"platform_graphql",inputSchema:{query:c.string(),variables:c.record(c.any()).optional()}},cli:{path:"platform graphql"}},"web.fetch_doc":{description:"Fetch a web page or spec by URL for reading. Returns the page content (HTML converted to Markdown; long pages are windowed \u2014 pass `offset` with the same url to keep reading, guided by `totalLength`/`truncated`), same-site `pageLinks` to explore the documentation further, and any OpenAPI/Swagger `specLinks` found. Explore iteratively by fetching returned links, within a budget of 15 fetches per session (`fetchesRemaining`). Build the endpoints you read about with the api schema ops.",tool:{name:"fetch_api_doc",inputSchema:{url:c.string(),offset:c.number().optional()}},cli:{path:"web fetch-doc"}},"site.deploy":{description:"Deploy a built frontend directory (e.g. ./dist) to the project\u2019s hosted static site and return the live url. Scans the directory, declares the manifest, uploads every asset to object storage, and switches the site over in one call \u2014 the agent never handles checksums or upload urls itself. `target` is BETA (default) or PROD; a PROD deploy takes the site live and requires a human to approve a native GUI dialog by retyping the project id; the agent cannot self-approve, and `force` does NOT approve it. Set MCP_HITL=off to fall back to the confirmProjectExId text gate in headless automation. An interrupted run resumes automatically when the directory is unchanged; pass `force` to discard it and start over. `dryRun` reports what would be uploaded without creating a deployment. The total size must fit the project\u2019s remaining object storage, and the directory must contain an index.html.",tool:{name:"deploy_static_site",inputSchema:{...ge,dir:c.string(),target:c.string().optional(),dryRun:c.boolean().optional(),force:c.boolean().optional(),concurrency:c.number().optional(),confirmProjectExId:c.string().optional()}},cli:{path:"site deploy"}},"site.status":{description:"Report the project\u2019s static site: the currently live deployment (with its url) and any upload still in progress. Use to find the site url, or to see whether an interrupted deploy is still resumable.",tool:{name:"get_static_site_status",inputSchema:{...ge,target:c.string().optional()}},cli:{path:"site status"}},"site.abort":{description:"Abandon an in-progress static site upload and delete whatever it already uploaded. Targets the current in-progress deployment unless `deploymentExId` names one. The live site is untouched.",tool:{name:"abort_static_site_deployment",inputSchema:{...ge,target:c.string().optional(),deploymentExId:c.string().optional()}},cli:{path:"site abort"}},"wechat.deploy":{description:"Upload a locally-developed WeChat mini program source tree (the directory holding app.json) to the project and start the server-side build that commits it to WeChat as the \u4F53\u9A8C\u7248 (trial version). Scans the directory, declares the manifest, uploads every file to object storage, and hands off to the build job in one call \u2014 the agent never handles checksums or upload urls itself. By default it then WAITS for the build and returns the trial version number plus the path of the trial QR code image it saved (`wait: false` returns as soon as the build starts; `timeoutSeconds` bounds the wait). Requires the project to have granted Zion third-party platform authorization. An interrupted run resumes automatically when the directory is unchanged; pass `force` to discard it and start over. `dryRun` reports what would be uploaded without creating a deployment. This does NOT submit for audit or release \u2014 it only produces a trial version to verify; submitting it for review and releasing it are done by the user in the editor, not from here.",tool:{name:"deploy_wechat_source_code",inputSchema:{...ge,dir:c.string(),dryRun:c.boolean().optional(),force:c.boolean().optional(),wait:c.boolean().optional(),timeoutSeconds:c.number().optional(),qrOut:c.string().optional(),concurrency:c.number().optional()}},cli:{path:"wechat deploy"}},"wechat.status":{description:"Report the project\u2019s WeChat mini program source upload: any upload still in progress and any build already running (with its deploymentRecordExId and start time). Use to poll a build after `wechat deploy`, or to see whether an interrupted upload is still resumable.",tool:{name:"get_wechat_source_code_status",inputSchema:{...ge}},cli:{path:"wechat status"}},"wechat.abort":{description:"Abandon an in-progress WeChat mini program source upload and delete whatever it already uploaded. Targets the current in-progress deployment unless `deploymentExId` names one. A deployment that already reached BUILDING cannot be aborted.",tool:{name:"abort_wechat_source_code_deployment",inputSchema:{...ge,deploymentExId:c.string().optional()}},cli:{path:"wechat abort"}},"wechat.qrcode":{description:"Save the WeChat trial version (\u4F53\u9A8C\u7248) QR code of the project\u2019s mini program to a local image file and return its path, along with the trial version number and the time it was committed. The QR code is written to disk rather than returned inline because it is a JPEG. Available once a `wechat deploy` build has succeeded; scanning it opens the trial version on a phone whose WeChat id is bound as a tester.",tool:{name:"get_wechat_trial_qrcode",inputSchema:{...ge,out:c.string().optional()}},cli:{path:"wechat qrcode"}},"agent_files.read_file":{description:"Read an agent file with line numbers, about 16,000 characters per call; page with offset and limit.",cli:Mn("agent-files read","READ_FILE")},"agent_files.write_file":{description:"Create an agent file, or replace the whole of one read in full in this session. Parent folders are created implicitly; prefer edit for changing part of a file.",cli:Mn("agent-files write","WRITE_FILE")},"agent_files.edit_file":{description:"Replace exact text in an agent file. old_string is matched against the file's current content and must appear exactly once unless replace_all is set.",cli:Mn("agent-files edit","EDIT_FILE")},"agent_files.list_files":{description:"List agent files with their sizes, under path or, when it is omitted, under both /project and /user.",cli:Mn("agent-files list","LIST_FILES")},"agent_files.grep_files":{description:"Search agent file contents, like ripgrep.",cli:Mn("agent-files grep","GREP_FILES")},"agent_files.rename_file":{description:"Move or rename an agent file or directory; the destination must not exist. Moving between /user and /project changes who can see it.",cli:Mn("agent-files rename","RENAME_FILE")},"agent_files.delete_file":{description:"Delete an agent file, or a directory with recursive. Use it to forget a note that has become wrong or outdated.",cli:Mn("agent-files delete","DELETE_FILE")},"agent_files.snapshot":{description:"Print the project's AGENTS.md files and an index of every agent file, as project set-current prints them.",cli:{path:"agent-files snapshot",inputSchema:{...ge}}}},Xg=Object.entries(QP).map(([t,e])=>({command:t,...e})),eC={...Object.fromEntries(Object.values(Jg).flatMap(t=>Object.entries(t)).map(([t,e])=>[t,e.optional()])),path:c.string().optional().describe("Absolute path, starting with /project or /user. LIST_FILES and GREP_FILES search both when it is omitted."),offset:c.number().optional().describe("READ_FILE: 1-indexed line to start from. GREP_FILES: output lines or entries to skip.")},Qg=[{name:"agent_files",description:"Read and change the project's agent files: notes that persist across sessions, which the project's built-in AI assistant reads and writes too. They are stored on the platform, not on this machine, so reach them only through this tool. /project/... is shared with every collaborator on the project (each client app has its own folder, /project/app/<appExId>/); /user/... is private to the signed-in account and follows it into all of its projects. The first call a session makes on a project returns the project's AGENTS.md files and an index of every file. op: READ_FILE {path, offset?, limit?} reads with line numbers, a page at a time | WRITE_FILE {path, content} creates a file, or replaces one read in full in this session | EDIT_FILE {path, old_string, new_string, replace_all?} replaces exact text | LIST_FILES {path?, glob?} | GREP_FILES {pattern, path?, glob?, type?, output_mode?, ...} searches contents like ripgrep | RENAME_FILE {old_path, new_path} | DELETE_FILE {path, recursive?}.",ops:{READ_FILE:"agent_files.read_file",WRITE_FILE:"agent_files.write_file",EDIT_FILE:"agent_files.edit_file",LIST_FILES:"agent_files.list_files",GREP_FILES:"agent_files.grep_files",RENAME_FILE:"agent_files.rename_file",DELETE_FILE:"agent_files.delete_file"},inputSchema:{...ge,...eC}},{name:"schema_session",description:"Schema session lifecycle for the loaded project. op: LOAD (warm the in-memory CRDT session) | RELOAD (force reload from backend) | SYNC (catch up patches) | SNAPSHOT (return the data model: tables, relations, enum types; pass full=true for the entire raw document) | VALIDATE (ztype type checks, stable/beta/backend diagnostics). Edits do not go live until sync_backend.",ops:{LOAD:"schema.load",RELOAD:"schema.reload",SYNC:"schema.sync",SNAPSHOT:"schema.snapshot",VALIDATE:"schema.validate"},inputSchema:{...ge,full:c.boolean().optional()}},{name:"schema_observe",description:"Read the daemon's schema change-state for a project. op: STATE (revision, stale flag, latest change event) | EVENTS (recent semantic schema-change events; afterEventId/limit paginate).",ops:{STATE:"schema.state",EVENTS:"schema.events"},inputSchema:{projectExId:c.string().optional(),afterEventId:c.string().nullable().optional(),limit:c.number().optional()}},{name:"auth",description:"Authentication. op: LOGIN (browser login + save credentials) | LOGOUT (delete credentials, unload sessions) | WHOAMI (show authenticated account token payload) | REAUTH (delete credentials and log in again).",ops:{LOGIN:"auth.login",LOGOUT:"auth.logout",WHOAMI:"auth.whoami",REAUTH:"auth.reauth"}},{name:"project_inspect",description:"Inspect a project. op: DETAIL (app list, project config, latest schema metadata, deployment) | METADATA (plan/capability, deployment, app list, schema metadata, RPS summary) | RESOURCES (resource consumption, plan limits, RPS, optional history). includeSecrets applies to DETAIL/METADATA; refresh/resourceType/nonRealTimeDisplayedResourceTypes apply to RESOURCES.",ops:{DETAIL:"project.detail",METADATA:"project.metadata",RESOURCES:"project.resources"},inputSchema:{...ge,includeSecrets:c.boolean().optional(),refresh:c.boolean().optional(),resourceType:c.string().optional(),nonRealTimeDisplayedResourceTypes:c.array(c.string()).optional()}}];u();u();var tC={schema_table:"database",schema_view:"database",schema_common:"database",schema_overview:"database",schema_type:"type",schema_binding_inspect:"bindings",schema_create_binding:"bindings",schema_conditional_branch:"bindings",schema_custom_array_binding:"bindings",schema_condition_expr:"bindings",schema_request_filter:"bindings",schema_actionflow:"actionflow",schema_actionflow_node:"actionflow",schema_trigger:"actionflow",schema_api:"api",schema_component:"component",schema_action_menu:"component",schema_theme:"component",schema_tab_bar:"component",schema_seo:"component",schema_client_variables:"component",schema_verification_code_config:"component",schema_authentication:"component",schema_permission:"permissions",schema_secret:"secret",schema_zai_config:"zai",schema_callback:"webhook",schema_payment:"payments"},ey=t=>tC[t]??"UNMAPPED",nC={database:'Edit the data model \u2014 tables, columns, relations, unique constraints, display names. op is a schema ToolName from the enum; args is its payload. Call guide {plugin:"database"} first for the rules and per-op arg shapes.',type:'Edit enums and object/custom type definitions. op is a schema ToolName; args is its payload. Call guide {plugin:"type"} for the rules and arg shapes.',bindings:'Create and edit data bindings \u2014 option/const/formula/conditional bindings, boolean condition expressions, and request filters (where + sort), all addressed by schemaPath. op is a schema ToolName; args is its payload. Call guide {plugin:"bindings"} for the rules and arg shapes.',actionflow:'Edit server-side action flows \u2014 flows, nodes, branches, I/O, global variables, and triggers (scheduled / database-change). op is a schema ToolName; args is its payload. Call guide {plugin:"actionflow"} for the rules and arg shapes.',api:'Edit the API-integration library \u2014 workspaces, APIs, request parameters, response configs, input variables, and workspace constants. op is a schema ToolName; args is its payload. Call guide {plugin:"api"} for the rules and arg shapes.',secret:'Register, update, and delete project secrets (API keys and tokens) by handle \u2014 never their plaintext. op is a schema ToolName; args is its payload. Call guide {plugin:"secret"} for the rules and arg shapes.',zai:'Edit ZAI AI-agent configs \u2014 agents, input args, and model settings. op is a schema ToolName; args is its payload. Call guide {plugin:"zai"} for the rules and arg shapes.',component:`Build and edit the UI \u2014 pages, containers, components, slots, properties, styles and responsive breakpoints, plus the design system (color themes, style scale), the client's app-wide variables, SEO path ranges, and custom verification-code delivery channels. op is a schema ToolName; args is its payload. Call guide {plugin:"component"} first for the tree rules, component templates, and per-op arg shapes.`,permissions:'Edit roles and their table, API, action-flow, AI, and payment permissions. op is a schema ToolName; args is its payload. Call guide {plugin:"permissions"} for the rules and arg shapes.',webhook:'Edit incoming HTTP triggers (webhooks, called callbacks in the schema) \u2014 the bound action flow, request and response body shapes, body codecs, and the provider protocol. op is a schema ToolName; args is its payload. Call guide {plugin:"webhook"} for the rules and arg shapes.',payments:'Design and wire up payments: pick the model the project uses (legacy activation or payment configs), configure providers and credentials, and bind the callback fulfillment flows. op is a schema ToolName; args is its payload. Call guide {plugin:"payments"} for the rules and arg shapes.'},ty=(()=>{let t=new Map;for(let e of Ps){let n=ey(e.name);if(n==="UNMAPPED")continue;let r=t.get(n)??new Set;for(let o of Object.values(e.ops))r.add(o);t.set(n,r)}return[...t.entries()].map(([e,n])=>({name:e,description:nC[e]??`Edit ${e}.`,ops:[...n].sort()})).sort((e,n)=>e.name.localeCompare(n.name))})(),BU=Ps.filter(t=>ey(t.name)==="UNMAPPED").map(t=>t.name);function rC(){let t=[];for(let e of Xg){if(!e.tool)continue;let{name:n,aliases:r,inputSchema:o}=e.tool;t.push({name:n,description:e.description,command:e.command,inputSchema:o});for(let a of r??[])t.push({name:a.name,description:a.description??e.description,command:e.command,inputSchema:o})}return t}function KU(t,e){Bg(t,rC(),e),qg(t,Qg,e),Vg(t,ty,e),Wg(t),Hg(t,e)}u();u();var oC={productName:"Zion",utcOffset:"+08:00",accountTable:"\u5E10\u6237(\u8D26\u6237)",paymentTables:"\u652F\u4ED8, \u5468\u671F\u6027\u652F\u4ED8, \u9000\u6B3E",aiTables:"\u4F1A\u8BDD, \u6D88\u606F, \u5DE5\u5177\u4F7F\u7528\u8BB0\u5F55, \u6D88\u606F\u5185\u5BB9",displayNameRule:'user-visible; use the natural Chinese name as the displayName and derive the English snake_case apiName from it (e.g. displayName "\u7528\u6237\u540D" \u2192 apiName "user_name").',enumDisplayNameRule:'use a natural Chinese phrase (enum displayName "\u8BA2\u5355\u72B6\u6001", option displayName "\u5F85\u5904\u7406"); the enum id and option values stay English.',runtimeGraphqlUrl:t=>jn().zeroApiUrlTemplate.replace("{projectExId}",t)},aC={productName:"Momen",utcOffset:"+00:00",accountTable:"account",paymentTables:"payment_record, recurring_payment, refund",aiTables:"conversation, message, tool_usage_record, message_content",displayNameRule:'user-visible; prefer it IDENTICAL to the apiName (e.g. apiName "first_name" \u2192 displayName "first_name").',enumDisplayNameRule:'keep it close to the name/value itself (enum displayName \u2248 the enum name, e.g. "OrderStatus"; an option displayName \u2248 its value, e.g. "PENDING").',runtimeGraphqlUrl:t=>jn().zeroApiUrlTemplate.replace("{projectExId}",t)},Ds=()=>{switch(Fn){case"MOMEN":return aC;case"ZION":return oC;default:throw new Error(`[product-context] unknown PRODUCT '${Fn}'`)}};u();function ny({brand:t,zeroApiUrl:e}){let n=e.replace(/^http:/,"ws:").replace(/^https:/,"wss:").replace("/api/graphql-v2","/api/graphql-subscription");return{brand:t,zeroApiUrl:e,zeroSubscriptionUrl:n}}function ry(t){let e=t.brand==="Zion"?"Zion apps conventionally sign up / log in by phone number (SMS code); email and username work too.":"Momen apps conventionally sign up / log in by email; phone (SMS code) and username work too.";return`## App-user authentication (for the frontend you generate)
976
978
  The deployed app's end-users obtain a JWT by logging in / registering against the same GraphQL API;
977
979
  unauthenticated requests fall back to the anonymous role. Distinct from the developer \`login\` that
978
980
  authenticates THIS CLI to ${t.brand}. ${e}
@@ -998,7 +1000,7 @@ usually needs both.
998
1000
  Every variant returns jwt.token \u2014 the Bearer token for that user's subsequent requests \u2014 and
999
1001
  FZ_Account (a subset of account: email, id, permissionRoles, phoneNumber, profileImageUrl, roles,
1000
1002
  username). A server-side admin token, when you need one, is copied from the editor's Connect
1001
- Backend modal \u2014 never hardcode it in client code.`}function ey(){return`## Subscription transport (WebSocket wire protocol)
1003
+ Backend modal \u2014 never hardcode it in client code.`}function oy(){return`## Subscription transport (WebSocket wire protocol)
1002
1004
  The subscription endpoint speaks the LEGACY subscriptions-transport-ws protocol, NOT the newer
1003
1005
  graphql-ws \u2014 a graphql-ws client fails the handshake. After connecting send
1004
1006
  {"type":"connection_init"}, wait for {"type":"connection_ack"}, then start each operation with
@@ -1006,7 +1008,7 @@ graphql-ws \u2014 a graphql-ws client fails the handshake. After connecting send
1006
1008
  arrive as {"type":"data","id":\u2026,"payload":{\u2026}} and end with {"type":"complete"}. With Apollo
1007
1009
  Client, use a subscriptions-transport-ws WebSocketLink split against the HTTP link. Re-establish
1008
1010
  the socket whenever the user's auth state changes (login/logout) so live queries carry the new
1009
- role.`}function ty(t){let e=`## Invoking payments from the runtime GraphQL API
1011
+ role.`}function ay(t){let e=`## Invoking payments from the runtime GraphQL API
1010
1012
  Prerequisites are design-time (payments.md): payment module enabled and bound to the order table,
1011
1013
  gateway credentials configured. Create the order SERVER-SIDE first \u2014 an actionflow takes product
1012
1014
  ids, computes the authoritative amount, inserts the order row, and returns its id; never trust a
@@ -1043,24 +1045,26 @@ for exact input field casing). Confirm on the frontend with Stripe.js Elements u
1043
1045
  paymentClientSecret; stripeReadableAmount is a display-ready amount string. stripePay(payDetails)
1044
1046
  is the older variant returning the bare clientSecret string. To reconcile after confirmation, query
1045
1047
  findOrderIdByPaymentIntentId(paymentIntentId:\u2026). Stripe subscriptions and refunds are modeled in
1046
- payments.md \u2014 drive them from there.`}var tC=t=>({role:"user",content:{type:"text",text:t}}),Mn=(t,e)=>({description:t,messages:[tC(e)]}),ny=()=>Xg({brand:Ps().productName,zeroApiUrl:Fn().zeroApiUrlTemplate}),Rt=t=>{let e=jg[t];if(!e)throw new Error(`runtime protocol section '${t}' missing from the plugin manifest`);return e},Ro=t=>wr[t]??"",Tu=async(t,e)=>{let n=e?{projectExId:e}:{},r=null;try{let o=await t({name:"schema.ztype_tool_calls",args:{...n,apply:!1,toolCalls:[{toolCallId:"prompt-tables",name:"GET_ALL_TABLE_DISPLAY_NAMES",args:{}}]}});o.ok&&o.data!==void 0&&(r=JSON.stringify(o.data,null,2))}catch{}return{tables:r}},bu=t=>t?`
1048
+ payments.md \u2014 drive them from there.`}var iC=t=>({role:"user",content:{type:"text",text:t}}),zn=(t,e)=>({description:t,messages:[iC(e)]}),sy=()=>ny({brand:Ds().productName,zeroApiUrl:jn().zeroApiUrlTemplate}),Rt=t=>{let e=Gg[t];if(!e)throw new Error(`runtime protocol section '${t}' missing from the plugin manifest`);return e},xo=t=>vr[t]??"",wu=async(t,e)=>{let n=e?{projectExId:e}:{},r=null,o;try{let a=await t({name:"schema.ztype_tool_calls",args:{...n,apply:!1,toolCalls:[{toolCallId:"prompt-tables",name:"GET_ALL_TABLE_DISPLAY_NAMES",args:{}}]}});a.ok&&a.data!==void 0&&(r=JSON.stringify(a.data,null,2)),o=a.agentFiles}catch{}return cC(r)+(o?`
1049
+
1050
+ ${o}`:"")},cC=t=>t?`
1047
1051
 
1048
1052
  Current tables in the loaded schema:
1049
1053
  ${t}`:`
1050
1054
 
1051
- (No schema is loaded yet \u2014 call schema_session op=LOAD, then schema_table op=GET_INFOS to learn the current structure.)`;function tF(t,e){let{productName:n}=Ps(),r=t.registerPrompt.bind(t);r("inspect-project",{title:"Inspect a project",description:`Pin a ${n} project and summarize its apps, schema, and health.`,argsSchema:{projectExId:c.string().optional(),projectName:c.string().optional()}},async({projectExId:o,projectName:a})=>{let{tables:s}=await Tu(e,o),i=o?`project ${o}`:a?`the project named "${a}"`:"the current project";return Mn("Project inspection workflow",`Give me a briefing on ${i}.
1055
+ (No schema is loaded yet \u2014 call schema_session op=LOAD, then schema_table op=GET_INFOS to learn the current structure.)`;function cF(t,e){let{productName:n}=Ds(),r=t.registerPrompt.bind(t);r("inspect-project",{title:"Inspect a project",description:`Pin a ${n} project and summarize its apps, schema, and health.`,argsSchema:{projectExId:c.string().optional(),projectName:c.string().optional()}},async({projectExId:o,projectName:a})=>{let s=await wu(e,o),i=o?`project ${o}`:a?`the project named "${a}"`:"the current project";return zn("Project inspection workflow",`Give me a briefing on ${i}.
1052
1056
 
1053
1057
  Steps:
1054
1058
  ${a&&!o?`- get_projects to resolve the exId from the name.
1055
1059
  `:""}- set_current_project to pin it, then project_inspect (op DETAIL then METADATA) for apps, config, plan/capability, deployment, and RPS.
1056
1060
  - schema_session op=LOAD and schema_table op=GET_INFOS to understand the data model.
1057
- - Summarize: what the app does, its core tables/relations, deployment state, and anything that looks misconfigured or risky.${bu(s)}`)}),r("edit-schema",{title:"Edit the schema safely",description:"Load, mutate, validate, save, and deploy a data-model change with the full data-model + type rules.",argsSchema:{instruction:c.string(),projectExId:c.string().optional()}},async({instruction:o,projectExId:a})=>{let{tables:s}=await Tu(e,a);return Mn("Safe schema-editing workflow",`Apply this data-model change${a?` to project ${a}`:""}: "${o}".
1061
+ - Summarize: what the app does, its core tables/relations, deployment state, and anything that looks misconfigured or risky.${s}`)}),r("edit-schema",{title:"Edit the schema safely",description:"Load, mutate, validate, save, and deploy a data-model change with the full data-model + type rules.",argsSchema:{instruction:c.string(),projectExId:c.string().optional()}},async({instruction:o,projectExId:a})=>{let s=await wu(e,a);return zn("Safe schema-editing workflow",`Apply this data-model change${a?` to project ${a}`:""}: "${o}".
1058
1062
 
1059
- ${Ro("database")}
1063
+ ${xo("database")}
1060
1064
 
1061
- ${Ro("type")}
1065
+ ${xo("type")}
1062
1066
 
1063
- Order: schema_session op=LOAD \u2192 read current structure \u2192 mutate (schema_table / schema_type; each edit applies immediately, schema_undo reverts the last) \u2192 schema_session op=VALIDATE \u2192 sync_backend. Stop and report if VALIDATE or sync_backend fails \u2014 do not force past validation errors.${bu(s)}`)}),r("query-data",{title:"Query project data",description:`Answer a question against a ${n} project's data using the auto-generated GraphQL API.`,argsSchema:{question:c.string(),projectExId:c.string().optional()}},async({question:o,projectExId:a})=>{let s=ny(),{tables:i}=await Tu(e,a);return Mn("Data query workflow",`Answer this question about the project's data: "${o}".
1067
+ Order: schema_session op=LOAD \u2192 read current structure \u2192 mutate (schema_table / schema_type; each edit applies immediately, schema_undo reverts the last) \u2192 schema_session op=VALIDATE \u2192 sync_backend. Stop and report if VALIDATE or sync_backend fails \u2014 do not force past validation errors.${s}`)}),r("query-data",{title:"Query project data",description:`Answer a question against a ${n} project's data using the auto-generated GraphQL API.`,argsSchema:{question:c.string(),projectExId:c.string().optional()}},async({question:o,projectExId:a})=>{let s=sy(),i=await wu(e,a);return zn("Data query workflow",`Answer this question about the project's data: "${o}".
1064
1068
 
1065
1069
  ${Rt("query-language")}
1066
1070
 
@@ -1072,15 +1076,15 @@ ${Rt("formula-catalog")}
1072
1076
 
1073
1077
  ${Rt("runtime-enums")}
1074
1078
 
1075
- ${Qg(s)}
1079
+ ${ry(s)}
1076
1080
 
1077
- ${ey()}
1081
+ ${oy()}
1078
1082
 
1079
- Use runtime_graphql for all reads (queries and mutations). Verify table and column names from the schema before querying.${bu(i)}`)}),r("invoke-baas",{title:"Invoke an actionflow, AI agent, API, or payment",description:"Trigger a server-side actionflow, ZAI agent, imported API, or payment through the runtime GraphQL API.",argsSchema:{goal:c.string(),projectExId:c.string().optional()}},async({goal:o,projectExId:a})=>{let s=ny();return Mn("Actionflow / AI agent / API / payment invocation workflow",`Goal: "${o}".
1083
+ Use runtime_graphql for all reads (queries and mutations). Verify table and column names from the schema before querying.${i}`)}),r("invoke-baas",{title:"Invoke an actionflow, AI agent, API, or payment",description:"Trigger a server-side actionflow, ZAI agent, imported API, or payment through the runtime GraphQL API.",argsSchema:{goal:c.string(),projectExId:c.string().optional()}},async({goal:o,projectExId:a})=>{let s=sy();return zn("Actionflow / AI agent / API / payment invocation workflow",`Goal: "${o}".
1080
1084
 
1081
1085
  First read the project schema (project_inspect op=DETAIL / schema_session op=LOAD) to find the
1082
1086
  actionflow / agent / API id, its version, and its input argument names. Then invoke it via
1083
- runtime_graphql against the runtime endpoint${a?` (${Ps().runtimeGraphqlUrl(a)})`:""}.
1087
+ runtime_graphql against the runtime endpoint${a?` (${Ds().runtimeGraphqlUrl(a)})`:""}.
1084
1088
 
1085
1089
  ${Rt("actionflow-invocation")}
1086
1090
 
@@ -1088,23 +1092,23 @@ ${Rt("ai-agent-invocation")}
1088
1092
 
1089
1093
  ${Rt("api-invocation")}
1090
1094
 
1091
- ${ty(s)}`)}),r("upload-asset",{title:"Upload a binary asset",description:"Upload an image/video/file via the mandatory presigned-URL flow and reference it by id.",argsSchema:{projectExId:c.string().optional()}},async()=>Mn("Binary asset upload workflow",`Upload a binary asset and reference it from a row.
1095
+ ${ay(s)}`)}),r("upload-asset",{title:"Upload a binary asset",description:"Upload an image/video/file via the mandatory presigned-URL flow and reference it by id.",argsSchema:{projectExId:c.string().optional()}},async()=>zn("Binary asset upload workflow",`Upload a binary asset and reference it from a row.
1092
1096
 
1093
1097
  ${Rt("asset-upload")}
1094
1098
 
1095
1099
  Run the presigned-URL mutation through runtime_graphql, perform the PUT yourself, then
1096
- store the returned id in the target table's *_id column via a runtime_graphql mutation.`)),r("audit-permissions",{title:"Audit or diagnose permissions",description:`Investigate a ${n} access-control question, 403 error, or RBAC/ABAC configuration using logs and schema state.`,argsSchema:{concern:c.string(),projectExId:c.string().optional()}},async({concern:o,projectExId:a})=>Mn("Permission audit / diagnosis workflow",`Investigate this permission concern: "${o}".
1100
+ store the returned id in the target table's *_id column via a runtime_graphql mutation.`)),r("audit-permissions",{title:"Audit or diagnose permissions",description:`Investigate a ${n} access-control question, 403 error, or RBAC/ABAC configuration using logs and schema state.`,argsSchema:{concern:c.string(),projectExId:c.string().optional()}},async({concern:o,projectExId:a})=>zn("Permission audit / diagnosis workflow",`Investigate this permission concern: "${o}".
1097
1101
 
1098
- ${Ro("permissions")}
1102
+ ${xo("permissions")}
1099
1103
 
1100
- ${Ro("logs")}
1104
+ ${xo("logs")}
1101
1105
 
1102
1106
  If it is a runtime 403, pull recent activity with schema_observe op=EVENTS and search_logs${a?` for project ${a}`:""} (GQL/GATEWAY types) to find the failing role/table/op, then confirm with a targeted
1103
1107
  runtime_graphql read. State exactly which editor Settings change (and whether a
1104
- sync_backend) is needed \u2014 the agent cannot apply permission changes directly.`)),r("diagnose",{title:"Diagnose a runtime error",description:`Investigate a ${n} runtime error or permission issue using logs and schema state.`,argsSchema:{symptom:c.string(),projectExId:c.string().optional()}},async({symptom:o,projectExId:a})=>Mn("Runtime diagnosis workflow",`Investigate this symptom: "${o}".
1108
+ sync_backend) is needed \u2014 the agent cannot apply permission changes directly.`)),r("diagnose",{title:"Diagnose a runtime error",description:`Investigate a ${n} runtime error or permission issue using logs and schema state.`,argsSchema:{symptom:c.string(),projectExId:c.string().optional()}},async({symptom:o,projectExId:a})=>zn("Runtime diagnosis workflow",`Investigate this symptom: "${o}".
1105
1109
 
1106
- ${Ro("logs")}
1110
+ ${xo("logs")}
1107
1111
 
1108
1112
  Pull recent activity with schema_observe (op EVENTS and STATE)${a?` for project ${a}`:""}, and run targeted reads with runtime_graphql to confirm the hypothesis. Separate
1109
1113
  configuration mistakes from platform bugs, and state exactly which editor change or sync_backend
1110
- step is needed to fix it.`))}export{aC as a,cy as b,fy as c,kt as d,sC as e,Fn as f,uC as g,c as h,NU as i,Eu as j,qP as k,VP as l,Xe as m,Ft as n,jt as o,Hc as p,Pp as q,$ as r,LR as s,ma as t,Hb as u,er as v,tw as w,nw as x,ow as y,aw as z,iw as A,lw as B,mw as C,Tw as D,bw as E,Iw as F,Ca as G,Sw as H,UR as I,Mw as J,Jr as K,cl as L,Qw as M,rr as N,av as O,k as P,$a as Q,Am as R,gs as S,Eg as T,Tg as U,Ig as V,Ag as W,Hg as X,ZU as Y,Ps as Z,tF as _};
1114
+ step is needed to fix it.`))}export{hC as a,hy as b,Ey as c,xt as d,pC as e,jn as f,yC as g,c as h,LU as i,bu as j,YP as k,KP as l,Xe as m,Ft as n,jt as o,Kc as p,Cp as q,$ as r,GR as s,fa as t,Xb as u,tr as v,aw as w,sw as x,cw as y,lw as z,uw as A,pw as B,yw as C,Iw as D,Aw as E,Nw as F,Da as G,Cw as H,VR as I,jw as J,Xr as K,dl as L,rv as M,or as N,lv as O,x as P,Ma as Q,Sm as R,ys as S,Tg as T,bg as U,Ag as V,Sg as W,Xg as X,KU as Y,Ds as Z,cF as _};