zion-mcp 2.8.4 → 2.8.5

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,46 +1,46 @@
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-UDGZVTYO.js";import{c as N,d as Ds,e as Iu,g as u}from"./chunk-Z77UGRGO.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}},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 Ma=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=Ma;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 Ma{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,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 Tl(d);l.set(d,za.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:{}}},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=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 ja{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)}},Rl=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)}},Fa=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 Dl=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 ja(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 Rl(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 Fa("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 Fa("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 Dl;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 Rv=Pm(V.operators.OR);function Dv(...t){return t.reduce(Rv)}V.or=Dv;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:(Dm(t,e),!km(e,t.self.RULES.all))}W.alwaysValidSchema=Lv;function Dm(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=Dm;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 zv({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=zv;function Mv(t){return xm(decodeURIComponent(t))}W.unescapeFragment=Mv;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 jv(t,e){if(Array.isArray(t))for(let n of t)e(n);else e(t)}W.eachItem=jv;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} || {}`),zl(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&&zl(t,n,e),n}W.evaluatedPropsToName=Lm;function zl(t,e,n){Object.keys(n).forEach(r=>t.assign((0,ae._)`${e}${(0,ae.getProperty)(r)}`,!0))}W.setEvaluated=zl;var Rm={};function Fv(t,e){return t.scopeValue("func",{ref:e,code:Rm[e.code]||(Rm[e.code]=new kv._Code(e.code))})}W.useFunc=Fv;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(Ml=>{"use strict";u();Object.defineProperty(Ml,"__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")};Ml.default=Zv});var io=N(Re=>{"use strict";u();Object.defineProperty(Re,"__esModule",{value:!0});Re.extendErrors=Re.resetErrorsCount=Re.reportExtraError=Re.reportError=Re.keyword$DataError=Re.keywordError=void 0;var ee=q(),Ba=Q(),$e=Ct();Re.keywordError={message:({keyword:t})=>(0,ee.str)`must pass "${t}" keyword validation`};Re.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=Re.keywordError,n,r){let{it:o}=t,{gen:a,compositeRule:s,allErrors:i}=o,l=Um(t,e,n);r??(s||i)?zm(a,l):Mm(o,(0,ee._)`[${l}]`)}Re.reportError=Bv;function qv(t,e=Re.keywordError,n){let{it:r}=t,{gen:o,compositeRule:a,allErrors:s}=r,i=Um(t,e,n);zm(o,i),a||s||Mm(r,$e.default.vErrors)}Re.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)))}Re.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))})}Re.extendErrors=Wv;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 Mm(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 Fm=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?jm(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),jm(t)):n.var(e,!0)}sr.boolOrEmptySchema=rI;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,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 jl=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(De=>{"use strict";u();Object.defineProperty(De,"__esModule",{value:!0});De.reportTypeError=De.checkDataTypes=De.checkDataType=De.coerceAndCheckDataType=De.getJSONTypes=De.getSchemaTypes=De.DataType=void 0;var lI=Ul(),dI=jl(),uI=io(),Z=q(),Bm=Q(),cr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(cr||(De.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}De.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(","))}De.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}De.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 Un,h as Au,i as Su}from"./chunk-K7ILN5SX.js";import{c as N,d as Rs,e as Iu,g as u}from"./chunk-CCPB2BTC.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
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 Fl(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)}}De.checkDataType=Fl;function Gl(t,e,n,r){if(t.length===1)return Fl(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,Fl(s,e,n,r));return o}De.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)}De.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 RI(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=RI});var Qm=N(yt=>{"use strict";u();Object.defineProperty(yt,"__esModule",{value:!0});yt.validateKeywordUsage=yt.validSchemaType=yt.funcKeywordCode=yt.macroKeywordCode=void 0;var ze=q(),Pn=Ct(),DI=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:ze.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;zI(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,ze._)`await `),I=>r.assign(p,!1).if((0,ze._)`${I} instanceof ${l.ValidationError}`,()=>r.assign(w,(0,ze._)`${I}.errors`),()=>r.throw(I))),w}function m(){let w=(0,ze._)`${h}.errors`;return r.assign(w,null),y(ze.nil),w}function y(w=e.async?(0,ze._)`await `:ze.nil){let I=l.opts.passContext?Pn.default.this:Pn.default.self,S=!("compile"in e&&!i||e.schema===!1);r.assign(p,(0,ze._)`${w}${(0,DI.callValidateCode)(t,h,I,S)}`,e.modifying)}function T(w){var I;r.if((0,ze.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,ze._)`${r.parentData}[${r.parentDataProperty}]`))}function $I(t,e){let{gen:n}=t;n.if((0,ze._)`Array.isArray(${e})`,()=>{n.assign(Pn.default.vErrors,(0,ze._)`${Pn.default.vErrors} === null ? ${e} : ${Pn.default.vErrors}.concat(${e})`).assign(Pn.default.errors,(0,ze._)`${Pn.default.vErrors}.length`),(0,kI.extendErrors)(t)},()=>t.error())}function zI({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,ze.stringify)(n)})}function MI(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=MI;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 jI(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=jI;function FI(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=FI;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 R=this.opts.uriResolver.resolve;if(S=dr(T?R(T,S):S),l.has(S))throw h(S);l.add(S);let z=this.refs[S];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?d(p,z.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=Fm(),lf=co(),Kl=jl(),Wa=co(),eA=Hm(),ho=Qm(),Yl=tf(),L=q(),F=Ct(),tA=lo(),Rt=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._)`${F.default.data}, ${F.default.valCxt}`,r.$async,()=>{t.code((0,L._)`"use strict"; ${df(n,o)}`),oA(t,o),t.code(a)}):t.func(e,(0,L._)`${F.default.data}, ${rA(o)}`,r.$async,()=>t.code(df(n,o)).code(a))}function rA(t){return(0,L._)`{${F.default.instancePath}="", ${F.default.parentData}, ${F.default.parentDataProperty}, ${F.default.rootData}=${F.default.data}${t.dynamicRef?(0,L._)`, ${F.default.dynamicAnchors}={}`:L.nil}}={}`}function oA(t,e){t.if(F.default.valCxt,()=>{t.var(F.default.instancePath,(0,L._)`${F.default.valCxt}.${F.default.instancePath}`),t.var(F.default.parentData,(0,L._)`${F.default.valCxt}.${F.default.parentData}`),t.var(F.default.parentDataProperty,(0,L._)`${F.default.valCxt}.${F.default.parentDataProperty}`),t.var(F.default.rootData,(0,L._)`${F.default.valCxt}.${F.default.rootData}`),e.dynamicRef&&t.var(F.default.dynamicAnchors,(0,L._)`${F.default.valCxt}.${F.default.dynamicAnchors}`)},()=>{t.var(F.default.instancePath,(0,L._)`""`),t.var(F.default.parentData,(0,L._)`undefined`),t.var(F.default.parentDataProperty,(0,L._)`undefined`),t.var(F.default.rootData,F.default.data),e.dynamicRef&&t.var(F.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(F.default.vErrors,null),r.let(F.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",F.default.errors);yf(t,a),r.var(e,(0,L._)`${a} === ${F.default.errors}`)}function gf(t){(0,Rt.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,Rt.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,Rt.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._)`${F.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._)`${F.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._)`${F.default.errors} === 0`,()=>e.return(F.default.data),()=>e.throw((0,L._)`new ${o}(${F.default.vErrors})`)):(e.assign((0,L._)`${r}.errors`,F.default.vErrors),a.unevaluated&&mA(t),e.return((0,L._)`${F.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,Rt.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._)`${F.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,Rt.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,Rt.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",F.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=Rt.mergeEvaluated.props(o,e.props,r.props,n)),r.items!==!0&&e.items!==void 0&&(r.items=Rt.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 F.default.rootData;if(t[0]==="/"){if(!bA.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,a=F.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,Rt.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$,Rf)=>{"use strict";u();var RA=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),DA=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 zA(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 MA={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},UA=/[@/?#:]/g,jA=/[@/?#]/g;function Cf(t,e){let n=e?jA:UA;return n.lastIndex=0,t.replace(n,r=>MA[r])}function FA(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}}DA(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}Rf.exports={nonSimpleDomain:kA,recomposeAuthority:BA,reescapeHostDelimiters:Cf,normalizePercentEncoding:FA,normalizePathEncoding:GA,escapePreservingEscapes:ZA,removeDotSegments:zA,isIPv4:Of,isUUID:RA,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 Df(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:Df,serialize:kf},tS={scheme:"https",domainHost:xf.domainHost,parse:Df,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:Mf}=$f();function mS(t,e){return typeof t=="string"?t=ES(t,e):typeof t=="object"&&(t=hr(Rn(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,Rn(o,r)}function Uf(t,e,n,r){let o={};return r||(t=hr(Rn(t,n),n),e=hr(Rn(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=zf(t,n),o=zf(e,n);return r!==void 0&&o!==void 0&&r.toLowerCase()===o.toLowerCase()}function Rn(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=Mf(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 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(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=Mf(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 jf(t,e).parsed}function ES(t,e){return Ff(t,e).normalized}function Ff(t,e){let{parsed:n,malformedAuthorityOrPort:r}=jf(t,e);return{normalized:r?t:Rn(n,e),malformedAuthorityOrPort:r}}function zf(t,e){if(typeof t=="string"){let{normalized:n,malformedAuthorityOrPort:r}=Ff(t,e);return r?void 0:n}if(typeof t=="object")return Rn(t,e)}var dd={SCHEMES:pS,normalize:mS,resolve:fS,resolveComponent:Uf,equal:_S,serialize:Rn,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,R,z,ke,Ye,Mn,Cs;let vr=t.strict,Rs=(e=t.code)===null||e===void 0?void 0:e.optimize,wu=Rs===!0||Rs===void 0?1:Rs||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:(R=t.schemaId)!==null&&R!==void 0?R:"$id",addUsedSchema:(z=t.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(ke=t.validateSchema)!==null&&ke!==void 0?ke:!0,validateFormats:(Ye=t.validateFormats)!==null&&Ye!==void 0?Ye:!0,unicodeRegExp:(Mn=t.unicodeRegExp)!==null&&Mn!==void 0?Mn:!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&&RS.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&DS.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(zS.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 RS(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function DS(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 zS(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?MS.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 MS(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 jS={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Jf(t){return{anyOf:[t,jS]}}});var Qf=N(md=>{"use strict";u();Object.defineProperty(md,"__esModule",{value:!0});var FS={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};md.default=FS});var r_=N(Dn=>{"use strict";u();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.callRef=Dn.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`}Dn.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)}}}Dn.callRef=rs;Dn.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_(),RO=f_(),DO=__(),kO=g_(),xO=[IO.default,AO.default,SO.default,OO.default,NO.default,PO.default,CO.default,RO.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},DO.default,kO.default];Cd.default=xO});var Dd=N(Ao=>{"use strict";u();Object.defineProperty(Ao,"__esModule",{value:!0});Ao.validateAdditionalItems=void 0;var xn=q(),Rd=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,Rd.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,Rd.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:Rd.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(),zO=nt(),MO={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,zO.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=MO});var w_=N(xd=>{"use strict";u();Object.defineProperty(xd,"__esModule",{value:!0});var UO=kd(),jO={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,UO.validateTuple)(t,"items")};xd.default=jO});var I_=N(Ld=>{"use strict";u();Object.defineProperty(Ld,"__esModule",{value:!0});var v_=q(),FO=Q(),GO=nt(),ZO=Dd(),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,FO.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 zd=q(),HO=Q(),Oo=nt();Tt.error={message:({params:{property:t,depsCount:e,deps:n}})=>{let r=e===1?"property":"properties";return(0,zd.str)`must have ${r} ${n} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:n,missingProperty:r}})=>(0,zd._)`{property: ${t},
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},
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,zd._)`${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(Md=>{"use strict";u();Object.defineProperty(Md,"__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)}};Md.default=QO});var jd=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(),R_=nt(),Fd=Q(),D_=jd(),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&&D_.default.code(new rN.KeywordCxt(a,D_.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=Fd.mergeEvaluated.props(e,(0,Fd.toHash)(s),a.props));let i=s.filter(p=>!(0,Fd.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)}}};Gd.default=oN});var z_=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 M_=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 j_=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 F_=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=Dd(),TN=w_(),bN=kd(),wN=I_(),vN=A_(),IN=N_(),AN=C_(),SN=jd(),ON=k_(),NN=z_(),PN=M_(),CN=U_(),RN=j_(),DN=F_(),kN=B_(),xN=q_();function LN(t=!1){let e=[PN.default,CN.default,RN.default,DN.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}}`},zN={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 R=h.$async?(0,ge._)`(${y}.async ? await ${w}(${r}) : ${w}(${r}))`:(0,ge._)`${w}(${r})`,z=(0,ge._)`(typeof ${w} == "function" ? ${R} : ${w}.test(${r}))`;return(0,ge._)`${w} && ${w} !== true && ${T} === ${e} && !${z}`}}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(R());function I(){if(l.strictSchema===!1){p.logger.warn(z());return}throw new Error(z());function z(){return`unknown format "${a}" ignored in schema at path "${d}"`}}function S(z){let ke=z instanceof RegExp?(0,ge.regexpCode)(z):l.code.formats?(0,ge._)`${l.code.formats}${(0,ge.getProperty)(a)}`:void 0,Ye=n.scopeValue("formats",{key:a,ref:z,code:ke});return typeof z=="object"&&!(z instanceof RegExp)?[z.type||"string",z.validate,(0,ge._)`${Ye}.validate`]:["string",z,Ye]}function R(){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=zN});var H_=N(Xd=>{"use strict";u();Object.defineProperty(Xd,"__esModule",{value:!0});var MN=W_(),UN=[MN.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 jN=o_(),FN=y_(),GN=V_(),ZN=H_(),K_=Y_(),BN=[jN.default,FN.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 R=0;R<s.length;R++){let z=s[R];if(z?.$ref&&!(0,VN.schemaHasRulesButRef)(z,a.self.RULES)){let Ye=z.$ref;if(z=eg.resolveRef.call(a.self,a.schemaEnv.root,a.baseId,Ye),z instanceof eg.SchemaEnv&&(z=z.schema),z===void 0)throw new qN.default(a.opts.uriResolver,a.baseId,Ye)}let ke=(f=z?.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(z)),I(ke,R)}if(!T)throw new Error(`discriminator: "${i}" must be required`);return m;function w({required:R}){return Array.isArray(R)&&R.includes(i)}function I(R,z){if(R.const)S(R.const,z);else if(R.enum)for(let ke of R.enum)S(ke,z);else throw new Error(`discriminator: "properties/${i}" must have "const" or "enum"`)}function S(R,z){if(typeof R!="string"||R in m)throw new Error(`discriminator: "${i}" values must be unique strings`);m[R]=z}}}};tu.default=HN});var ng=N((aM,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 zs=Su,$o=null;function jn(){if($o)return $o;let t=(process.env.ZION_ENV??process.env.MCP_ENV)?.trim().toLowerCase(),e=Au;if(t){if(!zs[t])throw new Error(`Unknown environment "${t}". Known: ${Object.keys(zs).join(", ")}.`);e=t}let n=zs[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 Ru=!1;function uC(){if(Ru)return;Ru=!0;let t=jn();kt("info",`Backend environment: ${t.name} (api=${t.apiBaseUrl})`)}u();u();u();u();var c={};Ds(c,{BRAND:()=>qy,DIRTY:()=>en,EMPTY_PATH:()=>vy,INVALID:()=>M,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:()=>Me,ZodFirstPartyTypeKind:()=>A,ZodFunction:()=>Fo,ZodIntersection:()=>ln,ZodIssueCode:()=>v,ZodLazy:()=>dn,ZodLiteral:()=>un,ZodMap:()=>Vn,ZodNaN:()=>Hn,ZodNativeEnum:()=>pn,ZodNever:()=>at,ZodNull:()=>sn,ZodNullable:()=>_t,ZodNumber:()=>tn,ZodObject:()=>je,ZodOptional:()=>Ue,ZodParsedType:()=>P,ZodPipeline:()=>Or,ZodPromise:()=>zt,ZodReadonly:()=>_n,ZodRecord:()=>jo,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:()=>zu,defaultErrorMap:()=>vt,discriminatedUnion:()=>iE,effect:()=>EE,enum:()=>_E,function:()=>pE,getErrorMap:()=>Fn,getParsedType:()=>mt,instanceof:()=>Wy,intersection:()=>cE,isAborted:()=>zo,isAsync:()=>Gn,isDirty:()=>Mo,isValid:()=>xt,late:()=>Vy,lazy:()=>mE,literal:()=>fE,makeIssue:()=>Ar,map:()=>uE,nan:()=>Hy,nativeEnum:()=>gE,never:()=>nE,null:()=>Qy,nullable:()=>bE,number:()=>Fu,object:()=>Fs,objectUtil:()=>Ms,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:()=>ju,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 Ms;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Ms||(Ms={}));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:"),Me=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()}};Me.create=t=>new Me(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 Du=vt;function wy(t){Du=t}function Fn(){return Du}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=Fn(),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 M;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 M;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}}},M=Object.freeze({status:"aborted"}),en=t=>({status:"dirty",value:t}),Pe=t=>({status:"valid",value:t}),zo=t=>t.status==="aborted",Mo=t=>t.status==="dirty",xt=t=>t.status==="valid",Gn=t=>typeof Promise<"u"&&t instanceof Promise;u();u();var D;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(D||(D={}));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 Me(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 zt.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)?)??$/,Ry=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Dy="^(\\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])$/,zy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,My=/^([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 jy(t){return new RegExp(`^${$u(t)}$`)}function zu(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 Fy(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}),M}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")Ry.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(Dy,"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"?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"?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"?jy(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"?Fy(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"?zy.test(e.data)||(o=this._getOrReturnCtx(e,o),O(o,{validation:"base64",code:v.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?My.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,...D.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...D.errToObj(e)})}url(e){return this._addCheck({kind:"url",...D.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...D.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...D.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...D.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...D.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...D.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...D.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...D.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...D.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...D.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...D.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...D.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,...D.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,...D.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...D.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...D.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...D.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...D.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...D.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...D.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...D.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...D.errToObj(n)})}nonempty(e){return this.min(1,D.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}),M}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,D.toString(n))}gt(e,n){return this.setLimit("min",e,!1,D.toString(n))}lte(e,n){return this.setLimit("max",e,!0,D.toString(n))}lt(e,n){return this.setLimit("max",e,!1,D.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:D.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:D.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:D.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:D.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.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}),M}gte(e,n){return this.setLimit("min",e,!0,D.toString(n))}gt(e,n){return this.setLimit("min",e,!1,D.toString(n))}lte(e,n){return this.setLimit("max",e,!0,D.toString(n))}lt(e,n){return this.setLimit("max",e,!1,D.toString(n))}setLimit(e,n,r,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:D.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:D.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:D.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}),M}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}),M}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return O(a,{code:v.invalid_date}),M}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:D.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:D.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}),M}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}),M}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}),M}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}),M}};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}),M}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}),M;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:D.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:D.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:D.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 je){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Ue.create(Zn(r))}return new je({...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 je=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}),M}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 D.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:D.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 Mu(H.objectKeys(this.shape))}};je.create=(t,e)=>new je({shape:()=>t,unknownKeys:"strip",catchall:at.create(),typeName:A.ZodObject,...G(e)});je.strictCreate=(t,e)=>new je({shape:()=>t,unknownKeys:"strict",catchall:at.create(),typeName:A.ZodObject,...G(e)});je.lazycreate=(t,e)=>new je({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 Me(i.ctx.common.issues));return O(n,{code:v.invalid_union,unionErrors:s}),M}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 Me(l));return O(n,{code:v.invalid_union,unionErrors:i}),M}}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}),M;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]}),M)}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 js(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=js(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=js(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 M;let i=js(a.value,s.value);return i.valid?((Mo(a)||Mo(s))&&n.dirty(),{status:n.value,value:i.data}):(O(r,{code:v.invalid_intersection_types}),M)};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}),M;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"}),M;!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}),M;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}),M;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 M;(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 M;(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}),M;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 M;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:D.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:D.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 Fo=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}),M;function r(i,l){return Ar({data:i,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Fn(),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,Fn(),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 zt){let i=this;return Pe(async function(...l){let d=new Me([]),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 Me([r(l,d.error)]);let h=Reflect.apply(s,this,d.data),p=i._def.returns.safeParse(h,a);if(!p.success)throw new Me([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}),M}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 Mu(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}),M}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}),M}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=Mu;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}),M}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}),M}return Pe(e.data)}get enum(){return this._def.values}};pn.create=(t,e)=>new pn({values:t,typeName:A.ZodNativeEnum,...G(e)});var zt=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}),M;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})))}};zt.create=(t,e)=>new zt({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 M;let l=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});return l.status==="aborted"?M:l.status==="dirty"?en(l.value):n.value==="dirty"?en(l.value):l});{if(n.value==="aborted")return M;let i=this._def.schema._parseSync({data:s,path:r.path,parent:r});return i.status==="aborted"?M: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"?M:(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"?M:(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 M;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})):M);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 Me(r.common.issues)},input:r.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Me(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}),M}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"?M: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"?M: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:je.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),ju=Lt.create,Fu=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,Fs=je.create,aE=je.strictCreate,sE=cn.create,iE=Uo.create,cE=ln.create,lE=ft.create,dE=jo.create,uE=Vn.create,hE=Wn.create,pE=Fo.create,mE=dn.create,fE=un.create,_E=hn.create,gE=pn.create,yE=zt.create,EE=Je.create,TE=Ue.create,bE=_t.create,wE=Je.createWithPreprocess,vE=Or.create,IE=()=>ju().optional(),AE=()=>Fu().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=M;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={};Ds(Y,{BIGINT_FORMAT_RANGES:()=>Bu,Class:()=>Zs,NUMBER_FORMAT_RANGES:()=>Ks,aborted:()=>yn,allowsEval:()=>Ws,assert:()=>LE,assertEqual:()=>RE,assertIs:()=>kE,assertNever:()=>xE,assertNotEqual:()=>DE,assignProp:()=>Vs,cached:()=>Cr,captureStackTrace:()=>Bo,cleanEnum:()=>HE,cleanRegex:()=>Dr,clone:()=>We,createTransparentProxy:()=>FE,defineLazy:()=>se,esc:()=>gn,escapeRegex:()=>Mt,extend:()=>BE,finalizeIssue:()=>st,floatSafeRemainder:()=>qs,getElementAtPath:()=>$E,getEnumValues:()=>Pr,getLengthableOrigin:()=>kr,getParsedType:()=>jE,getSizableOrigin:()=>qu,isObject:()=>Yn,isPlainObject:()=>Kn,issue:()=>Js,joinValues:()=>Zo,jsonStringifyReplacer:()=>Bs,merge:()=>qE,normalizeParams:()=>U,nullish:()=>Rr,numKeys:()=>UE,omit:()=>ZE,optionalKeys:()=>Ys,partial:()=>VE,pick:()=>GE,prefixIssues:()=>gt,primitiveTypes:()=>Zu,promiseAllObject:()=>zE,propertyKeyTypes:()=>Hs,randomString:()=>ME,required:()=>WE,stringifyPrimitive:()=>qo,unwrapMessage:()=>Nr});u();function RE(t){return t}function DE(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 Rr(t){return t==null}function Dr(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 zE(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 ME(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 jE=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 Mt(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 FE(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!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})}}),Sh=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})}}),Oh=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})}}),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)}),Rh=b("$ZodCheckIncludes",(t,e)=>{Ie.init(t,e);let n=Mt(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})}}),Dh=b("$ZodCheckStartsWith",(t,e)=>{Ie.init(t,e);let n=new RegExp(`^${Mt(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(`.*${Mt(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 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(`
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)}),Ri=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 Di=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 zh(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=>zh(d,n,s))):zh(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 Mh(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 R=gn(I);g.write(`
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(`
14
14
  if (${S}.issues.length) {
15
- if (input[${R}] === undefined) {
16
- if (${R} in input) {
17
- newResult[${R}] = undefined;
15
+ if (input[${D}] === undefined) {
16
+ if (${D} in input) {
17
+ newResult[${D}] = undefined;
18
18
  }
19
19
  } else {
20
20
  payload.issues = payload.issues.concat(
21
21
  ${S}.issues.map((iss) => ({
22
22
  ...iss,
23
- path: iss.path ? [${R}, ...iss.path] : [${R}],
23
+ path: iss.path ? [${D}, ...iss.path] : [${D}],
24
24
  }))
25
25
  );
26
26
  }
27
27
  } else if (${S}.value === undefined) {
28
- if (${R} in input) newResult[${R}] = undefined;
28
+ if (${D} in input) newResult[${D}] = undefined;
29
29
  } else {
30
- newResult[${R}] = ${S}.value;
30
+ newResult[${D}] = ${S}.value;
31
31
  }
32
32
  `)}else{let S=y[I];g.write(`const ${S} = ${m(I)};`),g.write(`
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 R of h.keys){let z=S[R],ke=z._zod.run({value:f[R],issues:[]},g),Ye=z._zod.optin==="optional"&&z._zod.optout==="optional";ke instanceof Promise?m.push(ke.then(Mn=>Ye?Mh(Mn,p,R,f):Yo(Mn,p,R))):Ye?Mh(ke,p,R,f):Yo(ke,p,R)}}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 R=w.run({value:f[S],issues:[]},g);R instanceof Promise?m.push(R.then(z=>Yo(z,p,S))):Yo(R,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=>Dr(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)}}),zi=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 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 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=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 Mi=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"?Mt(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}}),ji=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"?Mt(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 Fi=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(`^(${Dr(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(`^(${Dr(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=>Fh(a,e)):Fh(o,e)}});function Fh(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"),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 Xh(){return new zr}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 Mr(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 Rh({check:"string_format",format:"includes",...U(e),includes:t})}function Pc(t,e){return new Dh({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 Rc(t){return bn(e=>e.normalize(t))}function Dc(){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 R=[...I];R.length===1?m.pattern=R[0].source:R.length>1&&(i.schema.allOf=[...R.map(z=>({...this.target==="draft-7"?{type:"string"}:{},pattern:z.source}))])}break}case"number":{let m=f,{minimum:y,maximum:T,format:w,multipleOf:I,exclusiveMaximum:S,exclusiveMinimum:R}=e._zod.bag;typeof w=="string"&&w.includes("int")?m.type="integer":m.type="number",typeof R=="number"&&(m.exclusiveMinimum=R),typeof y=="number"&&(m.minimum=y,typeof R=="number"&&(R>=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=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>
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 zc(t,e){if(t instanceof zr){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 zT=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 MT=b("ZodMiniObject",(t,e)=>{Jo.init(t,e),zT.init(t,e),Y.defineLazy(t,"shape",()=>e.shape)});function Mc(t,e){let n={type:"object",get shape(){return Y.assignProp(this,"shape",{...t}),this.shape},...Y.normalizeParams(e)};return new MT(n)}function Xe(t){return!!t._zod}function vn(t){let e=Object.values(t);if(e.length===0)return Mc({});let n=e.every(Xe),r=e.every(o=>!Xe(o));if(n)return Mc(t);if(r)return Fs(t);throw new Error("Mixed Zod versions detected in object shape.")}function jt(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 Ft(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 jr={};Ds(jr,{ZodISODate:()=>cp,ZodISODateTime:()=>ip,ZodISODuration:()=>dp,ZodISOTime:()=>lp,date:()=>jc,datetime:()=>Uc,duration:()=>Gc,time:()=>Fc});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 jc(t){return ep(cp,t)}var lp=b("ZodISOTime",(t,e)=>{Hh.init(t,e),he.init(t,e)});function Fc(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}}})},_D=b("ZodError",up),Fr=b("ZodError",up,{Parent:Error});var hp=ei(Fr),pp=ni(Fr),mp=oi(Fr),fp=ai(Fr);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(Dc()),t.normalize=(...r)=>t.check(Rc(...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(jc(n)),t.time=n=>t.check(Fc(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(Mr(r,o)),t.max=(r,o)=>t.check(Mr(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(Mr(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)=>{Ri.init(t,e),_e.init(t,e)});function we(t){return bc(hb,t)}var pb=b("ZodNull",(t,e)=>{Di.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=()=>Fe(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)=>{zi.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)=>{Mi.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 Fe(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)=>{ji.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)=>{Fi.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 Rb=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 Rb({type:"pipe",in:t,out:e})}var Db=b("ZodReadonly",(t,e)=>{Yi.init(t,e),_e.init(t,e)});function kb(t){return new Db({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()]),Rp=E(),xD=xe({ttl:ne().optional(),pollInterval:ne().optional()}),zb=C({ttl:ne().optional()}),Mb=C({taskId:E()}),Yc=xe({progressToken:Cp.optional(),[Gt]:Mb.optional()}),He=C({_meta:Yc.optional()}),Gr=He.extend({task:zb.optional()}),Dp=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 LD=le([kp,xp,Jc,Xc]),$D=le([Jc,Xc]),ma=Se.strict(),Ub=Qe.extend({requestId:pa.optional(),reason:E().optional()}),fa=et.extend({method:x("notifications/cancelled"),params:Ub}),jb=C({src:E(),mimeType:E().optional(),sizes:K(E()).optional(),theme:Fe(["light","dark"]).optional()}),Br=C({icons:K(jb).optional()}),Qn=C({name:E(),title:E().optional()}),zp=Qn.extend({...Qn.shape,...Br.shape,version:E(),websiteUrl:E().optional(),description:E().optional()}),Fb=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:Fb.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:zp}),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:zp,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:Rp.optional()}),qr=Ae.extend({params:Jb.optional()}),Vr=Se.extend({nextCursor:Rp.optional()}),Xb=Fe(["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()})}),zD=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()})}),Mp=Se.merge(Wr),Up=C({uri:E(),mimeType:me(E()),_meta:ce(E(),pe()).optional()}),jp=Up.extend({text:E()}),tl=E().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Fp=Up.extend({blob:tl}),Yr=Fe(["user","assistant"]),tr=C({audience:K(Yr).optional(),priority:ne().min(0).max(1).optional(),lastModified:jr.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([jp,Fp]))}),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([jp,Fp]),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:Fe(["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()}),MD=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()}),UD=C({autoRefresh:we().default(!0),debounceMs:ne().int().nonnegative().default(300)}),Kr=Fe(["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()}),Rw=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()}),Dw=C({mode:Fe(["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:Rw.optional(),systemPrompt:E().optional(),includeContext:Fe(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:K(E()).optional(),metadata:Te.optional(),tools:K(Zp).optional(),toolChoice:Dw.optional()}),zw=Ae.extend({method:x("sampling/createMessage"),params:$w}),Jr=Se.extend({model:E(),stopReason:me(Fe(["endTurn","stopSequence","maxTokens"]).or(E())),role:Yr,content:xw}),cl=Se.extend({model:E(),stopReason:me(Fe(["endTurn","stopSequence","maxTokens","toolUse"]).or(E())),role:Yr,content:le([ua,K(ua)])}),Mw=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:Fe(["email","uri","date","date-time"]).optional(),default:E().optional()}),jw=C({type:Fe(["number","integer"]),title:E().optional(),description:E().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),Fw=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([Fw,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,Mw,Uw,jw]),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:Fe(["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()}),Ra=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()}),jD=le([_a,Qc,Ra,il,Na,Oa,Ia,Aa,Sa,iw,lw,nr,Pa,ya,Ta,ba,va]),FD=le([fa,ga,el,cv,Hr]),GD=le([ma,Jr,cl,rr,ll,Ea,wa,er]),ZD=le([_a,zw,Qw,iv,ya,Ta,ba,va]),BD=le([fa,ga,Pw,uw,aw,Sw,bw,Hr,tv]),qD=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 Da=(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"?Da(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=j(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 j(t.type._def,e)}u();var Qp=(t,e)=>j(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{...j(t.innerType._def,e),default:t.defaultValue()}}u();function tm(t,e){return e.effectStrategy==="input"?j(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=[j(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),j(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 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
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]:j(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let n={type:"object",additionalProperties:j(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=j(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),r=j(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)=>j(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=j(t.innerType._def,{...e,currentPath:[...e.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}let n=j(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=j(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 j(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 j(t.innerType._def,e);let n=j(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 j(t.in._def,e);if(e.pipeStrategy==="output")return j(t.out._def,e);let n=j(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=j(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 j(t.type._def,e)}u();function ym(t,e){let r={type:"array",uniqueItems:!0,items:j(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)=>j(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:j(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>j(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)=>j(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 j(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"?j(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:Da(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]:j(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=j(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)?zc(t,{target:gv(e?.target),io:e?.pipeStrategy??"input"}):ml(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function _l(t){let n=Ft(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=jt(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=Dp(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(R=>this._onerror(new Error(`Failed to send cancellation: ${R}`)));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=jt(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 R=this._responseHandlers.get(g);R?R(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},Mp,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=Ft(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=jt(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=jt(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=jt(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(Ra)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ra,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=Ft(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=Ft(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=Ft(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 zP}from"node:path";import{fileURLToPath as MP}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 RP(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 Rg(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=RP(o[0],o[1]).slice();return be.__wbindgen_free(o[0],o[1]*4,4),a}var DP=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&&DP.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 Dg(){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=Dg();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=Dg();(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=zP($P(MP(import.meta.url)),"jieba-engine.wasm");xg({module:LP(n)}),Lg=!0}return Rg(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"]),jP=/[a-z0-9]+/g,FP=t=>{let e=t.toLowerCase().replace(/'s\b/g,""),n=[];for(let r of e.matchAll(jP)){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 FP(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},zg=t=>{let e=t.length;return e>=2&&t[e-1]===t[e-2]&&$n(t,e-1)},Mg=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":zg(e)&&!/[lsz]$/.test(e)?e=e.slice(0,-1):Qt(e)===1&&Mg(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&&!Mg(i))&&(e=i)}return Qt(e)>1&&zg(e)&&e.endsWith("l")&&(e=e.slice(0,-1)),e}u();var Ug=1.5,jg=.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-jg+jg*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) with `insert ... on_conflict do nothing` and branch on affected_rows \u2014 that idiom is only expressible in a Run Code node, which makes it a legitimate Run Code use. 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 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.
44
44
 
45
45
  This overview details the structural design, data engines, execution pipelines, and safety requirements of the platform.
46
46
 
@@ -67,14 +67,14 @@ 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. 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. 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.
71
71
 
72
72
  ### 2.2 Level Two \u2014 Build That Release Path By Path
73
73
 
74
74
  Within the release you just scoped \u2014 never across the whole product \u2014 build one user path at a time, end to end: the tables it reads and writes, the screen it happens on, and the bindings and actions that connect them. A working screen then exists after the first path rather than after the whole data layer. Inside a path the order is set by what depends on what \u2014 a binding needs its table, an action its Actionflow, a style its theme variable \u2014 and each part involves:
75
75
 
76
76
  1. **Data Modeling**: the tables, constraints and relationships the path needs. Model a table fully when you create it \u2014 changing it later is a migration \u2014 but only the tables this path uses.
77
- 2. **UI Layout**: nested structural containers (Views) with static display/input components mapped onto them, each styled from the theme's variables rather than from values decided component by component. A project with no look of its own yet gets its theme variables set before its first screen; one that has a look keeps it.
77
+ 2. **UI Layout**: nested structural containers (Views) with static display/input components mapped onto them, each styled from the theme's variables rather than from values decided component by component. Each client's look is written down in its DESIGN.md and carried by those variables, settled before the client's first screen.
78
78
  3. **Logic & Binding**: dynamic variables/fields linked to inputs/displays, and actions or backend workflows mapped to events.
79
79
  4. **Verification**: the edit-time error panel shows what does not compile; runtime logs and a debug run show what failed when it ran.
80
80
 
@@ -182,11 +182,11 @@ Whenever a system requires segmented data access (e.g., multi-tenant, department
182
182
 
183
183
  ## 7. Environment Lifecycle Model
184
184
 
185
- * **Mirror**: Hot-reloading, local sandbox. Instantly reflects UI edits in a local window. No build compile or backend synchronization is required during rapid frontend iteration.
186
- * **Preview**: Compiles and builds the current source into a staging release, providing a unique staging URL. Necessary for deep verification testing of custom components and payment simulations.
187
- * **Publish**: Deploys the code to the production environment for live users. If database tables, APIs, or Actionflows were modified, they must be synchronized using **Sync Backend** to apply schema migrations to production servers.
185
+ * **\u5B9E\u65F6\u9884\u89C8**: Hot-reloading, local sandbox. Instantly reflects UI edits in a local window. No build compile or backend synchronization is required during rapid frontend iteration.
186
+ * **\u9884\u89C8**: Compiles and builds the current source into a staging release, providing a unique staging URL. Necessary for deep verification testing of custom components and payment simulations.
187
+ * **\u53D1\u5E03**: Deploys the code to the production environment for live users. If database tables, APIs, or Actionflows were modified, they must be synchronized using **\u540C\u6B65\u53D8\u66F4** to apply schema migrations to production servers.
188
188
 
189
- Mirror, Preview and Publish are things the USER drives from the editor \u2014 you cannot open a preview window or ship a release. What you can drive is the backend: load the \`runtime\` plugin to run an action flow node by node against the real backend, read and write table data as admin or as a given user, and read what the deployed app actually returns. Hand the user anything that needs a browser (visual checks, custom components, a real payment flow, a mini-program audit) and say plainly that it is theirs to do.
189
+ \u5B9E\u65F6\u9884\u89C8, \u9884\u89C8 and \u53D1\u5E03 are things the USER drives from the editor \u2014 you cannot open a preview window or ship a release. What you can drive is the backend: load the \`runtime\` plugin to run an action flow node by node against the real backend, read and write table data as admin or as a given user, and read what the deployed app actually returns. Hand the user anything that needs a browser (visual checks, custom components, a real payment flow, a mini-program audit) and say plainly that it is theirs to do.
190
190
 
191
191
  ---
192
192
 
@@ -214,10 +214,17 @@ Each project can publish to three independent client app targets, all sharing th
214
214
 
215
215
  ### WeChat Mini Program Lifecycle
216
216
  The mini program publish flow is distinct from web/mobile:
217
- 1. **Mirror**: Hot-reload preview inside the editor \u2014 same as web.
218
- 2. **Preview**: Builds a trial version QR code scannable in WeChat DevTools. No audit needed.
219
- 3. **Submit for Audit**: Submits the build to WeChat platform for review (1\u20137 business days).
220
- 4. **Release**: After audit approval, publish the version. Backend schema changes still require "Sync Backend" separately; mini program code and backend are released independently. Mini program releases are fully independent from the web/mobile release cycle.
217
+ 1. **\u5B9E\u65F6\u9884\u89C8**: Hot-reload preview inside the editor \u2014 same as web.
218
+ 2. **\u9884\u89C8**: Builds a trial version QR code scannable in WeChat DevTools. No audit needed.
219
+ 3. **\u63D0\u4EA4\u5FAE\u4FE1\u5BA1\u6838**: Submits the build to WeChat platform for review (1\u20137 business days).
220
+ 4. **\u53D1\u5E03**: After audit approval, publish the version. Backend schema changes still require \u300C\u540C\u6B65\u53D8\u66F4\u300D separately; mini program code and backend are released independently. Mini program releases are fully independent from the web/mobile release cycle.
221
+
222
+ ### Editor Labels When Talking to the User
223
+ The Zion editor's interface is in Chinese. These instructions name things in English; when you tell the user where something is or what it is called in the editor, use the editor's own label instead:
224
+ * Top tabs: Design / Data / Action / Settings \u2192 \u8BBE\u8BA1 / \u6570\u636E / \u884C\u4E3A / \u8BBE\u7F6E
225
+ * Actionflow \u2192 \u884C\u4E3A\u6D41; Payment settings \u2192 \u884C\u4E3A \u2192 \u652F\u4ED8; Permissions \u2192 \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406
226
+ * Roles: Anonymous user \u2192 \u6E38\u5BA2; Logged-in user \u2192 \u5DF2\u767B\u5F55\u7528\u6237
227
+ * Mirror \u2192 \u5B9E\u65F6\u9884\u89C8; Preview \u2192 \u9884\u89C8; Publish \u2192 \u53D1\u5E03; Sync Backend \u2192 \u540C\u6B65\u53D8\u66F4
221
228
 
222
229
  ### Payment Gateways
223
230
  * **WeChat Pay**: Native WeChat Pay v3 API. Requires merchant ID and API credentials.
@@ -232,7 +239,7 @@ The mini program publish flow is distinct from web/mobile:
232
239
  * Email/password
233
240
 
234
241
  ### Timezone & Locale
235
- 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).\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 `COPY_PRIVATE_OBJECT_TYPE_AS_PUBLIC` and select the public copy. 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`. 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: `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; the phone breakpoint in the editor 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### A Look Is Decided, Not Defaulted\nA request that names no visual direction \u2014 \"a task tracker\", \"a booking page\" \u2014 is not a request for no styling: the platform's creation defaults are what produce the grey-box build the user then has to describe their way out of. The subject is where a non-generic direction comes from \u2014 what this app is, who opens it, the one job it does, and the palette, typeface and type roles that reading implies \u2014 and it is the only input no other project shares: a shift-handover tool for night-shift nurses and a portfolio for a ceramicist should not resolve to the same screen. Written into the theme (next section), that direction holds every screen built out of it together. A direction the user states \u2014 a brand colour, \"dark\", \"playful\", a screenshot \u2014 replaces your own everywhere. What fails is splitting the difference: a stated direction on the first two screens and your own default on the rest reads worse than either applied throughout, because inconsistency looks like 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 direction you decided 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. Add it as a FONT_FAMILIES variable and reference it as fontFamily on every TEXT, BUTTON and TEXT_INPUT \u2014 then switching the face later is one edit. If the theme already has a FONT_FAMILIES variable, reference it rather than adding another; 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 (see below).\n- 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. On 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. 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### The Look That Reads As Generated\nNone of these is forbidden \u2014 each is right for some brief \u2014 but they are what gets reached for when nothing has been decided, so they appear regardless of subject. Where the user asked for one, give it to them. Where they left the axis free, spend the freedom elsewhere:\n- Cream page (near #F4F1EA) with a high-contrast serif display and a terracotta/clay accent (near #D97757).\n- Near-black page with one acid-green or vermilion accent.\n- Every surface on the same radius under the same soft grey shadow, whatever its role.\n- A tracked-out ALL-CAPS eyebrow label above every heading.\n- Meta strings joined with middle dots ('A \xB7 B \xB7 C'); '\u2192' appended to button text.\n- One word in a heading coloured or bolded to add interest.\n- Numbered markers (01 / 02 / 03) on content that is not actually a sequence.\n- A gradient used as decoration on a surface that has no reason to be gradient. A gradient is legitimate as the subject of a hero, or to keep text legible over an image; as a wash behind ordinary cards it is the clearest single tell.\n\n### Every Interactive Thing Answers The Cursor\n`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. 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.\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 `ADD_REQUEST_FILTER_CONDITION`). 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- 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.\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\nOnly the editor's canvas shows what the user will see, and canvas screenshots are not reachable from here; `schema validate` knows only about invalid schema. When the request calls for seeing the screen \u2014 you built a screen the user will judge, or they asked about its look \u2014 ask the user to open it in the editor; a change that only adds or rewires something on an existing screen does not need that. 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, and lines under ~70 characters; the accent only on the primary action and the active state; something that responds to hover; 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 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
236
243
  Zion uses PostgreSQL. Data model changes require "Sync Backend" to take effect online.
237
244
 
238
245
  ### Capabilities & Limitations
@@ -355,7 +362,7 @@ unfamiliar project, and treat its answer as the census: the per-domain \`list_*\
355
362
  subsets of it, so calling one after this buys nothing.
356
363
  - GET_ENTITY_RELATION_GRAPH \u2014 the relation graph around one entity: who reads / writes / calls / governs it, expanded a bounded number of hops. Use it before changing or deleting an entity to see what depends on it.
357
364
 
358
- Both are read-only; neither mutates the schema.`,payments:"## Payment System Domain Knowledge\nZion's payment system is built around a developer-owned **order table** plus a set of platform-managed payment records and the Actionflows that react to gateway callbacks. On Zion the legacy gateways are WeChat Pay (mini-program and H5/JSAPI) and Alipay (PC web; one-time plus recurring \"agreement\" subscriptions); payment-config projects also offer Stripe. Airwallex is available on both models where it is enabled for the project. There are two payment models, and GET_PAYMENT_CONFIGS's `legacyPaymentModel` says which one the project uses:\n- **Legacy**: activate the module with ACTIVATE_PAYMENT, which generates the gateway Actionflows and webhooks. The gateway credentials, the brand assets and the Pro-plan upgrade are the user's own, in the editor (Action \u2192 Payment).\n- **Payment configs**: add a config with ADD_PAYMENT_CONFIGS; the first add initializes the payment tables. Credentials (project secrets), products, clients and callback flows are edited through the payment tools; only brand assets and the plan upgrade stay in the editor.\n\n### Prerequisites (in order)\n1. The user upgrades the project to the Pro plan or higher (payments are gated by plan; an expired plan breaks live payments and blocks publishing).\n2. Create the **order table** (see below) with its required fields.\n3. Read `overview.project` (enabled / active types / the order table the payment module is bound to) and GET_PAYMENT_CONFIGS, then follow the matching branch:\n - **Legacy** (`legacyPaymentModel: true`): call ACTIVATE_PAYMENT with the order table's display name. It appends the type's generated flows/callbacks/jobs and grants the logged-in user role permission; a first activation inserts the payment tables. The order table is fixed by the first activation and ignored afterwards. It names what it created; say so in your answer.\n - **Payment configs**: call ADD_PAYMENT_CONFIGS with one or more items. On the first add also pass the order table's display name \u2014 it inserts the payment tables; later adds omit it. Each item's provider must be one the product offers (see above). Every item mints a payment config and its empty PAYMENT_CALLBACK and grants every role the provider's default billing methods; several configs may share a provider.\n4. Configure credentials.\n - Legacy: the gateway credentials are the user's own, in the editor (Action \u2192 Payment) \u2014 WeChat Pay (merchant ID, APIv2 key, linked Mini Program AppID, apiclient_cert.p12 for refunds), Alipay (app ID and RSA2 key pair) and/or Airwallex (client ID, API key, webhook secret).\n - Payment configs: every credential field and the product choice come from the user; never invent a value or leave a required field empty. Collect them before UPDATE_PAYMENT_CONFIGS:\n - Secret fields (Alipay's app private key, WeChat Pay's API key): reuse a secret from GET_ALL_SECRET_CONFIGS or have the user type the value with secret save-value.\n - Text fields are not secret, and there is no card for them: ask for each one in a chat turn and wait for the reply. For Alipay that is the **app ID** and the **Alipay public key**, for WeChat Pay the **AppID** and **merchant ID**. Saving the private key does not supply them.\n - Products: unless the request already names them, ask which checkout products the config supports with `ask_user_question` (multiSelect) \u2014 for Alipay, PC website payment (`ALIPAY_PC_WEB`, web clients) and app payment (`ALIPAY_APP`, mobile clients).\n Then bind them with UPDATE_PAYMENT_CONFIGS \u2014 text fields inline, secret fields by secret id; the same call sets supportedProducts and supportedClients. Brand assets stay editor-only.\n5. Wire the fulfillment flows.\n - Legacy: the auto-generated payment/refund callback flows are already wired.\n - Payment configs: the callback starts empty. Create or edit the fulfillment Actionflow, then bind it per event kind with SET_PAYMENT_CALLBACK_ACTION and fill the returned `inputArgsSchemaPath` with the binding tools.\n\n### The Order Table (you design this \u2014 follow database conventions)\nThe order table is a normal business table you create; the payment engine references one of its rows by its primary-key id (the `orderId` everywhere below). At minimum it needs:\n- an **amount/price** column \u2014 type `s:p:decimal`, the authoritative price computed server-side.\n- a **status** column \u2014 create a custom enum whose options mirror the payment lifecycle\n (e.g. `pending`, `paid`, `cancelled`, `refunded`), then use the exact\n `u:e:<enumId>` returned by the type plugin as the column type; your fulfillment flow\n updates it.\n- a **buyer link** \u2014 do NOT add a raw `user_id`/`account_id` column. Create a 1:n RELATION from `account` to the order table so the buyer FK is generated automatically (the same manual-foreign-key rule the database plugin enforces). Add product/quantity links as relations too. Naming follows the usual rules: `snake_case` system names, no manual `id`/`created_at` columns (the runner mints the PK).\n\n**Irreversibility warning:** once the order table is linked to the payment module it CANNOT be unlinked, replaced, or deleted. Always confirm the table design with the user and warn them of this before they bind it. Choose the table deliberately.\n\n### Platform-Managed Tables (do NOT create or model these)\nEnabling payments auto-creates three system tables \u2014 never recreate them as user tables and never write to them directly:\n- the **payment** table (`fz_payment` / `fz_payment_record`, 1:N from the order table) \u2014 one row per payment attempt, carrying `orderId`, `accountId`, `type`, `status`, `currency`, `grandTotalValue`, `transactionId`.\n- the **recurring_payment** table \u2014 Alipay agreement subscriptions and their billing cycle.\n- the **refund** table (1:N from payment) \u2014 refund transactions. The internal payment `status` is a fixed lifecycle enum: `PENDING`, `CANCELLED`, `SUCCESSFUL`, `FAILED`, `PARTIALLY_REFUNDED`, `REFUNDING`, `REFUNDED`. Your order table's own status column is separate from this \u2014 your fulfillment flow translates one into the other.\n\n### Auto-Created Callback Actionflows (WeChat Pay / Alipay, legacy projects only)\nOn a legacy project, enabling payments auto-generates the backend callback Actionflows the editor wires to each payment action. They have no fixed English name (they are the \"preset\" flows for the channel you enabled); don't delete or rename them. You edit their bodies to run business logic:\n- the **payment** flow \u2014 triggered automatically after a charge resolves.\n- the **refund** flow \u2014 triggered automatically after a refund resolves.\n- the Alipay **recurring-deduction** flow \u2014 a daily scheduled loop that charges due agreements.\n\nPayment-config projects generate no flows: each config's callback starts empty and is bound with SET_PAYMENT_CALLBACK_ACTION per event kind.\n\n### Editing the payment flow (legacy projects only \u2014 the one you almost always modify)\nThe flow has a built-in \"parse payment result\" code block that outputs four values:\n- `orderId` \u2014 the order-table row you passed to the payment action; use it to find and update the order.\n- `paymentFound` \u2014 whether a matching payment record was found.\n- `paymentStatus` \u2014 `SUCCESSFUL` or `FAILED`.\n- `alreadyProcessed` \u2014 boolean; `false` on the first trigger, `true` on a re-delivery. **Idempotency contract (critical):** the same payment can trigger the flow more than once. Only run fulfillment / mark the order paid when `paymentFound` is true, `paymentStatus` is the expected value, AND `alreadyProcessed == false`. Guard the fulfillment branch with Condition nodes on these, otherwise duplicate callbacks double-fulfill (double-ship, double-credit). For safety, also add a branch that re-checks the actual paid amount against the order's amount before fulfilling. The refund flow works the same way: its parser returns `orderId`, `refundFound`, `paymentStatus` (`REFUNDED` or `FAILED`), and `alreadyProcessed`.\n\n### Creating an Order (the secure-transaction pattern)\nNever let the client decide the price. Order creation must run server-side:\n1. Frontend triggers a backend Actionflow passing only identifiers (e.g. `product_id`, quantity) \u2014 never the price.\n2. The flow queries the product/price server-side, computes the authoritative amount, inserts a new order row with status `pending`, and returns the generated `orderId` and verified amount.\n3. The frontend maps the *returned* `orderId` and amount into the WeChat Pay / Alipay / Airwallex payment action. This is the Zero-Trust pattern: the price the customer is charged is the one the server computed and stored on the order, not anything the browser sent.\n\n### Amounts & Currency\nThe WeChat Pay and Alipay payment actions take the amount in **yuan (\u5143) as a `s:p:decimal` with at most two decimal places, and it must be greater than 0.01** \u2014 pass the order's server-computed price directly; do NOT convert to cents/\u5206.\n\n### Airwallex (only where enabled for the project)\nAirwallex takes both one-time payments and subscriptions. On a legacy project it is activated like any other type and generates two backend Actionflows; don't delete or rename them. Payment-config projects add an Airwallex config with ADD_PAYMENT_CONFIGS; no flows are generated, so create the fulfillment flow yourself and bind it per event kind with SET_PAYMENT_CALLBACK_ACTION.\n1. **Airwallex Payment** \u2014 receives every Airwallex webhook as `fz_payment_callback_input` and branches on the event type: payment status changed (`payment_intent.succeeded` / `payment_intent.cancelled`), refund (`refund.accepted` / `refund.failed`), subscription status changes, and `invoice.finalized`. In the payment branch the built-in \"Sync payment status\" block outputs `orderId`, `paymentStatus` (`SUCCESSFUL` or `CANCELLED`) and `alreadyProcessed`; in the refund branch \"Sync refund status\" outputs `orderId`, `status` (`REFUNDED` or `FAILED`) and `alreadyProcessed`. Put fulfillment after those blocks under the same idempotency contract: act only on the expected status AND `alreadyProcessed == false`.\n2. **Airwallex Subscription Renewal** \u2014 called by Airwallex Payment with the invoice id to create the order and payment for a subscription renewal.\nAirwallex amounts are decimals in the currency's major unit (10.00, not 1000): pass the order's server-computed decimal price directly.\n\n### Recurring Payments (Alipay, legacy projects only)\nAlipay supports subscriptions via a signed agreement. The start action takes `orderId`, a price (Alipay caps recurring amounts at \xA5100), a product name, a deduction interval (\u2265 7 days), and an Alipay scene code (a user can subscribe to the same scene only once); the cancel action takes the recurring-payment row id. Deductions run in the auto-generated daily loop flow: for each due agreement you must create a NEW order inside the loop and bind its id to the deduction node's `orderId` input. Note: a full Alipay refund does not re-trigger the payment flow. On a payment-config project the Alipay callback offers only `PAYMENT_COMPLETED` and `REFUND_COMPLETED`, and no daily deduction loop is generated \u2014 recurring deductions are not managed by these tools there.\n\n### Scope Note\nGET_PAYMENT_CONFIGS decides the model. Legacy: ACTIVATE_PAYMENT turns the module on one type at a time and the generated flows are edited as Actionflows; credentials, brand assets and the plan upgrade are the user's own in the editor. Payment configs: ADD_PAYMENT_CONFIGS (the first add initializes), UPDATE_PAYMENT_CONFIGS sets credentials/products/clients, SET_PAYMENT_CALLBACK_ACTION binds the fulfillment flows, GET_PAYMENT_CONFIG_DETAIL reads one and DELETE_PAYMENT_CONFIGS removes one; deleting a bound fulfillment flow only unbinds that event kind \u2014 the callback stays until its config is deleted. Brand assets and the plan upgrade remain editor-only. Either way, design the order table first (via the database plugin), then wire the secure order-creation flow. On a legacy project add the `alreadyProcessed` idempotency guard in the generated fulfillment flow; on a payment-config project the callback carries the payment record (and `previousStatus` for subscription changes) \u2014 branch on its status and fulfill only on the transition you expect.",permissions:'## Permission System Domain Knowledge\nZion secures data and actions with RBAC (roles) plus ABAC (per-row conditions). Every tool in this plugin edits the project schema only \u2014 the change reaches the deployed backend when "Sync Backend" runs.\n\n### Model\n- **Role**: a named collection of users. Two are predefined and cannot be renamed or deleted: **Logged-in User** (held by every authenticated user) and **Anonymous User** (unauthenticated requests). Custom roles can then be created, renamed, and deleted, up to the project\'s role limit \u2014 but **`Admin` is a reserved name**: a role is treated as system-defined by *name*, so one created or renamed to `Admin` could never be renamed or deleted again. Both tools refuse it; pick another name.\n- **Data Permission**: what a role may read or write, at table, column and row level.\n- **Action Permission**: which workspace HTTP APIs, Actionflows, AI agents and payment operations a role may invoke.\n- Each action block is allow-all or an explicit allow-list. On top of those grants, per-target conditional checks are available for Actionflows and AI agents. Payments take allow-all, or the billing-method map matching the project\'s payment model: a per-payment-type map, or \u2014 when the project runs on payment configs \u2014 a per-config map (config ids from GET_PAYMENT_CONFIGS) via `UPDATE_ROLE_PAYMENT_PERMISSION`\'s `allowedPaymentConfigIdAndMethod` \u2014 every id in it must exist and every billing method must be one that config\'s provider supports. Allow-all takes no map; a map belonging to the other model is rejected; a map you omit keeps its current entries \u2014 the config map is where the payment config tools record their grants.\n- **Roles only ever add.** A user\'s effective permissions are the union of every role they hold; a restrictive role never subtracts what a permissive one granted. To take access away, narrow or unassign the permissive role \u2014 never "add a limited role".\n\n### Activation\nRole names come from `GET_PROJECT_OVERVIEW`\'s `roles` section, which also reports whether role permission is activated; `GET_ALL_ROLES_INFO` is the fallback when you have not run it. While role permission is not activated, no role or grant can be edited: `ACTIVATE_ROLE_PERMISSION` seeds the predefined roles first. In RESEARCH mode no mutation runs; the user can look into permissions in \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n\n### Grant\nData permissions are configured coarse \u2192 fine:\n1. **Table**: which operations (select / insert / update / delete / count / aggregate) the role may run.\n2. **Column**: which fields each operation covers.\n3. **Row**: a per-operation condition \u2014 a filter over existing rows for select, update and delete, a check on the incoming row for insert. Each one starts always-true, so a fresh grant is open until narrowed.\n\nRead before writing: `GET_ROLE_DETAIL`, naming every role the task will edit; the role names are already in `GET_PROJECT_OVERVIEW`. It reports each table by exception \u2014 the operations granted, the ones under `rowConditions` whose row condition has been narrowed, and `restrictedColumns` only where a grant covers less than the whole table, so an operation listed as granted and mentioned nowhere else is open on every column and every row. Tables the role cannot touch at all are named together in `tablesWithNoGrants`. Pass `blocks` when the task is about one block (the table block is nearly the whole payload). It does not carry the row conditions\' schema paths \u2014 when you are narrowing one, read `GET_TABLE_PERMISSION` instead: it names the tables you are about to change, reports each operation\'s condition path, and satisfies the same gate, so the path arrives in the call right before the one that uses it. Edit with `ADD_ROLES`, `UPDATE_ROLE`, `DELETE_ROLES` and the per-block setters `UPDATE_ROLE_TABLE_PERMISSION`, `UPDATE_ROLE_ACTION_FLOW_PERMISSION`, `UPDATE_ROLE_ZAI_PERMISSION`, `UPDATE_ROLE_PAYMENT_PERMISSION`, `UPDATE_ROLE_API_PERMISSION` for workspace HTTP APIs. Account insert/delete is unavailable, and `id` is pinned into every table SELECT grant.\n\n`allowAll` on `apiPermission`, `actionflowPermission` or `zAiPermission` also covers resources added later \u2014 prefer explicit allow-lists unless broad access is intentional.\n\n**Role, or a field on Account?** Use a role for static functional boundaries: who may run a flow, read a table, see a column. Add a field on the Account table for per-user state: VIP status, nickname, bio.\n\n**Never create one role per group.** For departments, stores, tenants or any other segmentation, use the relation-first pattern: create a `1:n` relation from the context table (e.g. `department`) to `Account`, and a second one from that same table to the business table (e.g. `sales_record`). Both foreign-key columns are generated and non-editable \u2014 never declare them as raw integer fields. Then define one generic role (`Sales_Staff`) and compare those two columns in its row conditions.\n\nSimple single-table CRUD may run directly from the frontend when table, column, and row permissions fully express the authorization policy \u2014 do not wrap it in an Actionflow. Reach for a Backend Actionflow only when the rule cannot be expressed that way at all: it needs server-held secrets, cross-table atomicity, or multi-step state transitions.\n\n### Row conditions (ABAC)\nNarrowing those conditions is a two-plugin job: this plugin has no tool that edits one \u2014 they live in the **bindings** area, whose tools are the `INSERT_CONDITION_BOOL_EXP` family, addressed by the condition path `GET_TABLE_PERMISSION` reports. The check `SET_ROLE_PERMISSION_CHECK` seeds for an Actionflow or AI agent works the same way.\n\nNever hand-build a permission schema path. It embeds the role\'s index in the schema and the table\'s internal id, neither of which any read reports on its own, so a path assembled from what a read did show resolves to nothing \u2014 copy the one a read returned.\n\nEach operation has its own condition node and its own row branch to compare against, so reusing the select recipe on another op fails:\n- `select` \u2192 path ends `/select/filter` \u2192 the branch holding the row being read\n- `insert` \u2192 path ends `/insert/check`, not `filter` \u2192 the branch holding the row being inserted\n- `update` \u2192 path ends `/update/filter` \u2192 the branch holding the row as stored, or the one holding the incoming values\n- `delete` \u2192 path ends `/delete/filter` \u2192 the branch holding the row being deleted\n- `count` / `aggregate` \u2192 no row branch exists, only the logged-in user and the current time, so they cannot be row-scoped. Whenever you narrow `select`, send `count` and `aggregate` `{enabled: false}` too, unless a whole-table count is meant to be public: a row-scoped `select` beside an open `count` still tells any user how many rows everyone else has.\n\nNarrowing one condition:\n1. `GET_TABLE_PERMISSION` for that table (or the result of `UPDATE_ROLE_TABLE_PERMISSION`, which reports the same paths for the grants it just made, or of `SET_ROLE_PERMISSION_CHECK` for a flow/agent check) \u2192 that operation\'s condition schema path. `GET_ROLE_DETAIL` does not carry them.\n2. `INSERT_CONDITION_BOOL_EXP` at that path \u2192 returns a `conditionSchemaPath`. Copy it verbatim; never hand-build one.\n3. `GET_EXPRESSION_CONDITION_OPERATORS` at that path, then `UPDATE_EXPRESSION_CONDITION_OPERATOR` with an operator copied verbatim. The `target` and `value` operand slots do not exist until the operator is set \u2014 binding first fails with "has no binding site at \u2026/target".\n4. Fill both operands at `<conditionSchemaPath>/target` and `<conditionSchemaPath>/value`, addressed by `pathInHierarchicalMenu`. Read that path \u2014 branch label included \u2014 from `BROWSE_DATA_BINDING_OPTIONS` at the operand\'s own schema path and copy it verbatim; never hand-build one. Relations traverse, so a child table can compare against its parent\'s owner \u2014 that path is four segments deep: context root, row branch, relation, column. Every segment is a label from the tree, including the root.\n5. Delete the always-true placeholder the grant started with: `DELETE_CONDITION_BOOL_EXP` at `<step 1\'s condition schema path>/_and/[0]` \u2014 the filter\'s own path, not the comparison path step 2 returned. Harmless at runtime, but the editor renders it as an empty condition row, so the user sees a half-configured rule.\n6. Shape multi-clause predicates with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`.\n\nExample \u2014 "a staff member only ever touches their own department\'s sales records" \u2014 after granting `Sales_Staff` select, insert, update and delete on `sales_record`, configure four conditions, each comparing that operation\'s own row branch `department_id` against the logged-in user\'s `department_id`. Configuring only select leaves the writes unrestricted.\n\nA batch of tool calls is all-or-nothing: one bad call discards every change in that batch. Send exploratory reads on their own \u2014 especially the first `BROWSE_DATA_BINDING_OPTIONS` for an operation whose context branch you have not seen \u2014 then batch the writes.\n\n### Assign the role\nA custom role does nothing until an account holds it. Two ways:\n- Manual: assign in the editor, under \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n- Automatic: the Permissions node inside an Actionflow (e.g. grant VIP after purchase). These grants and revocations take effect immediately \u2014 no backend sync required.\n\n### What a grant actually ends up as\n- A newly created table lands in every role automatically, with select, insert, update, delete, count and aggregate all granted and unconditioned \u2014 **Anonymous User** and **Logged-in User** included. Observed on a deployed project: an unauthenticated request could read every row, and after only SELECT was revoked it could still INSERT. Narrowing Anonymous User alone leaves every logged-in user holding the same open grant.\n- `GET_ROLE_DETAIL` lists each operation under its table\'s `rowConditions`; an operation not listed there is open.\n- A custom role grants nothing until an account holds it.\n- If you leave grants open that the user may not expect, name them.\n\n### Troubleshooting 403\n403s surface in runtime logs and client responses:\n```json\n{\n "errorCode": 403,\n "extensions": { "classification": "TABLE_ACCESS" },\n "message": "User 1 has no permission for SELECT on order"\n}\n```\n"User 1" is the user whose internal id ends in 1 (1000000000000001). Then:\n1. Confirm the user holds the role you expect.\n2. Read that role with `GET_TABLE_PERMISSION` on the table the 403 names: is the operation enabled, is the column inside its grant, and does its row condition match the row the user expected?\n3. Confirm "Sync Backend" ran after the last permission change.',runtime:'## Verifying your own work\nThese tools run against the project\'s REAL backend. There is no staging copy, so prefer the primitives that undo themselves and reach for the ones that do not only when the check genuinely requires them.\n\nDraft versus deployed, which is the distinction that decides whether a green result means anything:\n- `runtime.debug_flow` and `runtime.run_code` execute the DRAFT \u2014 what you just edited \u2014 and revert their database writes by default. This is the verification loop.\n- `runtime.invoke_flow` executes the DEPLOYED version with permissions enforced and reverts nothing. A green invoke on a project with pending changes proves nothing about your edits; the result says so when that is the case.\n\nWhat a check can and cannot tell you:\n- `runtime.debug_flow` reverts the flow\'s database writes, but an external call inside the flow \u2014 a third-party API, an email or SMS, an AI or payment node \u2014 really happens and really costs.\n- A read as one user proves little on its own: an empty result means either "the rule hid it" or "there was nothing there", and those need different fixes. A second observation separates them: `runtime.login` with credentials the user gives you (a real account with its real roles, and the only way to test a rule that keys on a named role without permission to edit the project\'s backend \u2014 they are the user\'s to give, not yours to guess), or `as: "admin"` beside `as: "<role>"` where this session has it, since `admin` bypasses row and column permissions.\n- The identity tiers are not one axis, and a rule usually keys on which tier you are in rather than on who you are: `as: "anonymous"` sends no credential at all \u2014 a logged-out visitor, the only identity carrying the Anonymous User role, and where public data leaks; an account from `runtime.login` is signed in, carrying Logged-in User plus the project\'s own custom roles, which is a different rung and usually a different answer.\n- If a check could not be run, say which one and why. Never report work as verified because it looked right.\n\nWhen a run fails, its nodes carry a `traceId`: pass it to `logs.search` as `traceId: "\u2026"` to get the server-side detail.\n\n### Two filter grammars \u2014 do not mix them\nThe operator-first grammar documented above (`{"_eq": {"bigint_operand": {\u2026}}}`) is the RAW shape, for documents you hand-write and send with `runtime.graphql`. The typed tools \u2014 `runtime.query`, `runtime.aggregate`, `runtime.update`, `runtime.delete` \u2014 take the SIMPLIFIED shape instead: `{"column": {"_op": value}}`, e.g. `{"status": {"_eq": "PAID"}}`. Feeding the raw grammar to a typed tool, or the simplified one to a hand-written document, fails validation at the runtime rather than in the tool.\n\n### Names here are API names, never display names\nThe runtime GraphQL schema is generated from **API names** \u2014 `tableName`, every column in a field list, every key in a filter or a `set`. Every editor read gives you both: `database.get_tables_info` returns each column\'s `apiName` AND its `displayName`, and only the `apiName` is valid here. They diverge the moment anyone renames a column in the editor, which is routine and leaves no trace in the runtime, so a name you read in a UI, a page binding or a conversation is the wrong one until you have checked it against `apiName`. A display name sent here comes back as `Field \'<name>\' in type \'<table>\' is undefined`.\n\n### An enum column takes the option NAME\nIn the schema an enum option has an id and a name, and a binding stores the id. The runtime stores and matches the **name**: filter with `{"status": {"_eq": "PAID"}}`, never the `o1`-style option id you would write into a schema binding. Sending the id is rejected with `Invalid option: <id>, available option: \u2026`, which lists the names \u2014 use one of those verbatim.\n\n### Binary assets are ids, on the way in and on the way out\nImages, videos and files live in object storage; a table column holds only the asset id, never a URL or a path. That changes every side of a runtime call:\n- **Reading**: the column is an object in GraphQL, not a scalar, so selecting `cover_image` bare fails with "Subselection required for type \'FZ_Image\'". Ask for `cover_image_id`, or select a subfield \u2014 `cover_image { id url }`. The typed tools do this for you when they default a field list; hand-written `runtime.graphql` selections have to get it right. The list-valued media types are deprecated; if a project still has one, it reads as a `[col]_ids` array.\n- **Writing**: `runtime.insert` and `runtime.update` take the id column too \u2014 `{"cover_image_id": 1030\u2026}`, never `{"cover_image": "https://\u2026"}`. A URL in a media column is rejected, and a plausible-looking id you invented points at someone else\'s asset or at nothing.\n- **Getting an id**: an asset does not exist until its bytes have been uploaded, which is a two-step flow \u2014 request a presigned URL (`imagePresignedUrlV2` / `videoPresignedUrlV2` / `filePresignedUrlV2`, keyed by the file\'s Base64 MD5), then HTTP PUT the bytes to it. You can do the first step through `runtime.graphql` but **not the second**: no runtime tool sends raw bytes. Three ways to get a storable id, in order of preference: `web.import_asset` with `mode: RUNTIME`, which does both steps server-side from a public URL and hands back the numeric id; `runtime.query` on `fz_images` / `fz_videos` / `fz_files`, which lists the ids the app already holds; or asking the user. Never fabricate one \u2014 a plausible number points at another project\'s asset or at nothing, and the row looks written until someone opens it.\n- **Which id, though**: a data row stores the id the RUNNING APP holds, which is what those tables list and what `mode: RUNTIME` returns. Editor-side asset ids are a different space \u2014 an id taken from the editor and written into a row, or an app id bound to a component, resolves to nothing and reports no error either way.\n- **Importing at run time is a different problem**: `web.import_asset` runs now, while you are building. An app that has to turn a URL into an asset while it runs needs the **Files** action flow node, which does the same import inside a flow. Build that node into the flow rather than importing the file yourself and writing the id in.\n- `url` is a rendering detail: read it when you want to show or check an asset, and store the id everywhere else.\n\n### What runtime.graphql can reach\n`runtime.graphql` runs against the app\'s own API \u2014 the generated table operations, the per-flow `fz_af_*`, per-agent `fz_zai_*` and per-API `fz_api_*` fields, the ZAI conversation operations, asset upload. The debug operations behind `runtime.debug_flow`, `runtime.run_code` and `zai.debug_chat` live on a separate admin surface those tools reach for you; asking for them through `runtime.graphql` reports the field as undefined. Subscriptions are unavailable from every tool here \u2014 poll the documented query counterpart instead.\n\n### Triggers\nThere is no fire-a-trigger tool, for anyone \u2014 the editor cannot do it either. A database trigger fires when a matching row is really written **and the transaction commits**, so a rollback debug run cannot fire one: the notification the runtime listens for is rolled back with everything else. To exercise a database trigger, write a row with `runtime.insert` or `runtime.update` that matches the trigger\'s table, operation and condition, then read what it did with `runtime.query` and `logs.search`. Your write is recorded so you can report it; the rows the trigger\'s own flow wrote in response are not, so name the trigger as well when you hand the run over. `runtime.status` lists the project\'s triggers with the table and operation each one watches, and a write to a triggered table says so in its confirmation.\n\nA schedule cannot be fired on demand at all: only the flow it points at can be debug-run, and the cron expression and end date can only be read as configuration, so the schedule itself stays unverified.\n\n### What you leave behind\nNothing you write here can be taken back. There is no undo tool and no cleanup tool: a row from `runtime.insert`, an account from `runtime.as_user`, an overwritten column, a deleted row, and whatever a trigger did in response are all simply in the user\'s app now. A rollback debug run leaves nothing; every row written any other way is one the user will find.\n\nWhat you do owe the user is an account of it. Rows you inserted and accounts you created are recorded with their ids, and you are reminded of them as you work \u2014 finish a verification run by saying what you created and in which table, so they can delete it from the data table if they want to. "I added some test data" is not a handover; "I added order#41 and order#42, and account 9931 with role Customer" is.\n\nThe wire protocol for each of these calls \u2014 the query language, filter grammar, aggregations, action-flow and AI invocation, third-party calls and asset upload \u2014 is documented in the `baas-*` capabilities.',secret:`## Secret Domain Knowledge
365
+ Both are read-only; neither mutates the schema.`,payments:"## Payment System Domain Knowledge\nZion's payment system is built around a developer-owned **order table** plus a set of platform-managed payment records and the Actionflows that react to gateway callbacks. On Zion the legacy gateways are WeChat Pay (mini-program and H5/JSAPI) and Alipay (PC web; one-time plus recurring \"agreement\" subscriptions); payment-config projects also offer Stripe. Airwallex is available on both models where it is enabled for the project. There are two payment models, and GET_PAYMENT_CONFIGS's `legacyPaymentModel` says which one the project uses:\n- **Legacy**: activate the module with ACTIVATE_PAYMENT, which generates the gateway Actionflows and webhooks. The gateway credentials, the brand assets and the Pro-plan upgrade are the user's own, in the editor (\u884C\u4E3A \u2192 \u652F\u4ED8).\n- **Payment configs**: add a config with ADD_PAYMENT_CONFIGS; the first add initializes the payment tables. Credentials (project secrets), products, clients and callback flows are edited through the payment tools; only brand assets and the plan upgrade stay in the editor.\n\n### Prerequisites (in order)\n1. The user upgrades the project to the Pro plan or higher (payments are gated by plan; an expired plan breaks live payments and blocks publishing).\n2. Create the **order table** (see below) with its required fields.\n3. Read `overview.project` (enabled / active types / the order table the payment module is bound to) and GET_PAYMENT_CONFIGS, then follow the matching branch:\n - **Legacy** (`legacyPaymentModel: true`): call ACTIVATE_PAYMENT with the order table's display name. It appends the type's generated flows/callbacks/jobs and grants the logged-in user role permission; a first activation inserts the payment tables. The order table is fixed by the first activation and ignored afterwards. It names what it created; say so in your answer.\n - **Payment configs**: call ADD_PAYMENT_CONFIGS with one or more items. On the first add also pass the order table's display name \u2014 it inserts the payment tables; later adds omit it. Each item's provider must be one the product offers (see above). Every item mints a payment config and its empty PAYMENT_CALLBACK and grants every role the provider's default billing methods; several configs may share a provider.\n4. Configure credentials.\n - Legacy: the gateway credentials are the user's own, in the editor (\u884C\u4E3A \u2192 \u652F\u4ED8) \u2014 WeChat Pay (merchant ID, APIv2 key, linked Mini Program AppID, apiclient_cert.p12 for refunds), Alipay (app ID and RSA2 key pair) and/or Airwallex (client ID, API key, webhook secret).\n - Payment configs: every credential field and the product choice come from the user; never invent a value or leave a required field empty. Collect them before UPDATE_PAYMENT_CONFIGS:\n - Secret fields (Alipay's app private key, WeChat Pay's API key): reuse a secret from GET_ALL_SECRET_CONFIGS or have the user type the value with secret save-value.\n - Text fields are not secret, and there is no card for them: ask for each one in a chat turn and wait for the reply. For Alipay that is the **app ID** and the **Alipay public key**, for WeChat Pay the **AppID** and **merchant ID**. Saving the private key does not supply them.\n - Products: unless the request already names them, ask which checkout products the config supports with `ask_user_question` (multiSelect) \u2014 for Alipay, PC website payment (`ALIPAY_PC_WEB`, web clients) and app payment (`ALIPAY_APP`, mobile clients).\n Then bind them with UPDATE_PAYMENT_CONFIGS \u2014 text fields inline, secret fields by secret id; the same call sets supportedProducts and supportedClients. Brand assets stay editor-only.\n5. Wire the fulfillment flows.\n - Legacy: the auto-generated payment/refund callback flows are already wired.\n - Payment configs: the callback starts empty. Create or edit the fulfillment Actionflow, then bind it per event kind with SET_PAYMENT_CALLBACK_ACTION and fill the returned `inputArgsSchemaPath` with the binding tools.\n\n### The Order Table (you design this \u2014 follow database conventions)\nThe order table is a normal business table you create; the payment engine references one of its rows by its primary-key id (the `orderId` everywhere below). At minimum it needs:\n- an **amount/price** column \u2014 type `s:p:decimal`, the authoritative price computed server-side.\n- a **status** column \u2014 create a custom enum whose options mirror the payment lifecycle\n (e.g. `pending`, `paid`, `cancelled`, `refunded`), then use the exact\n `u:e:<enumId>` returned by the type plugin as the column type; your fulfillment flow\n updates it.\n- a **buyer link** \u2014 do NOT add a raw `user_id`/`account_id` column. Create a 1:n RELATION from `account` to the order table so the buyer FK is generated automatically (the same manual-foreign-key rule the database plugin enforces). Add product/quantity links as relations too. Naming follows the usual rules: `snake_case` system names, no manual `id`/`created_at` columns (the runner mints the PK).\n\n**Irreversibility warning:** once the order table is linked to the payment module it CANNOT be unlinked, replaced, or deleted. Always confirm the table design with the user and warn them of this before they bind it. Choose the table deliberately.\n\n### Platform-Managed Tables (do NOT create or model these)\nEnabling payments auto-creates three system tables \u2014 never recreate them as user tables and never write to them directly:\n- the **payment** table (`fz_payment` / `fz_payment_record`, 1:N from the order table) \u2014 one row per payment attempt, carrying `orderId`, `accountId`, `type`, `status`, `currency`, `grandTotalValue`, `transactionId`.\n- the **recurring_payment** table \u2014 Alipay agreement subscriptions and their billing cycle.\n- the **refund** table (1:N from payment) \u2014 refund transactions. The internal payment `status` is a fixed lifecycle enum: `PENDING`, `CANCELLED`, `SUCCESSFUL`, `FAILED`, `PARTIALLY_REFUNDED`, `REFUNDING`, `REFUNDED`. Your order table's own status column is separate from this \u2014 your fulfillment flow translates one into the other.\n\n### Auto-Created Callback Actionflows (WeChat Pay / Alipay, legacy projects only)\nOn a legacy project, enabling payments auto-generates the backend callback Actionflows the editor wires to each payment action. They have no fixed English name (they are the \"preset\" flows for the channel you enabled); don't delete or rename them. You edit their bodies to run business logic:\n- the **payment** flow \u2014 triggered automatically after a charge resolves.\n- the **refund** flow \u2014 triggered automatically after a refund resolves.\n- the Alipay **recurring-deduction** flow \u2014 a daily scheduled loop that charges due agreements.\n\nPayment-config projects generate no flows: each config's callback starts empty and is bound with SET_PAYMENT_CALLBACK_ACTION per event kind.\n\n### Editing the payment flow (legacy projects only \u2014 the one you almost always modify)\nThe flow has a built-in \"parse payment result\" code block that outputs four values:\n- `orderId` \u2014 the order-table row you passed to the payment action; use it to find and update the order.\n- `paymentFound` \u2014 whether a matching payment record was found.\n- `paymentStatus` \u2014 `SUCCESSFUL` or `FAILED`.\n- `alreadyProcessed` \u2014 boolean; `false` on the first trigger, `true` on a re-delivery. **Idempotency contract (critical):** the same payment can trigger the flow more than once. Only run fulfillment / mark the order paid when `paymentFound` is true, `paymentStatus` is the expected value, AND `alreadyProcessed == false`. Guard the fulfillment branch with Condition nodes on these, otherwise duplicate callbacks double-fulfill (double-ship, double-credit). For safety, also add a branch that re-checks the actual paid amount against the order's amount before fulfilling. The refund flow works the same way: its parser returns `orderId`, `refundFound`, `paymentStatus` (`REFUNDED` or `FAILED`), and `alreadyProcessed`.\n\n### Creating an Order (the secure-transaction pattern)\nNever let the client decide the price. Order creation must run server-side:\n1. Frontend triggers a backend Actionflow passing only identifiers (e.g. `product_id`, quantity) \u2014 never the price.\n2. The flow queries the product/price server-side, computes the authoritative amount, inserts a new order row with status `pending`, and returns the generated `orderId` and verified amount.\n3. The frontend maps the *returned* `orderId` and amount into the WeChat Pay / Alipay / Airwallex payment action. This is the Zero-Trust pattern: the price the customer is charged is the one the server computed and stored on the order, not anything the browser sent.\n\n### Amounts & Currency\nThe WeChat Pay and Alipay payment actions take the amount in **yuan (\u5143) as a `s:p:decimal` with at most two decimal places, and it must be greater than 0.01** \u2014 pass the order's server-computed price directly; do NOT convert to cents/\u5206.\n\n### Airwallex (only where enabled for the project)\nAirwallex takes both one-time payments and subscriptions. On a legacy project it is activated like any other type and generates two backend Actionflows; don't delete or rename them. Payment-config projects add an Airwallex config with ADD_PAYMENT_CONFIGS; no flows are generated, so create the fulfillment flow yourself and bind it per event kind with SET_PAYMENT_CALLBACK_ACTION.\n1. **Airwallex Payment** \u2014 receives every Airwallex webhook as `fz_payment_callback_input` and branches on the event type: payment status changed (`payment_intent.succeeded` / `payment_intent.cancelled`), refund (`refund.accepted` / `refund.failed`), subscription status changes, and `invoice.finalized`. In the payment branch the built-in \"Sync payment status\" block outputs `orderId`, `paymentStatus` (`SUCCESSFUL` or `CANCELLED`) and `alreadyProcessed`; in the refund branch \"Sync refund status\" outputs `orderId`, `status` (`REFUNDED` or `FAILED`) and `alreadyProcessed`. Put fulfillment after those blocks under the same idempotency contract: act only on the expected status AND `alreadyProcessed == false`.\n2. **Airwallex Subscription Renewal** \u2014 called by Airwallex Payment with the invoice id to create the order and payment for a subscription renewal.\nAirwallex amounts are decimals in the currency's major unit (10.00, not 1000): pass the order's server-computed decimal price directly.\n\n### Recurring Payments (Alipay, legacy projects only)\nAlipay supports subscriptions via a signed agreement. The start action takes `orderId`, a price (Alipay caps recurring amounts at \xA5100), a product name, a deduction interval (\u2265 7 days), and an Alipay scene code (a user can subscribe to the same scene only once); the cancel action takes the recurring-payment row id. Deductions run in the auto-generated daily loop flow: for each due agreement you must create a NEW order inside the loop and bind its id to the deduction node's `orderId` input. Note: a full Alipay refund does not re-trigger the payment flow. On a payment-config project the Alipay callback offers only `PAYMENT_COMPLETED` and `REFUND_COMPLETED`, and no daily deduction loop is generated \u2014 recurring deductions are not managed by these tools there.\n\n### Scope Note\nGET_PAYMENT_CONFIGS decides the model. Legacy: ACTIVATE_PAYMENT turns the module on one type at a time and the generated flows are edited as Actionflows; credentials, brand assets and the plan upgrade are the user's own in the editor. Payment configs: ADD_PAYMENT_CONFIGS (the first add initializes), UPDATE_PAYMENT_CONFIGS sets credentials/products/clients, SET_PAYMENT_CALLBACK_ACTION binds the fulfillment flows, GET_PAYMENT_CONFIG_DETAIL reads one and DELETE_PAYMENT_CONFIGS removes one; deleting a bound fulfillment flow only unbinds that event kind \u2014 the callback stays until its config is deleted. Brand assets and the plan upgrade remain editor-only. Either way, design the order table first (via the database plugin), then wire the secure order-creation flow. On a legacy project add the `alreadyProcessed` idempotency guard in the generated fulfillment flow; on a payment-config project the callback carries the payment record (and `previousStatus` for subscription changes) \u2014 branch on its status and fulfill only on the transition you expect.",permissions:'## Permission System Domain Knowledge\nZion secures data and actions with RBAC (roles) plus ABAC (per-row conditions). Every tool in this plugin edits the project schema only \u2014 the change reaches the deployed backend when "Sync Backend" runs.\n\n### Model\n- **Role**: a named collection of users. Two are predefined and cannot be renamed or deleted: **Logged-in User** (held by every authenticated user) and **Anonymous User** (unauthenticated requests). Custom roles can then be created, renamed, and deleted, up to the project\'s role limit \u2014 but **`Admin` is a reserved name**: a role is treated as system-defined by *name*, so one created or renamed to `Admin` could never be renamed or deleted again. Both tools refuse it; pick another name.\n- **Data Permission**: what a role may read or write, at table, column and row level.\n- **Action Permission**: which workspace HTTP APIs, Actionflows, AI agents and payment operations a role may invoke.\n- Each action block is allow-all or an explicit allow-list. On top of those grants, per-target conditional checks are available for Actionflows and AI agents. Payments take allow-all, or the billing-method map matching the project\'s payment model: a per-payment-type map, or \u2014 when the project runs on payment configs \u2014 a per-config map (config ids from GET_PAYMENT_CONFIGS) via `UPDATE_ROLE_PAYMENT_PERMISSION`\'s `allowedPaymentConfigIdAndMethod` \u2014 every id in it must exist and every billing method must be one that config\'s provider supports. Allow-all takes no map; a map belonging to the other model is rejected; a map you omit keeps its current entries \u2014 the config map is where the payment config tools record their grants.\n- **Roles only ever add.** A user\'s effective permissions are the union of every role they hold; a restrictive role never subtracts what a permissive one granted. To take access away, narrow or unassign the permissive role \u2014 never "add a limited role".\n\n### Activation\nRole names come from `GET_PROJECT_OVERVIEW`\'s `roles` section, which also reports whether role permission is activated; `GET_ALL_ROLES_INFO` is the fallback when you have not run it. While role permission is not activated, no role or grant can be edited: `ACTIVATE_ROLE_PERMISSION` seeds the predefined roles first. In RESEARCH mode no mutation runs; the user can look into permissions in \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n\n### Grant\nData permissions are configured coarse \u2192 fine:\n1. **Table**: which operations (select / insert / update / delete / count / aggregate) the role may run.\n2. **Column**: which fields each operation covers.\n3. **Row**: a per-operation condition \u2014 a filter over existing rows for select, update and delete, a check on the incoming row for insert. Each one starts always-true, so a fresh grant is open until narrowed.\n\nRead before writing: `GET_ROLE_DETAIL`, naming every role the task will edit; the role names are already in `GET_PROJECT_OVERVIEW`. It reports each table by exception \u2014 the operations granted, the ones under `rowConditions` whose row condition has been narrowed, and `restrictedColumns` only where a grant covers less than the whole table, so an operation listed as granted and mentioned nowhere else is open on every column and every row. Tables the role cannot touch at all are named together in `tablesWithNoGrants`. Pass `blocks` when the task is about one block (the table block is nearly the whole payload). It does not carry the row conditions\' schema paths \u2014 when you are narrowing one, read `GET_TABLE_PERMISSION` instead: it names the tables you are about to change, reports each operation\'s condition path, and satisfies the same gate, so the path arrives in the call right before the one that uses it. Edit with `ADD_ROLES`, `UPDATE_ROLE`, `DELETE_ROLES` and the per-block setters `UPDATE_ROLE_TABLE_PERMISSION`, `UPDATE_ROLE_ACTION_FLOW_PERMISSION`, `UPDATE_ROLE_ZAI_PERMISSION`, `UPDATE_ROLE_PAYMENT_PERMISSION`, `UPDATE_ROLE_API_PERMISSION` for workspace HTTP APIs. Account insert/delete is unavailable, and `id` is pinned into every table SELECT grant.\n\n`allowAll` on `apiPermission`, `actionflowPermission` or `zAiPermission` also covers resources added later \u2014 prefer explicit allow-lists unless broad access is intentional.\n\n**Role, or a field on Account?** Use a role for static functional boundaries: who may run a flow, read a table, see a column. Add a field on the Account table for per-user state: VIP status, nickname, bio.\n\n**Never create one role per group.** For departments, stores, tenants or any other segmentation, use the relation-first pattern: create a `1:n` relation from the context table (e.g. `department`) to `Account`, and a second one from that same table to the business table (e.g. `sales_record`). Both foreign-key columns are generated and non-editable \u2014 never declare them as raw integer fields. Then define one generic role (`Sales_Staff`) and compare those two columns in its row conditions.\n\nSimple single-table CRUD may run directly from the frontend when table, column, and row permissions fully express the authorization policy \u2014 do not wrap it in an Actionflow. Reach for a Backend Actionflow only when the rule cannot be expressed that way at all: it needs server-held secrets, cross-table atomicity, or multi-step state transitions.\n\n### Row conditions (ABAC)\nNarrowing those conditions is a two-plugin job: this plugin has no tool that edits one \u2014 they live in the **bindings** area, whose tools are the `INSERT_CONDITION_BOOL_EXP` family, addressed by the condition path `GET_TABLE_PERMISSION` reports. The check `SET_ROLE_PERMISSION_CHECK` seeds for an Actionflow or AI agent works the same way.\n\nNever hand-build a permission schema path. It embeds the role\'s index in the schema and the table\'s internal id, neither of which any read reports on its own, so a path assembled from what a read did show resolves to nothing \u2014 copy the one a read returned.\n\nEach operation has its own condition node and its own row branch to compare against, so reusing the select recipe on another op fails:\n- `select` \u2192 path ends `/select/filter` \u2192 the branch holding the row being read\n- `insert` \u2192 path ends `/insert/check`, not `filter` \u2192 the branch holding the row being inserted\n- `update` \u2192 path ends `/update/filter` \u2192 the branch holding the row as stored, or the one holding the incoming values\n- `delete` \u2192 path ends `/delete/filter` \u2192 the branch holding the row being deleted\n- `count` / `aggregate` \u2192 no row branch exists, only the logged-in user and the current time, so they cannot be row-scoped. Whenever you narrow `select`, send `count` and `aggregate` `{enabled: false}` too, unless a whole-table count is meant to be public: a row-scoped `select` beside an open `count` still tells any user how many rows everyone else has.\n\nNarrowing one condition:\n1. `GET_TABLE_PERMISSION` for that table (or the result of `UPDATE_ROLE_TABLE_PERMISSION`, which reports the same paths for the grants it just made, or of `SET_ROLE_PERMISSION_CHECK` for a flow/agent check) \u2192 that operation\'s condition schema path. `GET_ROLE_DETAIL` does not carry them.\n2. `INSERT_CONDITION_BOOL_EXP` at that path \u2192 returns a `conditionSchemaPath`. Copy it verbatim; never hand-build one.\n3. `GET_EXPRESSION_CONDITION_OPERATORS` at that path, then `UPDATE_EXPRESSION_CONDITION_OPERATOR` with an operator copied verbatim. The `target` and `value` operand slots do not exist until the operator is set \u2014 binding first fails with "has no binding site at \u2026/target".\n4. Fill both operands at `<conditionSchemaPath>/target` and `<conditionSchemaPath>/value`, addressed by `pathInHierarchicalMenu`. Read that path \u2014 branch label included \u2014 from `BROWSE_DATA_BINDING_OPTIONS` at the operand\'s own schema path and copy it verbatim; never hand-build one. Relations traverse, so a child table can compare against its parent\'s owner \u2014 that path is four segments deep: context root, row branch, relation, column. Every segment is a label from the tree, including the root.\n5. Delete the always-true placeholder the grant started with: `DELETE_CONDITION_BOOL_EXP` at `<step 1\'s condition schema path>/_and/[0]` \u2014 the filter\'s own path, not the comparison path step 2 returned. Harmless at runtime, but the editor renders it as an empty condition row, so the user sees a half-configured rule.\n6. Shape multi-clause predicates with `NEST_CONDITION_BOOL_EXP`, `TOGGLE_CONDITION_BOOL_EXP_AND_OR`, `TOGGLE_CONDITION_BOOL_EXP_NOT`.\n\nExample \u2014 "a staff member only ever touches their own department\'s sales records" \u2014 after granting `Sales_Staff` select, insert, update and delete on `sales_record`, configure four conditions, each comparing that operation\'s own row branch `department_id` against the logged-in user\'s `department_id`. Configuring only select leaves the writes unrestricted.\n\nA batch of tool calls is all-or-nothing: one bad call discards every change in that batch. Send exploratory reads on their own \u2014 especially the first `BROWSE_DATA_BINDING_OPTIONS` for an operation whose context branch you have not seen \u2014 then batch the writes.\n\n### Assign the role\nA custom role does nothing until an account holds it. Two ways:\n- Manual: assign in the editor, under \u8BBE\u7F6E \u2192 \u6743\u9650\u7BA1\u7406.\n- Automatic: the Permissions node inside an Actionflow (e.g. grant VIP after purchase). These grants and revocations take effect immediately \u2014 no backend sync required.\n\n### What a grant actually ends up as\n- A newly created table lands in every role automatically, with select, insert, update, delete, count and aggregate all granted and unconditioned \u2014 **Anonymous User** and **Logged-in User** included. Observed on a deployed project: an unauthenticated request could read every row, and after only SELECT was revoked it could still INSERT. Narrowing Anonymous User alone leaves every logged-in user holding the same open grant.\n- `GET_ROLE_DETAIL` lists each operation under its table\'s `rowConditions`; an operation not listed there is open.\n- A custom role grants nothing until an account holds it.\n- If you leave grants open that the user may not expect, name them.\n\n### Troubleshooting 403\n403s surface in runtime logs and client responses:\n```json\n{\n "errorCode": 403,\n "extensions": { "classification": "TABLE_ACCESS" },\n "message": "User 1 has no permission for SELECT on order"\n}\n```\n"User 1" is the user whose internal id ends in 1 (1000000000000001). Then:\n1. Confirm the user holds the role you expect.\n2. Read that role with `GET_TABLE_PERMISSION` on the table the 403 names: is the operation enabled, is the column inside its grant, and does its row condition match the row the user expected?\n3. Confirm "Sync Backend" ran after the last permission change.',runtime:'## Verifying your own work\nThese tools run against the project\'s REAL backend. There is no staging copy, so prefer the primitives that undo themselves and reach for the ones that do not only when the check genuinely requires them.\n\nDraft versus deployed, which is the distinction that decides whether a green result means anything:\n- `runtime.debug_flow` and `runtime.run_code` execute the DRAFT \u2014 what you just edited \u2014 and revert their database writes by default. This is the verification loop.\n- `runtime.invoke_flow` executes the DEPLOYED version with permissions enforced and reverts nothing. A green invoke on a project with pending changes proves nothing about your edits; the result says so when that is the case.\n\nWhat a check can and cannot tell you:\n- `runtime.debug_flow` reverts the flow\'s database writes, but an external call inside the flow \u2014 a third-party API, an email or SMS, an AI or payment node \u2014 really happens and really costs.\n- A read as one user proves little on its own: an empty result means either "the rule hid it" or "there was nothing there", and those need different fixes. A second observation separates them: `runtime.login` with credentials the user gives you (a real account with its real roles, and the only way to test a rule that keys on a named role without permission to edit the project\'s backend \u2014 they are the user\'s to give, not yours to guess), or `as: "admin"` beside `as: "<role>"` where this session has it, since `admin` bypasses row and column permissions.\n- The identity tiers are not one axis, and a rule usually keys on which tier you are in rather than on who you are: `as: "anonymous"` sends no credential at all \u2014 a logged-out visitor, the only identity carrying the Anonymous User role, and where public data leaks; an account from `runtime.login` is signed in, carrying Logged-in User plus the project\'s own custom roles, which is a different rung and usually a different answer.\n- If a check could not be run, say which one and why. Never report work as verified because it looked right.\n\nWhen a run fails, its nodes carry a `traceId`: pass it to `logs.search` as `traceId: "\u2026"` to get the server-side detail.\n\n### Two filter grammars \u2014 do not mix them\nThe operator-first grammar documented above (`{"_eq": {"bigint_operand": {\u2026}}}`) is the RAW shape, for documents you hand-write and send with `runtime.graphql`. The typed tools \u2014 `runtime.query`, `runtime.aggregate`, `runtime.update`, `runtime.delete` \u2014 take the SIMPLIFIED shape instead: `{"column": {"_op": value}}`, e.g. `{"status": {"_eq": "PAID"}}`. Feeding the raw grammar to a typed tool, or the simplified one to a hand-written document, fails validation at the runtime rather than in the tool.\n\n### Names here are API names, never display names\nThe runtime GraphQL schema is generated from **API names** \u2014 `tableName`, every column in a field list, every key in a filter or a `set`. Every editor read gives you both: `database.get_tables_info` returns each column\'s `apiName` AND its `displayName`, and only the `apiName` is valid here. They diverge the moment anyone renames a column in the editor, which is routine and leaves no trace in the runtime, so a name you read in a UI, a page binding or a conversation is the wrong one until you have checked it against `apiName`. A display name sent here comes back as `Field \'<name>\' in type \'<table>\' is undefined`.\n\n### An enum column takes the option NAME\nIn the schema an enum option has an id and a name, and a binding stores the id. The runtime stores and matches the **name**: filter with `{"status": {"_eq": "PAID"}}`, never the `o1`-style option id you would write into a schema binding. Sending the id is rejected with `Invalid option: <id>, available option: \u2026`, which lists the names \u2014 use one of those verbatim.\n\n### Binary assets are ids, on the way in and on the way out\nImages, videos and files live in object storage; a table column holds only the asset id, never a URL or a path. That changes every side of a runtime call:\n- **Reading**: the column is an object in GraphQL, not a scalar, so selecting `cover_image` bare fails with "Subselection required for type \'FZ_Image\'". Ask for `cover_image_id`, or select a subfield \u2014 `cover_image { id url }`. The typed tools do this for you when they default a field list; hand-written `runtime.graphql` selections have to get it right. The list-valued media types are deprecated; if a project still has one, it reads as a `[col]_ids` array.\n- **Writing**: `runtime.insert` and `runtime.update` take the id column too \u2014 `{"cover_image_id": 1030\u2026}`, never `{"cover_image": "https://\u2026"}`. A URL in a media column is rejected, and a plausible-looking id you invented points at someone else\'s asset or at nothing.\n- **Getting an id**: an asset does not exist until its bytes have been uploaded, which is a two-step flow \u2014 request a presigned URL (`imagePresignedUrlV2` / `videoPresignedUrlV2` / `filePresignedUrlV2`, keyed by the file\'s Base64 MD5), then HTTP PUT the bytes to it. You can do the first step through `runtime.graphql` but **not the second**: no runtime tool sends raw bytes. Three ways to get a storable id, in order of preference: `web.import_asset` with `mode: RUNTIME`, which does both steps server-side from a public URL and hands back the numeric id; `runtime.query` on `fz_images` / `fz_videos` / `fz_files`, which lists the ids the app already holds; or asking the user. Never fabricate one \u2014 a plausible number points at another project\'s asset or at nothing, and the row looks written until someone opens it.\n- **Which id, though**: a data row stores the id the RUNNING APP holds, which is what those tables list and what `mode: RUNTIME` returns. Editor-side asset ids are a different space \u2014 an id taken from the editor and written into a row, or an app id bound to a component, resolves to nothing and reports no error either way.\n- **Importing at run time is a different problem**: `web.import_asset` runs now, while you are building. An app that has to turn a URL into an asset while it runs needs the **Files** action flow node, which does the same import inside a flow. Build that node into the flow rather than importing the file yourself and writing the id in.\n- `url` is a rendering detail: read it when you want to show or check an asset, and store the id everywhere else.\n\n### What runtime.graphql can reach\n`runtime.graphql` runs against the app\'s own API \u2014 the generated table operations, the per-flow `fz_af_*`, per-agent `fz_zai_*` and per-API `fz_api_*` fields, the ZAI conversation operations, asset upload. The debug operations behind `runtime.debug_flow`, `runtime.run_code` and `zai.debug_chat` live on a separate admin surface those tools reach for you; asking for them through `runtime.graphql` reports the field as undefined. Subscriptions are unavailable from every tool here \u2014 poll the documented query counterpart instead.\n\n### Triggers\nThere is no fire-a-trigger tool, for anyone \u2014 the editor cannot do it either. A database trigger fires when a matching row is really written **and the transaction commits**, so a rollback debug run cannot fire one: the notification the runtime listens for is rolled back with everything else. To exercise a database trigger, write a row with `runtime.insert` or `runtime.update` that matches the trigger\'s table, operation and condition, then read what it did with `runtime.query` and `logs.search`. Your write is recorded so you can report it; the rows the trigger\'s own flow wrote in response are not, so name the trigger as well when you hand the run over. `runtime.status` lists the project\'s triggers with the table and operation each one watches, and a write to a triggered table says so in its confirmation.\n\nA schedule cannot be fired on demand at all: only the flow it points at can be debug-run, and the cron expression and end date can only be read as configuration, so the schedule itself stays unverified.\n\n### What you leave behind\nWhat you overwrite or delete here cannot be taken back. There is no undo tool: an overwritten column, a deleted row, and whatever a trigger did in response are simply in the user\'s app now. A rollback debug run leaves nothing; every row written any other way is one the user will find.\n\nOnly what you added can be removed again, and only part of it. A row from `runtime.insert` goes with `runtime.delete` by its id once the check no longer needs it. An account from `runtime.as_user` stays: no tool here deletes an account.\n\nWhat you do owe the user is an account of what is left. Rows you inserted and accounts you created are recorded with their ids, a row drops off that record when `runtime.delete` removes it, and you are reminded of the rest as you work \u2014 finish a verification run by saying what is still there and in which table, so they can delete it from the data table if they want to. "I added some test data" is not a handover; "I added order#41 and order#42, and account 9931 with role Customer" is.\n\nThe wire protocol for each of these calls \u2014 the query language, filter grammar, aggregations, action-flow and AI invocation, third-party calls and asset upload \u2014 is documented in the `baas-*` capabilities.',secret:`## Secret Domain Knowledge
359
366
  A secret is a named reference to a sensitive value (an API key, token, \u2026) that action flows
360
367
  and workspace API configs consume by handle rather than inlining the plaintext. Changes take effect
361
368
  online only after "Sync Backend".
@@ -388,7 +395,7 @@ ADD_THEME_VARIABLES returns each new variable's id, which is what component bind
388
395
  A palette is one basic colour and the twelve levels derived from it, level 1 lightest to level 12 darkest; GET_THEME_INFO lists the levels as hex so one can be chosen by sight. A colour variable's value should be \`{kind:'paletteRef', paletteId, level}\` whenever the colour is a shade of something the theme already has \u2014 a page ground, a lifted surface, a border and a divider are Neutral levels; a hover or pressed state is a level of the palette its resting colour follows \u2014 because that is what lets a new brand colour restyle it along with everything else. A \`{kind:'custom', color}\` hex stays put through every recolour, so it belongs only to a colour that genuinely must not move. A paletteRef without a level means the palette's basic colour itself: the semantic presets (Primary, Success, \u2026) take that form because a brand colour's lightness is arbitrary and no fixed level is guaranteed to equal it.
389
396
 
390
397
  ## Scrollbar
391
- SET_SCROLLBAR_STYLE is web-only; other clients draw the scrollbar with the OS.`,type:"## Type System Domain Knowledge\nThe type system owns named, reusable types: enums and custom objects. Data model changes require \"Sync Backend\" to take effect online.\n\n### Enums\nAn enum and each of its options carry a permanent id. The platform assigns it \u2014 never send one \u2014 and every create returns the minted ids in its result. An id is never editable afterwards, which is what keeps every column and binding that references it valid. Reference an enum as a column type in the 'database' plugin by the exact canonical identifier `u:e:<enumId>` \u2014 include the `u:e:` prefix (for example, `u:e:OrderStatus`).\n- An option's id is the value a column's default and any binding stores, so it is the id you carry to the other plugins, not the name.\n- An option's `name` is the only part of an option you can edit, and it is an identifier: letters, digits and underscores only, never starting with a digit (`PENDING`, `in_progress`). It is the enum literal the live database column holds once the project is deployed, so a name carrying spaces, hyphens or non-ASCII words is rejected outright \u2014 by the editor and by these tools alike. Non-blank, \u2264200 chars.\n- An enum's displayName is where the user-facing wording goes instead; options have none of their own, only the identifier above. Use a natural Chinese phrase (e.g. enum displayName \"\u8BA2\u5355\u72B6\u6001\"). The ids and the option names stay English as above. Non-blank, \u2264200 chars. An enum also takes an optional description; options take none.\n\nOperations:\n- `GET_ALL_ENUM_DEFINITIONS`: list enums with their options. Editing an enum requires having read it first \u2014 this listing reads every enum at once.\n- `GET_ENUM_DEFINITION_DETAIL`: read one enum by id, each option with the client platforms that accept it. This satisfies that requirement for that enum alone, so an edit to a known enum needs only this call. Check an option's `platforms` before wiring it into an action: an action carrying an option is invalid on a client whose platform is missing from it.\n- `ADD_ENUM_DEFINITIONS`: create enums with their initial options inline.\n- `UPDATE_ENUM_DEFINITIONS`: change an enum's own displayName / description. Omitted fields are unchanged. Its `options` argument REPLACES the whole option list, so use the per-option tools below for single-option edits.\n- `ADD_ENUM_OPTIONS` / `UPDATE_ENUM_OPTIONS` / `DELETE_ENUM_OPTIONS`: append options, rename them, or remove them.\n\nAdding an option is always safe. Deleting an enum or an option is destructive: anything referencing it breaks, and nothing repoints it for you \u2014 check usages, delete or repoint the columns first, and tell the user. There is no way to change an id, so a \"rename\" of an id means delete + recreate with the same breakage; if the user only wants different wording, edit the enum's displayName instead and the id can stay.\n\nIf a column should use a new enum, create the enum here first, in the same turn and before the column: take the minted id out of the create result and the column can reference `u:e:<thatId>` straight away.\n\n### Custom Objects\nCustom object types are named, reusable structured types (a set of typed fields), referenced elsewhere by the identifier `u:o:<typeId>` (action-flow inputs/outputs, other types' fields, and other type slots).\n\nOperations:\n- `GET_ALL_OBJECT_DEFINITIONS`: list object types with their fields. Editing a type requires having read it first \u2014 this listing reads every type at once.\n- `GET_OBJECT_TYPE_DEFINITION_DETAIL`: read one object type by id, its fields resolved to the same readable type names as the listing. This satisfies that requirement for that type alone, so an edit to a known type needs only this call.\n- `GET_TYPE_DEFINITION_FIELD_SELECTABLE_TYPES`: the types a field of an object type accepts, with the exact `typeIdentifier` to write.\n- `ADD_OBJECT_TYPE_DEFINITIONS`: create object types, each with a displayName and its initial fields. Ids are assigned by the platform and returned in the result \u2014 do not send one.\n- `UPDATE_OBJECT_TYPE_DEFINITIONS`: update a type's own displayName / description / private flag only (omitted fields are unchanged).\n- `ADD_TYPE_DEFINITION_FIELDS` / `UPDATE_TYPE_DEFINITION_FIELDS` / `DELETE_TYPE_DEFINITION_FIELDS`: add fields, rename or retype existing ones, or remove them.\n- `REORDER_TYPE_DEFINITION_FIELDS`: set the order the type's fields are rendered and emitted in \u2014 pass every field name, in the order wanted.\n- `COPY_PRIVATE_OBJECT_TYPE_AS_PUBLIC` / `COPY_PUBLIC_OBJECT_TYPE_AS_PRIVATE`: copy a type between the shared list and a single feature (see below).\n\nA field's type is a `typeIdentifier`: `s:p:<primitive>` (string, bigint, decimal, boolean, timestamptz, timetz, date, jsonb, image, video, file, geo_point), or `u:o:<typeId>` / `u:e:<enumId>` for a nested object or enum type. Read that shape to recognise what comes back, but never assemble one \u2014 pick the identifier out of `GET_TYPE_DEFINITION_FIELD_SELECTABLE_TYPES` and copy it verbatim, since one that names nothing, or a type this slot does not take, is rejected. Arrays are not listed \u2014 the nesting has no end \u2014 so a list field is that same identifier with the field's `arrayLevel` set (1 = list, 2 = list of lists), never brackets written into the identifier.\n\nRename and retype through `UPDATE_TYPE_DEFINITION_FIELDS` rather than delete + re-add: a rename carries the field's references along with it, where a re-add breaks every one of them. Retyping away from an image / video / file or JSON type still drops the references, because nothing that pointed at the old shape can read the new one \u2014 check usages and warn the user first. Deleting a field, or a type that is still referenced, breaks those references the same way.\n\n### Shared vs feature-owned object types\nA public type is an entry in the project's shared object type list. A private one belongs to a single feature \u2014 a webhook request body, an API JSON body, an action flow's output \u2014 and is not listed. Do NOT flip `private` with `UPDATE_OBJECT_TYPE_DEFINITIONS` to share or unshare a shape: that MOVES the type the feature is already using, so the feature's contract silently becomes an editor-listed type everything else can bind to (or stops being one). Copy instead:\n- `COPY_PRIVATE_OBJECT_TYPE_AS_PUBLIC`: put a copy of a private type into the shared list, leaving the feature on the original. Read `GET_OBJECT_TYPE_DEFINITION_GROUPS` first \u2014 the copy joins that configuration.\n- `COPY_PUBLIC_OBJECT_TYPE_AS_PRIVATE`: take a feature-owned copy of a shared type, so that one feature can diverge without changing the shape for everyone else.\n\nEither way the copy is a NEW type with a new id, and nothing points at it yet: the feature keeps using the old type until you set that slot's type to the `typeIdentifier` the result echoes.",webhook:`## Webhook Domain Knowledge
398
+ SET_SCROLLBAR_STYLE is web-only; other clients draw the scrollbar with the OS.`,type:"## Type System Domain Knowledge\nThe type system owns named, reusable types: enums and custom objects. Data model changes require \"Sync Backend\" to take effect online.\n\n### Enums\nAn enum and each of its options carry a permanent id. The platform assigns it \u2014 never send one \u2014 and every create returns the minted ids in its result. An id is never editable afterwards, which is what keeps every column and binding that references it valid. Reference an enum as a column type in the 'database' plugin by the exact canonical identifier `u:e:<enumId>` \u2014 include the `u:e:` prefix (for example, `u:e:OrderStatus`).\n- An option's id is the value a column's default and any binding stores, so it is the id you carry to the other plugins, not the name.\n- An option's `name` is the only part of an option you can edit, and it is an identifier: letters, digits and underscores only, never starting with a digit (`PENDING`, `in_progress`). It is the enum literal the live database column holds once the project is deployed, so a name carrying spaces, hyphens or non-ASCII words is rejected outright \u2014 by the editor and by these tools alike. Non-blank, \u2264200 chars.\n- An enum's displayName is where the user-facing wording goes instead; options have none of their own, only the identifier above. Use a natural Chinese phrase (e.g. enum displayName \"\u8BA2\u5355\u72B6\u6001\"). The ids and the option names stay English as above. Non-blank, \u2264200 chars. An enum also takes an optional description; options take none.\n\nOperations:\n- `GET_ALL_ENUM_DEFINITIONS`: list enums with their options. Editing an enum requires having read it first \u2014 this listing reads every enum at once.\n- `GET_ENUM_DEFINITION_DETAIL`: read one enum by id, each option with the client platforms that accept it. This satisfies that requirement for that enum alone, so an edit to a known enum needs only this call. Check an option's `platforms` before wiring it into an action: an action carrying an option is invalid on a client whose platform is missing from it.\n- `ADD_ENUM_DEFINITIONS`: create enums with their initial options inline.\n- `UPDATE_ENUM_DEFINITIONS`: change an enum's own displayName / description. Omitted fields are unchanged. Its `options` argument REPLACES the whole option list, so use the per-option tools below for single-option edits.\n- `ADD_ENUM_OPTIONS` / `UPDATE_ENUM_OPTIONS` / `DELETE_ENUM_OPTIONS`: append options, rename them, or remove them.\n\nAdding an option is always safe. Deleting an enum or an option is destructive: anything referencing it breaks, and nothing repoints it for you \u2014 check usages, delete or repoint the columns first, and tell the user. There is no way to change an id, so a \"rename\" of an id means delete + recreate with the same breakage; if the user only wants different wording, edit the enum's displayName instead and the id can stay.\n\nIf a column should use a new enum, create the enum here first, in the same turn and before the column: take the minted id out of the create result and the column can reference `u:e:<thatId>` straight away.\n\n### Custom Objects\nCustom object types are named, reusable structured types (a set of typed fields), referenced elsewhere by the identifier `u:o:<typeId>` (action-flow inputs/outputs, other types' fields, and other type slots).\n\nOperations:\n- `GET_ALL_OBJECT_DEFINITIONS`: list object types with their fields. Editing a type requires having read it first \u2014 this listing reads every type at once.\n- `GET_OBJECT_TYPE_DEFINITION_DETAIL`: read one object type by id, its fields resolved to the same readable type names as the listing. This satisfies that requirement for that type alone, so an edit to a known type needs only this call.\n- `GET_TYPE_DEFINITION_FIELD_SELECTABLE_TYPES`: the types a field of an object type accepts, with the exact `typeIdentifier` to write.\n- `ADD_OBJECT_TYPE_DEFINITIONS`: create object types, each with a displayName and its initial fields. Ids are assigned by the platform and returned in the result \u2014 do not send one.\n- `UPDATE_OBJECT_TYPE_DEFINITIONS`: update a type's own displayName / description only (omitted fields are unchanged).\n- `ADD_TYPE_DEFINITION_FIELDS` / `UPDATE_TYPE_DEFINITION_FIELDS` / `DELETE_TYPE_DEFINITION_FIELDS`: add fields, rename or retype existing ones, or remove them.\n- `REORDER_TYPE_DEFINITION_FIELDS`: set the order the type's fields are rendered and emitted in \u2014 pass every field name, in the order wanted.\n- `PUBLISH_OBJECT_TYPE` / `COPY_PUBLIC_OBJECT_TYPE_AS_PRIVATE`: cross between the shared list and a single feature (see below).\n\nA field's type is a `typeIdentifier`: `s:p:<primitive>` (string, bigint, decimal, boolean, timestamptz, timetz, date, jsonb, image, video, file, geo_point), or `u:o:<typeId>` / `u:e:<enumId>` for a nested object or enum type. Read that shape to recognise what comes back, but never assemble one \u2014 pick the identifier out of `GET_TYPE_DEFINITION_FIELD_SELECTABLE_TYPES` and copy it verbatim, since one that names nothing, or a type this slot does not take, is rejected. Arrays are not listed \u2014 the nesting has no end \u2014 so a list field is that same identifier with the field's `arrayLevel` set (1 = list, 2 = list of lists), never brackets written into the identifier.\n\nRename and retype through `UPDATE_TYPE_DEFINITION_FIELDS` rather than delete + re-add: a rename carries the field's references along with it, where a re-add breaks every one of them. Retyping away from an image / video / file or JSON type still drops the references, because nothing that pointed at the old shape can read the new one \u2014 check usages and warn the user first. Deleting a field, or a type that is still referenced, breaks those references the same way.\n\n### Shared vs feature-owned object types\nA public type is an entry in the project's shared object type list. A private one belongs to a single feature \u2014 a webhook request body, an API JSON body, an action flow's output \u2014 and is not listed. Cross that line only through these two tools; `UPDATE_OBJECT_TYPE_DEFINITIONS` does not change visibility:\n- `PUBLISH_OBJECT_TYPE`: publish a private type into the shared list. The type keeps its id, so the slot that owns it keeps working; read `GET_OBJECT_TYPE_DEFINITION_GROUPS` first \u2014 the type joins that configuration.\n- `COPY_PUBLIC_OBJECT_TYPE_AS_PRIVATE`: take a feature-owned (private) copy of a shared type, so one feature can diverge without changing the shape for everyone else. The copy is a NEW anonymous private type with a new id and nothing points at it yet: set that slot's type to the `typeIdentifier` the result echoes, in the same batch.",webhook:`## Webhook Domain Knowledge
392
399
  A webhook is a public HTTP endpoint that fires an action flow every time it is called; the
393
400
  URL ends with the webhook's generated uniqueId. Only custom webhooks are authorable here \u2014
394
401
  payment-provider callbacks (Alipay / WeChat / Stripe / \u2026) come back with \`managed: true\`:
@@ -449,9 +456,16 @@ go over HTTP, and a media field without one leaves the webhook incomplete.
449
456
  GET_CALLBACK_CODEC_OPTIONS lists exactly which slots of the request and response bodies need one
450
457
  and which conversions each allows; feed a slot's \`typeIdentifier\` / \`field\` back to
451
458
  SET_CALLBACK_CODECS verbatim, and DELETE_CALLBACK_CODECS to remove one. A slot is a field of a type,
452
- 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`.'},Fg={"query-language":`## Querying Zion data (auto-generated GraphQL over PostgreSQL)
453
- The schema is generated from the data model \u2014 introspect the live schema before assuming exact
454
- fields/enums. Each table [table] generates:
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)
460
+ The schema is generated from the data model. Every name and type derived from a table follows
461
+ from the rules below and what the data-model read reports for it \u2014 each column's apiName and
462
+ type, each relation, each unique constraint's name (the primary key's is [table]_pkey) \u2014 so a
463
+ table needs no introspection unless its latest changes are not synced yet. Introspect the live
464
+ schema only for what no data-model read describes: built-in platform types and operations,
465
+ custom object and enum types, and the arguments and results of actionflows, AI agents and
466
+ APIs. Introspection is answered for the admin identity only, and each of __schema, __type,
467
+ fields and inputFields may appear once per document: look up one type per call.
468
+ Each table [table] generates:
455
469
  - Queries: [table] (list; where/order_by/distinct_on/limit/offset), [table]_by_pk (by id),
456
470
  [table]_aggregate (count/sum/avg/min/max), [table]_group_by. A geo_point column adds
457
471
  fz_[table]_by_[column] (proximity search); Relay pagination adds a Connection_[table] query.
@@ -685,7 +699,7 @@ getImageListByIds(imageIds:_int8){ id exId url urlInfo{ urlExpireAt } } \u2014 e
685
699
  getImageListByExIds(imageExIds:[String]) \u2014 then rewrite each src. Cache by urlExpireAt and
686
700
  never write a resolved URL back into the column. Writing is the mirror image: upload through
687
701
  the two-step above, then emit src="fz_image_<imageId>". An external URL left in the body is
688
- 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}),Ro=(t,e,n,r,o)=>{t.registerTool(e,{description:n,inputSchema:r},o)},Zg=(t,e,n)=>{for(let r of e)Ro(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??{}};Ro(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()};Ro(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);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=>WP(Gg(String(n.plugin))))},Wg=(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)=>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 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.
689
703
  Changes apply immediately; use schema_undo to revert the last change. Ops:
690
704
  - op=ADD \u2014 Result echoes each new flow's id.
691
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.
@@ -725,7 +739,10 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
725
739
  - op=MOVE_ACTION_FLOW_NODES \u2014 Move nodes within one action flow. Several nodes move as one contiguous chain, ordered by the flow's own execution order regardless of the order given; a block start carries its whole block. Result echoes the applied order and the resolved anchor.
726
740
  - op=REORDER_ACTION_FLOW_BRANCH_ITEMS \u2014 Reorder the branches (= evaluation order) of one BRANCH_SEPARATION. Read the current order from GET_ACTION_FLOW_DETAIL's branchItemIds.
727
741
  - op=UPDATE_NODE (req: actionFlowId, nodeId)
728
- - 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 COPY_PRIVATE_OBJECT_TYPE_AS_PUBLIC. 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_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.
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
+ Changes apply immediately; use schema_undo to revert the last change. Ops:
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.
729
746
  Changes apply immediately; use schema_undo to revert the last change. Ops:
730
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.
731
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.
@@ -754,7 +771,7 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
754
771
  - op=UPDATE_CLIENT_VARIABLES \u2014 Rename a client variable or change its type. The key is what everything refers to, so a rename leaves the references alone; retyping does not, and a binding whose value no longer fits the new type is reported as an error until it is rewritten.`,ops:{ADD_CLIENT_VARIABLES:"ADD_CLIENT_VARIABLES",DELETE_CLIENT_VARIABLES:"DELETE_CLIENT_VARIABLES",GET_CLIENT_VARIABLES_INFO:"GET_CLIENT_VARIABLES_INFO",GET_CLIENT_VARIABLE_SELECTABLE_TYPES:"GET_CLIENT_VARIABLE_SELECTABLE_TYPES",UPDATE_CLIENT_VARIABLES:"UPDATE_CLIENT_VARIABLES"},inputSchema:{items:c.array(c.any()).optional(),variableKeys:c.array(c.any()).optional()}},{name:"schema_component",tier:"core",description:`UI component tree (pages, containers, leaf components). Layout is Flexbox; special components (LIST/TAB_VIEW/SELECT_VIEW/CONDITIONAL_VIEW) take children only in their built-in slots.
755
772
  Changes apply immediately; use schema_undo to revert the last change. Ops:
756
773
  - op=ADD \u2014 Create components. One call builds a whole subtree \u2014 nest each child definition inside its parent's children/slot field and every level is created together, so build a screen region per call rather than one component per call. New components are appended after their parent's existing children; MOVE_COMPONENTS reorders them afterwards, so create them in the order you want them read. Give every component its styling in this call whenever a design system or a stated style preference applies \u2014 the creation defaults are generic, and restyling later is a second pass over work you already did. Every node takes its own 'style' \u2014 nested children and slot definitions (a LIST's cell, header, footer) alike \u2014 and only each item's outermost component gets its id echoed, so anything left unstyled inside one costs a FIND_COMPONENTS lookup to reach again. A container left without children, or a query no component consumes, is a defect the editor reports: finish a region before starting the next, since anything still unfinished is named back to you before the turn can close. Every size written here is written at the main breakpoint and inherited by all the others, so a card at width '32%' is 32% of a phone screen too \u2014 under 120px, wide enough for about four characters, and the page grows to tens of thousands of pixels tall. Percentage and fixed widths that only make sense beside their siblings in a row need a phone override the moment that row is stacked into a column; reach for 'fill' and fr shares where you can, since those re-solve at whatever width they are given. Reproducing an existing design, build what it uses: an icon in the source is an imported asset in an IMAGE component, not a '\u25C9' or an emoji in a TEXT. Result echoes each new component's minted id.
757
- - op=ADD_ACTIONS \u2014 Attach a frontend action to a component event \u2014 or, by sending \`scheduledJobId\` instead of \`eventType\`, to a page's or modal's scheduled job \u2014 or (with attachTo) chain it onto an existing handler's ON_SUCCESS / ON_FAILURE branch. This is the only tool that attaches actions \u2014 every kind goes through it. Call GET_SELECTABLE_COMPONENT_ACTIONS first: it lists what this event, client and project accept. Anything missing cannot be attached \u2014 a leaf with no kind is editor-only; a dropped kind is refused with the alternative named. Each item's extra fields follow its kind (an ACTION_FLOW names a flow, a NAVIGATION a page, a MUTATION a table and operation, a REFRESH its targets, the component-targeting kinds a target component, a CONDITIONAL its branch names, a payment kind a configId and a paymentProduct, both from GET_PAYMENT_CONFIGS); the rest take no configuration. None of those fields can be changed afterwards \u2014 there is no update tool for an attached action, only delete and re-add \u2014 so get them right on this call. CONDITIONAL is how one event runs different actions for different cases: it evaluates its branches in order and runs the first whose condition holds, so putting the actions in branches is what stops them all firing at once. Its branches come back as conditionalBranchIds \u2014 fill each with a further call whose attachTo carries one, and narrow each condition at the echoed conditionSchemaPath. Every parameter is seeded empty and echoed as a bindableSchemaPath: fill each with CREATE_CONST_BINDING or BROWSE_DATA_BINDING_OPTIONS + CREATE_OPTION_BINDING. Whatever a kind returns beyond that \u2014 a mutation's requestId and column paths, a navigation's seeded page inputs, a call-flow's input args \u2014 arrives under that handler's \`details\`.
774
+ - op=ADD_ACTIONS \u2014 Attach a frontend action to a component event \u2014 or, by sending \`scheduledJobId\` instead of \`eventType\`, to a page's or modal's scheduled job \u2014 or (with attachTo) chain it onto an existing handler's ON_SUCCESS / ON_FAILURE branch. This is the only tool that attaches actions \u2014 every kind goes through it. Call GET_SELECTABLE_COMPONENT_ACTIONS first: it lists what this event, client and project accept. Anything missing cannot be attached \u2014 a leaf with no kind is editor-only; a dropped kind is refused with the alternative named. Each item's extra fields follow its kind (an ACTION_FLOW names a flow, a NAVIGATION a page, a MUTATION a table and operation, a REFRESH its targets, the component-targeting kinds a target component, a CONDITIONAL its branch names, a payment kind a configId and a paymentProduct, both from GET_PAYMENT_CONFIGS); the rest take no configuration. None of those fields can be changed afterwards \u2014 only delete and re-add \u2014 so get them right on this call; a MUTATION's batch insert, column validation and conflict handling are the exception, with their own update tool. CONDITIONAL is how one event runs different actions for different cases: it evaluates its branches in order and runs the first whose condition holds, so putting the actions in branches is what stops them all firing at once. Its branches come back as conditionalBranchIds \u2014 fill each with a further call whose attachTo carries one, and narrow each condition at the echoed conditionSchemaPath. Every parameter is seeded empty and echoed as a bindableSchemaPath: fill each with CREATE_CONST_BINDING or BROWSE_DATA_BINDING_OPTIONS + CREATE_OPTION_BINDING. Whatever a kind returns beyond that \u2014 a mutation's requestId and column paths, a navigation's seeded page inputs, a call-flow's input args \u2014 arrives under that handler's \`details\`.
758
775
  - op=ADD_INPUTS \u2014 Declare input parameters on a component whose acceptsInputs is true (GET_COMPONENT_INFO reports it; today that means a page or modal, and anything else is rejected). Navigation/show-modal call sites then pass values per input (ADD_COMPONENT_ACTIONS' NAVIGATION kind seeds one binding slot per input). Result echoes each input's key and, for GENERAL inputs, the defaultValue schemaPath for the CREATE_*_BINDING tools.
759
776
  - op=ADD_QUERY \u2014 Attach a database query to a component whose acceptsVariables is true (GET_COMPONENT_INFO reports it; today that means a page or modal, and anything else is rejected). Creates a read-only variable (the editor labels these 'Page variable' in its right panel, on modals too) whose dataSource is a query on the given table, seeded with the mandatory always-true Default filter. Result echoes the variable key and the schema paths for narrowing the filter (GET_REQUEST_FILTER_CONTEXT) and for binding components to the data (CREATE_OPTION_BINDING), plus any roles still lacking SELECT on the table (grant via UPDATE_ROLE_TABLE_PERMISSION).
760
777
  - op=ADD_SCHEDULED_JOBS \u2014 Create timer jobs on a page or modal. A job is a schedule and nothing more: it runs its actions every \`interval\` milliseconds, and a new one starts with none, so follow this call with ADD_COMPONENT_ACTIONS carrying the echoed \`scheduledJobId\` to give it something to do. The result echoes each job's id, name and actionsSchemaPath.
@@ -793,11 +810,12 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
793
810
  - op=SET_INITIAL_PAGE_ID \u2014 Set the app's initial (home) page for the current client.
794
811
  - op=SET_SHEET_DATA_SOURCE \u2014 Point a SHEET at a table: builds the sheet's embedded database query (all selectable columns by default) and echoes the query's schemaPath so filters and sorts can be added there with the request tools. A SHEET without a data source is invalid.
795
812
  - op=SET_TAB_VIEW_TAB_MODE \u2014 Switch a TAB_VIEW between the built-in tab bar (NORMAL) and custom tab components (CUSTOM), after creation. CUSTOM mints two empty LAYOUT_VIEWs \u2014 one rendered for an unselected tab, one for the selected tab \u2014 and echoes their ids to fill with ADD_COMPONENT. NORMAL deletes those two and their subtrees.
796
- - op=UPDATE_INPUT \u2014 Rename an input, or change its type, array level or optionality. Every call site that passes the input (navigation and show-modal input maps) follows, listed back under cleanedDanglingReferences: a rename rekeys it, and a type change rewrites the value it passes \u2014 to a text type, a single value becomes a text template holding it and a text template stays; to any other type, a text template is reset to empty and a single value keeps its source under the new type. Nothing else changes: bindings that read the input keep their source, and the input's default value is kept as it is even when it no longer fits the new type. Validation then reports it, and it is up to you to set one that fits at the echoed defaultValueSchemaPath, clear it there with CLEAR_DATA_BINDING, or change the type back.
813
+ - op=UPDATE_INPUT \u2014 Rename an input, or change its type, array level, optionality, or (URL_QUERY only) whether an empty value is left out of the link. Every call site that passes the input (navigation and show-modal input maps) follows, listed back under cleanedDanglingReferences: a rename rekeys it, and a type change rewrites the value it passes \u2014 to a text type, a single value becomes a text template holding it and a text template stays; to any other type, a text template is reset to empty and a single value keeps its source under the new type. Nothing else changes: bindings that read the input keep their source, and the input's default value is kept as it is even when it no longer fits the new type. Validation then reports it, and it is up to you to set one that fits at the echoed defaultValueSchemaPath, clear it there with CLEAR_DATA_BINDING, or change the type back.
814
+ - op=UPDATE_MUTATION_ACTION (req: schemaPath)
797
815
  - op=UPDATE_PROPERTIES \u2014 Merge-based update of a component's non-binding scalar properties (feature toggles, modes, numeric limits, plain-string fields) and/or its displayName \u2014 only provided fields change. The fields each componentType accepts, and every enum's legal values, are enumerated in this tool's own parameter schema \u2014 read them there rather than guessing. Binding-valued properties (title, dataSource, defaultValue, placeholder, \u2026) are rejected here; list and fill those via GET_COMPONENT_BINDABLE_PROPERTIES + CREATE_*_BINDING.
798
- - op=UPDATE_QUERY \u2014 Set or clear the row limit of a query, or switch it between QUERY and SUBSCRIPTION, as the editor's data tab does. Pass variableKey for a page-data variable on a PAGE or MODAL; omit it for the query or API behind a LIST, SELECT_VIEW, DATA_SELECTOR or SHEET. Send at least one of limit (1 to 99999999), clearLimit or queryType; only what you send is written. A page-data variable is retyped between single row (limit 1) and list (anything else, including no limit), so bindings written against the old shape need re-checking. A third-party API source takes it only on a LIST whose load-more is on, where the editor calls it 'Page size'. queryDisplayName renames a page-data variable and its query.
816
+ - op=UPDATE_QUERY \u2014 Set or clear the row limit of a query, switch it between QUERY and SUBSCRIPTION, or pick the List/Id fields of a third-party API data source, as the editor's data tab does. Pass variableKey for a page-data variable on a PAGE or MODAL, or omit it for the component's own data source; send at least one field to change. A page-data variable is retyped between single row (limit 1) and list (anything else, including no limit), so bindings written against the old shape need re-checking. Switching queryType to SUBSCRIPTION clears the query's request-status-change actions and, on a LIST, turns off load-more and pull-down refresh. Omitting uniqueIdentifierFieldPath keeps the current one, except that changing listFieldPath clears it unless both are sent together; an empty listFieldPath clears both and cannot be paired with a non-empty uniqueIdentifierFieldPath, while an empty uniqueIdentifierFieldPath clears only itself.
799
817
  - op=UPDATE_SCHEDULED_JOB \u2014 Change a job's name, interval (milliseconds) or whether it runs at page load; a field left out keeps its current value. This never touches the job's actions \u2014 those are ADD_COMPONENT_ACTIONS and DELETE_COMPONENT_EVENT_HANDLERS with its \`scheduledJobId\`.
800
- - op=UPDATE_STYLE \u2014 Merge-based style update: only provided fields change (size, background, opacity, padding/margin, border incl. line style, shadow, cursor, flex gap/direction/alignment, text color/size/weight/align). Writes the client's main breakpoint unless a breakpoint key is given (non-main breakpoints store only deltas). Pass variant='hover' to style the hover interaction state (per breakpoint; no cross-breakpoint inheritance). Colour fields (backgroundColor/textColor/borderColor, gradient stops, shadow.color) take a hex literal or a colour variable's referenceValue ('$$<id>'). Spacing (padding/margin/gap/rowGap/columnGap), radius (borderRadius/borderRadiusCorners), fontSize, fontWeight and fontFamily take a reference to a variable of the matching class, and shadow takes a whole shadow variable as shadow.variable. These tools apply as an atomic batch: one reference the client cannot resolve fails everything sent with it. Bind the theme as you build \u2014 a literal is pinned where you wrote it, so a project styled in literals can only be restyled component by component. A reference resolves against the variable class the field belongs to, so the same id under padding means a spacing and under borderRadius a radius. GET_PROJECT_OVERVIEW lists the colour ids this client defines \u2014 read them there rather than from memory. Which fields a component accepts depends on its type \u2014 GET_COMPONENT_INFO lists them under style.applicableFields alongside the values already set.`,ops:{ADD:"ADD_COMPONENT",ADD_ACTIONS:"ADD_COMPONENT_ACTIONS",ADD_INPUTS:"ADD_COMPONENT_INPUTS",ADD_QUERY:"ADD_COMPONENT_QUERY",ADD_SCHEDULED_JOBS:"ADD_COMPONENT_SCHEDULED_JOBS",ADD_VARIABLES:"ADD_COMPONENT_VARIABLES",ADD_CONDITIONAL_VIEW_BRANCHES:"ADD_CONDITIONAL_VIEW_BRANCHES",ADD_SHEET_COLUMNS:"ADD_SHEET_COLUMNS",ADD_TAB_VIEW_TABS:"ADD_TAB_VIEW_TABS",CLEAR_SLOT:"CLEAR_COMPONENT_SLOT",DELETE:"DELETE_COMPONENTS",DELETE_EVENT_HANDLERS:"DELETE_COMPONENT_EVENT_HANDLERS",DELETE_INPUTS:"DELETE_COMPONENT_INPUTS",DELETE_SCHEDULED_JOBS:"DELETE_COMPONENT_SCHEDULED_JOBS",DELETE_VARIABLES:"DELETE_COMPONENT_VARIABLES",DELETE_CONDITIONAL_VIEW_BRANCHES:"DELETE_CONDITIONAL_VIEW_BRANCHES",DELETE_SHEET_COLUMNS:"DELETE_SHEET_COLUMNS",DELETE_TAB_VIEW_TABS:"DELETE_TAB_VIEW_TABS",DUPLICATE:"DUPLICATE_COMPONENTS",DUPLICATE_ACTIONS:"DUPLICATE_COMPONENT_ACTIONS",FIND:"FIND_COMPONENTS",GET_ALL_ROOTS_INFO:"GET_ALL_ROOTS_INFO",GET_BINDABLE_PROPERTIES:"GET_COMPONENT_BINDABLE_PROPERTIES",GET_CONTEXT_INFO:"GET_COMPONENT_CONTEXT_INFO",GET_INFO:"GET_COMPONENT_INFO",GET_SELECTABLE_EVENTS:"GET_COMPONENT_SELECTABLE_EVENTS",GET_TEMPLATE:"GET_COMPONENT_TEMPLATE",GET_TYPE_CAPABILITIES:"GET_COMPONENT_TYPE_CAPABILITIES",GET_VARIABLE_SELECTABLE_TYPES:"GET_COMPONENT_VARIABLE_SELECTABLE_TYPES",GET_CHILDREN_INFO:"GET_CONTAINER_CHILDREN_INFO",GET_INCOMPLETE_STRUCTURES:"GET_INCOMPLETE_STRUCTURES",GET_SELECTABLE_TYPES:"GET_SELECTABLE_COMPONENT_TYPES",MOVE:"MOVE_COMPONENTS",REORDER_CONDITIONAL_VIEW_BRANCHES:"REORDER_CONDITIONAL_VIEW_BRANCHES",REORDER_SHEET_COLUMNS:"REORDER_SHEET_COLUMNS",REORDER_TAB_VIEW_TABS:"REORDER_TAB_VIEW_TABS",SET_SLOT:"SET_COMPONENT_SLOT",SET_INITIAL_PAGE_ID:"SET_INITIAL_PAGE_ID",SET_SHEET_DATA_SOURCE:"SET_SHEET_DATA_SOURCE",SET_TAB_VIEW_TAB_MODE:"SET_TAB_VIEW_TAB_MODE",UPDATE_INPUT:"UPDATE_COMPONENT_INPUT",UPDATE_PROPERTIES:"UPDATE_COMPONENT_PROPERTIES",UPDATE_QUERY:"UPDATE_COMPONENT_QUERY",UPDATE_SCHEDULED_JOB:"UPDATE_COMPONENT_SCHEDULED_JOB",UPDATE_STYLE:"UPDATE_COMPONENT_STYLE"},inputSchema:{arrayLevel:c.number().optional(),attachTo:c.record(c.any()).optional(),branchChildComponentIds:c.array(c.any()).optional(),breakpoint:c.string().optional(),childDisplayName:c.string().optional(),clearLimit:c.boolean().optional(),columns:c.array(c.any()).optional(),componentId:c.string().optional(),componentIds:c.array(c.any()).optional(),componentType:c.enum(["PAGE","BUTTON","TEXT","LAYOUT_VIEW","LIST","IMAGE","VIDEO","LOTTIE","WECHAT_NAVIGATION_BAR","MOBILE_NAVIGATION_BAR","RICH_TEXT","TEXT_INPUT","NUMBER_INPUT","VIDEO_PICKER","TAB_VIEW","SELECT_VIEW","SWITCH","MODAL","MAP","MAP_MARKER","WECHAT_ADVERT_BANNER","LOTTIE_PROGRESS_BAR","CALENDAR","CAMERA","CONDITIONAL_VIEW","WECHAT_OFFICIAL_ACCOUNT","HORIZONTAL_LINE","CODE_COMPONENT","SHEET","HTML","RICH_TEXT_EDITOR","MIX_IMAGE_PICKER","DATE_TIME_PICKER","DATA_SELECTOR","PROGRESS_BAR"]).optional(),componentTypes:c.array(c.any()).optional(),dataFieldNames:c.array(c.any()).optional(),eventType:c.string().optional(),fullComponentConfigs:c.boolean().optional(),handlerIds:c.array(c.any()).optional(),includeSiblings:c.boolean().optional(),index:c.number().optional(),inputKey:c.string().optional(),inputKeys:c.array(c.any()).optional(),interval:c.number().optional(),items:c.array(c.any()).optional(),limit:c.number().optional(),mode:c.enum(["CUSTOM","NORMAL"]).optional(),name:c.string().optional(),newDisplayName:c.string().optional(),newName:c.string().optional(),normalTabDisplayName:c.string().optional(),optional:c.boolean().optional(),orderedBranchChildComponentIds:c.array(c.any()).optional(),orderedDataFieldNames:c.array(c.any()).optional(),orderedTabChildComponentIds:c.array(c.any()).optional(),pageId:c.string().optional(),pageInputCategory:c.enum(["GENERAL","URL_PATH","URL_QUERY"]).optional(),properties:c.record(c.any()).optional(),query:c.string().optional(),queryDisplayName:c.string().optional(),queryType:c.enum(["QUERY","SUBSCRIPTION"]).optional(),rootComponentId:c.string().optional(),scheduledJobId:c.string().optional(),scheduledJobIds:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional(),selectedTabDisplayName:c.string().optional(),slotField:c.string().optional(),sourceComponentId:c.string().optional(),sourceEventType:c.string().optional(),startImmediately:c.boolean().optional(),style:c.record(c.any()).optional(),tabChildComponentIds:c.array(c.any()).optional(),tableDisplayName:c.string().optional(),targetParentComponentId:c.string().optional(),typeIdentifier:c.string().optional(),variableKey:c.string().optional(),variableKeys:c.array(c.any()).optional(),variant:c.string().optional()}},{name:"schema_condition_expr",tier:"core",description:`Edit the boolean condition expression at a binding location (schemaPath). LIST_OPERATORS returns the comparisons available for a term; SET_OPERATOR sets one.
818
+ - op=UPDATE_STYLE \u2014 Merge-based style update: only provided fields change (size, background, opacity, padding/margin, border incl. line style, shadow, cursor, flex gap/direction/alignment, text color/size/weight/align). Writes the client's main breakpoint unless a breakpoint key is given (non-main breakpoints store only deltas). Pass variant='hover' to style the hover interaction state (per breakpoint; no cross-breakpoint inheritance). Colour fields (backgroundColor/textColor/borderColor, gradient stops, shadow.color) take a hex literal or a colour variable's referenceValue ('$$<id>'). Spacing (padding/margin/gap/rowGap/columnGap), radius (borderRadius/borderRadiusCorners), fontSize, fontWeight and fontFamily take a reference to a variable of the matching class, and shadow takes a whole shadow variable as shadow.variable. These tools apply as an atomic batch: one reference the client cannot resolve fails everything sent with it. Bind the theme as you build \u2014 a literal is pinned where you wrote it, so a project styled in literals can only be restyled component by component. A reference resolves against the variable class the field belongs to, so the same id under padding means a spacing and under borderRadius a radius. GET_PROJECT_OVERVIEW lists the colour ids this client defines \u2014 read them there rather than from memory. Which fields a component accepts depends on its type \u2014 GET_COMPONENT_INFO lists them under style.applicableFields alongside the values already set.`,ops:{ADD:"ADD_COMPONENT",ADD_ACTIONS:"ADD_COMPONENT_ACTIONS",ADD_INPUTS:"ADD_COMPONENT_INPUTS",ADD_QUERY:"ADD_COMPONENT_QUERY",ADD_SCHEDULED_JOBS:"ADD_COMPONENT_SCHEDULED_JOBS",ADD_VARIABLES:"ADD_COMPONENT_VARIABLES",ADD_CONDITIONAL_VIEW_BRANCHES:"ADD_CONDITIONAL_VIEW_BRANCHES",ADD_SHEET_COLUMNS:"ADD_SHEET_COLUMNS",ADD_TAB_VIEW_TABS:"ADD_TAB_VIEW_TABS",CLEAR_SLOT:"CLEAR_COMPONENT_SLOT",DELETE:"DELETE_COMPONENTS",DELETE_EVENT_HANDLERS:"DELETE_COMPONENT_EVENT_HANDLERS",DELETE_INPUTS:"DELETE_COMPONENT_INPUTS",DELETE_SCHEDULED_JOBS:"DELETE_COMPONENT_SCHEDULED_JOBS",DELETE_VARIABLES:"DELETE_COMPONENT_VARIABLES",DELETE_CONDITIONAL_VIEW_BRANCHES:"DELETE_CONDITIONAL_VIEW_BRANCHES",DELETE_SHEET_COLUMNS:"DELETE_SHEET_COLUMNS",DELETE_TAB_VIEW_TABS:"DELETE_TAB_VIEW_TABS",DUPLICATE:"DUPLICATE_COMPONENTS",DUPLICATE_ACTIONS:"DUPLICATE_COMPONENT_ACTIONS",FIND:"FIND_COMPONENTS",GET_ALL_ROOTS_INFO:"GET_ALL_ROOTS_INFO",GET_BINDABLE_PROPERTIES:"GET_COMPONENT_BINDABLE_PROPERTIES",GET_CONTEXT_INFO:"GET_COMPONENT_CONTEXT_INFO",GET_INFO:"GET_COMPONENT_INFO",GET_SELECTABLE_EVENTS:"GET_COMPONENT_SELECTABLE_EVENTS",GET_TEMPLATE:"GET_COMPONENT_TEMPLATE",GET_TYPE_CAPABILITIES:"GET_COMPONENT_TYPE_CAPABILITIES",GET_VARIABLE_SELECTABLE_TYPES:"GET_COMPONENT_VARIABLE_SELECTABLE_TYPES",GET_CHILDREN_INFO:"GET_CONTAINER_CHILDREN_INFO",GET_INCOMPLETE_STRUCTURES:"GET_INCOMPLETE_STRUCTURES",GET_SELECTABLE_TYPES:"GET_SELECTABLE_COMPONENT_TYPES",MOVE:"MOVE_COMPONENTS",REORDER_CONDITIONAL_VIEW_BRANCHES:"REORDER_CONDITIONAL_VIEW_BRANCHES",REORDER_SHEET_COLUMNS:"REORDER_SHEET_COLUMNS",REORDER_TAB_VIEW_TABS:"REORDER_TAB_VIEW_TABS",SET_SLOT:"SET_COMPONENT_SLOT",SET_INITIAL_PAGE_ID:"SET_INITIAL_PAGE_ID",SET_SHEET_DATA_SOURCE:"SET_SHEET_DATA_SOURCE",SET_TAB_VIEW_TAB_MODE:"SET_TAB_VIEW_TAB_MODE",UPDATE_INPUT:"UPDATE_COMPONENT_INPUT",UPDATE_MUTATION_ACTION:"UPDATE_COMPONENT_MUTATION_ACTION",UPDATE_PROPERTIES:"UPDATE_COMPONENT_PROPERTIES",UPDATE_QUERY:"UPDATE_COMPONENT_QUERY",UPDATE_SCHEDULED_JOB:"UPDATE_COMPONENT_SCHEDULED_JOB",UPDATE_STYLE:"UPDATE_COMPONENT_STYLE"},inputSchema:{arrayLevel:c.number().optional(),attachTo:c.record(c.any()).optional(),branchChildComponentIds:c.array(c.any()).optional(),breakpoint:c.string().optional(),childDisplayName:c.string().optional(),clearLimit:c.boolean().optional(),clearOnConflict:c.boolean().optional(),columns:c.array(c.any()).optional(),columnValidations:c.array(c.any()).optional(),componentId:c.string().optional(),componentIds:c.array(c.any()).optional(),componentType:c.enum(["PAGE","BUTTON","TEXT","LAYOUT_VIEW","LIST","IMAGE","VIDEO","LOTTIE","WECHAT_NAVIGATION_BAR","MOBILE_NAVIGATION_BAR","RICH_TEXT","TEXT_INPUT","NUMBER_INPUT","VIDEO_PICKER","TAB_VIEW","SELECT_VIEW","SWITCH","MODAL","MAP","MAP_MARKER","WECHAT_ADVERT_BANNER","LOTTIE_PROGRESS_BAR","CALENDAR","CAMERA","CONDITIONAL_VIEW","WECHAT_OFFICIAL_ACCOUNT","HORIZONTAL_LINE","CODE_COMPONENT","SHEET","HTML","RICH_TEXT_EDITOR","MIX_IMAGE_PICKER","DATE_TIME_PICKER","DATA_SELECTOR","PROGRESS_BAR"]).optional(),componentTypes:c.array(c.any()).optional(),dataFieldNames:c.array(c.any()).optional(),eventType:c.string().optional(),fullComponentConfigs:c.boolean().optional(),handlerIds:c.array(c.any()).optional(),ignoreWhenEmpty:c.boolean().optional(),includeSiblings:c.boolean().optional(),index:c.number().optional(),inputKey:c.string().optional(),inputKeys:c.array(c.any()).optional(),interval:c.number().optional(),items:c.array(c.any()).optional(),limit:c.number().optional(),listFieldPath:c.array(c.any()).optional(),listMutation:c.boolean().optional(),mode:c.enum(["CUSTOM","NORMAL"]).optional(),name:c.string().optional(),newDisplayName:c.string().optional(),newName:c.string().optional(),normalTabDisplayName:c.string().optional(),onConflict:c.record(c.any()).optional(),optional:c.boolean().optional(),orderedBranchChildComponentIds:c.array(c.any()).optional(),orderedDataFieldNames:c.array(c.any()).optional(),orderedTabChildComponentIds:c.array(c.any()).optional(),pageId:c.string().optional(),pageInputCategory:c.enum(["GENERAL","URL_PATH","URL_QUERY"]).optional(),properties:c.record(c.any()).optional(),query:c.string().optional(),queryDisplayName:c.string().optional(),queryType:c.enum(["QUERY","SUBSCRIPTION"]).optional(),rootComponentId:c.string().optional(),scheduledJobId:c.string().optional(),scheduledJobIds:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional(),selectedTabDisplayName:c.string().optional(),slotField:c.string().optional(),sourceComponentId:c.string().optional(),sourceEventType:c.string().optional(),startImmediately:c.boolean().optional(),style:c.record(c.any()).optional(),tabChildComponentIds:c.array(c.any()).optional(),tableDisplayName:c.string().optional(),targetParentComponentId:c.string().optional(),typeIdentifier:c.string().optional(),uniqueIdentifierFieldPath:c.array(c.any()).optional(),variableKey:c.string().optional(),variableKeys:c.array(c.any()).optional(),variant:c.string().optional()}},{name:"schema_condition_expr",tier:"core",description:`Edit the boolean condition expression at a binding location (schemaPath). LIST_OPERATORS returns the comparisons available for a term; SET_OPERATOR sets one.
801
819
  Changes apply immediately; use schema_undo to revert the last change. Ops:
802
820
  - op=DELETE_TERM \u2014 Remove the condition at the schema path from its AND/OR group. Deleting the root or a group's only member resets that level to always-true.
803
821
  - op=DUPLICATE_CONDITION \u2014 Copy a condition \u2014 the whole AND/OR tree of a slot, or one member of it \u2014 onto another condition slot, replacing what that slot held. A reference the target cannot resolve (a variable of the source's own scope, say) is blanked rather than carried over, so re-check the new condition's operands.
@@ -819,9 +837,9 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
819
837
  - op=CLEAR \u2014 Reset the binding at the schema path to an empty one of the same type \u2014 for a value that no longer fits and should be left unset. To put a different value there instead, bind it directly: every CREATE_*_BINDING tool replaces what the slot held. The path must address the binding itself. Clearing an expression condition's \`target\` resets that whole condition to always-true (its operator and value go with it) and echoes the condition's schema path.
820
838
  - op=CONDITIONAL \u2014 Replace the binding at the schema path with a conditional binding: ordered branches of condition + value, evaluated in order \u2014 the first branch whose condition holds supplies the value. Branches start always-true with empty values: manage them with the *_CONDITIONAL_DATA tools, narrow conditions via the condition tools, fill values via the CREATE_*_BINDING tools. Result echoes the conditional binding's own schema path (the *_CONDITIONAL_DATA tools take it) and each branch's id and the schema paths of its condition and value slots.
821
839
  - op=CONST \u2014 Bind a literal constant value at the schema path.
822
- - op=FORMULA \u2014 Bind a computed formula at the schema path \u2014 pick \`operator\` from GET_FORMULA_OPERATORS, then fill the formula's argument slots via further CREATE_*_BINDING calls at their paths.
840
+ - op=FORMULA \u2014 Bind a computed formula at the schema path \u2014 pick \`operator\` from GET_FORMULA_OPERATORS, then fill the formula's argument slots via further CREATE_*_BINDING calls at their paths. enumEntries also needs \`config\` {kind: ENUM_ENTRIES, enumId} naming the enum whose options it lists; without it the call fails and lists the project's enums.
823
841
  - op=OPTION \u2014 Bind a dynamic value (variable / column / node output \u2026) at the schema path, picked from the BROWSE_DATA_BINDING_OPTIONS tree.
824
- - op=SET_FORMULA_CONFIG (req: config, schemaPath)
842
+ - op=SET_FORMULA_CONFIG \u2014 Change the scalar config of the formula at the schema path, shaped as GET_FORMULA_CONFIG_OPTIONS describes \u2014 e.g. select the enum of an enumEntries formula with {kind: ENUM_ENTRIES, enumId}.
825
843
  - op=SET_FUNCTION_BINDING_PAGE_URL_TARGET \u2014 Set the target page of a getPageUrl function binding (the global 'page url' option), which binding that option leaves unset. Re-seeds the function binding's page parameters (args) from the target page's inputs; the result echoes each parameter's schema path for the CREATE_*_BINDING tools.`,ops:{CLEAR:"CLEAR_DATA_BINDING",CONDITIONAL:"CREATE_CONDITIONAL_BINDING",CONST:"CREATE_CONST_BINDING",FORMULA:"CREATE_FORMULA_BINDING",OPTION:"CREATE_OPTION_BINDING",SET_FORMULA_CONFIG:"SET_FORMULA_CONFIG",SET_FUNCTION_BINDING_PAGE_URL_TARGET:"SET_FUNCTION_BINDING_PAGE_URL_TARGET"},inputSchema:{config:c.any().optional(),constantValue:c.any().optional(),initialBranchNames:c.array(c.any()).optional(),operation:c.enum(["REPLACE","CONCAT"]).optional(),operator:c.string().optional(),pageId:c.string().optional(),pathInHierarchicalMenu:c.array(c.any()).optional(),schemaPath:c.array(c.any()).optional()}},{name:"schema_custom_array_binding",tier:"core",description:`Add or delete items of a custom-array binding (schemaPath) \u2014 a list literal composed item by item, created by binding the Custom > Array option with schema_create_binding. ADD returns itemSchemaPaths to fill with schema_create_binding.
826
844
  Changes apply immediately; use schema_undo to revert the last change. Ops:
827
845
  - op=ADD \u2014 Append empty items to the custom-array binding (a list literal composed item by item) at the schema path \u2014 the only way to grow one, since the binding tools write existing items only. Result echoes each new item's schema path: fill it via the CREATE_*_BINDING tools, or, when the item is itself an array, grow it with this tool at that path.
@@ -847,7 +865,7 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
847
865
  - op=UPDATE_ROLE_API_PERMISSION (req: roleName)
848
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.
849
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.
850
- - 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. 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 column-comparison `where` by default; pass `whereTrack: WHERE_CONDITION` only when the user explicitly asks for the condition-expression (`whereCondition`) track. The echo's `whereTrack` is the track you passed. 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. `whereTrack` picks the track every reported whereSchemaPath addresses; it is a caller choice, not a read of the stored shape. COLUMN_WHERE (the default) addresses the column-comparison `where`, edited with the *_REQUEST_FILTER_CONDITION tools from the selectableColumns pathComponents. 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), with selectableColumns omitted because those tools reject that track. Each filter's `whereTrack` echoes the requested track. 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; 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`.\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 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:`
851
869
  Changes apply immediately; use schema_undo to revert the last change. Ops:
852
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.
853
871
  - op=DELETE_SEO_PATH_DB_QUERY (req: index, pageId, pathData)
@@ -902,8 +920,7 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
902
920
  - op=ADD_OBJECTS \u2014 Each created type echoes back the \`typeIdentifier\` to write at a typed slot \u2014 paste it verbatim, never build one by hand, and note it is not the bare id also echoed here. A public type additionally turns up in the selectable-types query of every slot that takes object types; a private one turns up in none, so that echo is the only way to name it.
903
921
  - op=ADD_OBJECT_GROUPS \u2014 Result echoes each new object-type group's minted id.
904
922
  - op=ADD_FIELDS (req: fields, typeId)
905
- - op=COPY_PRIVATE_OBJECT_AS_PUBLIC \u2014 Publish a private object type \u2014 a structure that belongs to one feature \u2014 as a reusable entry in the project's object type list, leaving the original in place. The copy is a new type with a new id: to make the feature use it, follow this call with the write that sets that slot's type (UPDATE_TYPE_DEFINITION_FIELDS for a field of another object, SET_ACTION_FLOW_OUTPUT for an action flow's output, \u2026) to the \`typeIdentifier\` echoed here.
906
- - op=COPY_PUBLIC_OBJECT_AS_PRIVATE \u2014 Take a private copy of a public object type, so one feature can diverge from the shared shape without changing it for every other user. The copy is referenced by nothing until you follow this call with the write that sets the slot's type (UPDATE_TYPE_DEFINITION_FIELDS, SET_ACTION_FLOW_OUTPUT, \u2026) to the \`typeIdentifier\` echoed here.
923
+ - op=COPY_PUBLIC_OBJECT_AS_PRIVATE \u2014 Take a private copy of a public object type, so one feature can diverge from the shared shape without changing it for every other user. The copy is an anonymous private type with a new id and is referenced by nothing until you follow this call with the write that sets the slot's type (UPDATE_TYPE_DEFINITION_FIELDS, SET_ACTION_FLOW_OUTPUT, \u2026) to the \`typeIdentifier\` echoed here. \`copiedPrivateFieldTypeIds\` lists the nested private field types copied along with it, each also under a new id; fields pointing at public types keep sharing them.
907
924
  - op=DELETE_ENUMS (req: enumIds)
908
925
  - op=DELETE_ENUM_GROUPS (req: groupIds)
909
926
  - op=DELETE_ENUM_OPTIONS \u2014 Delete options from an existing enum. Records and bindings still referencing a deleted option are left dangling.
@@ -911,21 +928,22 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
911
928
  - op=DELETE_OBJECT_GROUPS (req: groupIds)
912
929
  - op=DELETE_FIELDS (req: fieldNames, typeId)
913
930
  - op=LIST_ENUMS
914
- - op=LIST_OBJECTS \u2014 Lists every object type, including the \`private\` ones, so a feature's own structure can be read. A private type belongs to the single feature that owns it (an API's request body, a webhook's payload, an agent's output): no selectable-types list offers it, and a second slot naming it is rejected. To reuse a private type's shape, publish a copy with COPY_PRIVATE_OBJECT_TYPE_AS_PUBLIC and select that copy instead.
931
+ - op=LIST_OBJECTS \u2014 Lists every object type, including the \`private\` ones, so a feature's own structure can be read. A private type belongs to the single feature that owns it (an API's request body, a webhook's payload, an agent's output): no selectable-types list offers it, and a second slot naming it is rejected. To reuse a private type's shape, publish it with PUBLISH_OBJECT_TYPE \u2014 it joins the shared list under the same id, so the slot that owned it keeps working.
915
932
  - op=GET_ENUM_DETAIL \u2014 One enum type's options, each with the client platforms that accept it. Take the id from GET_ALL_ENUM_DEFINITIONS. Read this before wiring a specific option into an action: an action that carries an option is invalid on a client whose platform is missing from that option's \`platforms\`, and the verification-code purpose enum is the one whose options differ this way today. An option listing all three platforms is unrestricted.
916
933
  - op=GET_ENUM_GROUPS
917
934
  - op=GET_OBJECT_DETAIL \u2014 One object type's fields, each stored type resolved to the same readable names GET_ALL_OBJECT_DEFINITIONS uses, plus its \`description\` and \`private\` flag. Take the id from GET_ALL_OBJECT_DEFINITIONS, a field's resolved type, or a slot that points at the type; reading one type beats listing every type to find it.
918
935
  - op=GET_OBJECT_GROUPS
919
- - op=SELECTABLE_TYPES \u2014 List the types a field of an object type accepts. Every \`type\` ADD_OBJECT_TYPE_DEFINITIONS / ADD_TYPE_DEFINITION_FIELDS / UPDATE_TYPE_DEFINITION_FIELDS 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 COPY_PRIVATE_OBJECT_TYPE_AS_PUBLIC. Lists are not enumerated \u2014 the nesting has no end \u2014 so a list field is a listed identifier with the field's \`arrayLevel\` set (1 = list, 2 = list of lists), never brackets written into the identifier. An option comes in its optional form (\`null|\u2026\`); pass it as it comes, since a field's \`required\` flag owns that wrapper.
936
+ - op=SELECTABLE_TYPES \u2014 List the types a field of an object type accepts. Every \`type\` ADD_OBJECT_TYPE_DEFINITIONS / ADD_TYPE_DEFINITION_FIELDS / UPDATE_TYPE_DEFINITION_FIELDS 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 field is a listed identifier with the field's \`arrayLevel\` set (1 = list, 2 = list of lists), never brackets written into the identifier. An option comes in its optional form (\`null|\u2026\`); pass it as it comes, since a field's \`required\` flag owns that wrapper.
920
937
  - op=MOVE_ENUM_TO_GROUP (req: items)
921
938
  - op=MOVE_OBJECT_TO_GROUP (req: items)
939
+ - op=PUBLISH_OBJECT \u2014 Publish a private object type \u2014 a structure that belongs to one feature \u2014 as a reusable entry in the project's object type list. The type keeps its id, so the slot that owns it keeps working; every selectable-types list then offers it. Read GET_OBJECT_TYPE_DEFINITION_GROUPS first \u2014 the type joins that configuration.
922
940
  - op=REORDER_FIELDS \u2014 Reorder the fields of one object type as the editor lists them \u2014 the order a structured AI-agent output, an API body or any other slot typed by it is rendered and emitted in.
923
941
  - op=UPDATE_ENUMS (req: enums)
924
942
  - op=UPDATE_ENUM_GROUPS (req: groups)
925
943
  - op=UPDATE_ENUM_OPTIONS \u2014 Rename options of an existing enum. An option's id is permanent, so every binding that resolves to the option survives the rename; the deployed database column stores the name, not the id, and is rewritten row by row on the next backend sync.
926
944
  - op=UPDATE_OBJECTS (req: types)
927
945
  - op=UPDATE_OBJECT_GROUPS (req: groups)
928
- - op=UPDATE_FIELDS \u2014 Rename and/or retype fields of an object type in place. Renaming carries the field's references along with it; retyping away from an image / video / file or JSON type drops them, because nothing that pointed at the old shape can read the new one.`,ops:{ADD_ENUMS:"ADD_ENUM_DEFINITIONS",ADD_ENUM_GROUPS:"ADD_ENUM_DEFINITION_GROUPS",ADD_ENUM_OPTIONS:"ADD_ENUM_OPTIONS",ADD_OBJECTS:"ADD_OBJECT_TYPE_DEFINITIONS",ADD_OBJECT_GROUPS:"ADD_OBJECT_TYPE_DEFINITION_GROUPS",ADD_FIELDS:"ADD_TYPE_DEFINITION_FIELDS",COPY_PRIVATE_OBJECT_AS_PUBLIC:"COPY_PRIVATE_OBJECT_TYPE_AS_PUBLIC",COPY_PUBLIC_OBJECT_AS_PRIVATE:"COPY_PUBLIC_OBJECT_TYPE_AS_PRIVATE",DELETE_ENUMS:"DELETE_ENUM_DEFINITIONS",DELETE_ENUM_GROUPS:"DELETE_ENUM_DEFINITION_GROUPS",DELETE_ENUM_OPTIONS:"DELETE_ENUM_OPTIONS",DELETE_OBJECTS:"DELETE_OBJECT_TYPE_DEFINITIONS",DELETE_OBJECT_GROUPS:"DELETE_OBJECT_TYPE_DEFINITION_GROUPS",DELETE_FIELDS:"DELETE_TYPE_DEFINITION_FIELDS",LIST_ENUMS:"GET_ALL_ENUM_DEFINITIONS",LIST_OBJECTS:"GET_ALL_OBJECT_DEFINITIONS",GET_ENUM_DETAIL:"GET_ENUM_DEFINITION_DETAIL",GET_ENUM_GROUPS:"GET_ENUM_DEFINITION_GROUPS",GET_OBJECT_DETAIL:"GET_OBJECT_TYPE_DEFINITION_DETAIL",GET_OBJECT_GROUPS:"GET_OBJECT_TYPE_DEFINITION_GROUPS",SELECTABLE_TYPES:"GET_TYPE_DEFINITION_FIELD_SELECTABLE_TYPES",MOVE_ENUM_TO_GROUP:"MOVE_ENUM_DEFINITIONS_TO_GROUP",MOVE_OBJECT_TO_GROUP:"MOVE_OBJECT_TYPE_DEFINITIONS_TO_GROUP",REORDER_FIELDS:"REORDER_TYPE_DEFINITION_FIELDS",UPDATE_ENUMS:"UPDATE_ENUM_DEFINITIONS",UPDATE_ENUM_GROUPS:"UPDATE_ENUM_DEFINITION_GROUPS",UPDATE_ENUM_OPTIONS:"UPDATE_ENUM_OPTIONS",UPDATE_OBJECTS:"UPDATE_OBJECT_TYPE_DEFINITIONS",UPDATE_OBJECT_GROUPS:"UPDATE_OBJECT_TYPE_DEFINITION_GROUPS",UPDATE_FIELDS:"UPDATE_TYPE_DEFINITION_FIELDS"},inputSchema:{deleteTypes:c.boolean().optional(),displayName:c.string().optional(),enumId:c.string().optional(),enumIds:c.array(c.any()).optional(),enums:c.any().optional(),fieldNames:c.array(c.any()).optional(),fields:c.array(c.any()).optional(),groupId:c.string().optional(),groupIds:c.array(c.any()).optional(),groups:c.any().optional(),items:c.array(c.any()).optional(),optionIds:c.array(c.any()).optional(),options:c.array(c.any()).optional(),orderedFieldNames:c.array(c.any()).optional(),typeId:c.string().optional(),typeIds:c.array(c.any()).optional(),types:c.any().optional()}},{name:"schema_verification_code_config",tier:"catalog",description:`
946
+ - op=UPDATE_FIELDS \u2014 Rename and/or retype fields of an object type in place. Renaming carries the field's references along with it; retyping away from an image / video / file or JSON type drops them, because nothing that pointed at the old shape can read the new one.`,ops:{ADD_ENUMS:"ADD_ENUM_DEFINITIONS",ADD_ENUM_GROUPS:"ADD_ENUM_DEFINITION_GROUPS",ADD_ENUM_OPTIONS:"ADD_ENUM_OPTIONS",ADD_OBJECTS:"ADD_OBJECT_TYPE_DEFINITIONS",ADD_OBJECT_GROUPS:"ADD_OBJECT_TYPE_DEFINITION_GROUPS",ADD_FIELDS:"ADD_TYPE_DEFINITION_FIELDS",COPY_PUBLIC_OBJECT_AS_PRIVATE:"COPY_PUBLIC_OBJECT_TYPE_AS_PRIVATE",DELETE_ENUMS:"DELETE_ENUM_DEFINITIONS",DELETE_ENUM_GROUPS:"DELETE_ENUM_DEFINITION_GROUPS",DELETE_ENUM_OPTIONS:"DELETE_ENUM_OPTIONS",DELETE_OBJECTS:"DELETE_OBJECT_TYPE_DEFINITIONS",DELETE_OBJECT_GROUPS:"DELETE_OBJECT_TYPE_DEFINITION_GROUPS",DELETE_FIELDS:"DELETE_TYPE_DEFINITION_FIELDS",LIST_ENUMS:"GET_ALL_ENUM_DEFINITIONS",LIST_OBJECTS:"GET_ALL_OBJECT_DEFINITIONS",GET_ENUM_DETAIL:"GET_ENUM_DEFINITION_DETAIL",GET_ENUM_GROUPS:"GET_ENUM_DEFINITION_GROUPS",GET_OBJECT_DETAIL:"GET_OBJECT_TYPE_DEFINITION_DETAIL",GET_OBJECT_GROUPS:"GET_OBJECT_TYPE_DEFINITION_GROUPS",SELECTABLE_TYPES:"GET_TYPE_DEFINITION_FIELD_SELECTABLE_TYPES",MOVE_ENUM_TO_GROUP:"MOVE_ENUM_DEFINITIONS_TO_GROUP",MOVE_OBJECT_TO_GROUP:"MOVE_OBJECT_TYPE_DEFINITIONS_TO_GROUP",PUBLISH_OBJECT:"PUBLISH_OBJECT_TYPE",REORDER_FIELDS:"REORDER_TYPE_DEFINITION_FIELDS",UPDATE_ENUMS:"UPDATE_ENUM_DEFINITIONS",UPDATE_ENUM_GROUPS:"UPDATE_ENUM_DEFINITION_GROUPS",UPDATE_ENUM_OPTIONS:"UPDATE_ENUM_OPTIONS",UPDATE_OBJECTS:"UPDATE_OBJECT_TYPE_DEFINITIONS",UPDATE_OBJECT_GROUPS:"UPDATE_OBJECT_TYPE_DEFINITION_GROUPS",UPDATE_FIELDS:"UPDATE_TYPE_DEFINITION_FIELDS"},inputSchema:{deleteTypes:c.boolean().optional(),displayName:c.string().optional(),enumId:c.string().optional(),enumIds:c.array(c.any()).optional(),enums:c.any().optional(),fieldNames:c.array(c.any()).optional(),fields:c.array(c.any()).optional(),groupId:c.string().optional(),groupIds:c.array(c.any()).optional(),groups:c.any().optional(),items:c.array(c.any()).optional(),optionIds:c.array(c.any()).optional(),options:c.array(c.any()).optional(),orderedFieldNames:c.array(c.any()).optional(),typeId:c.string().optional(),typeIds:c.array(c.any()).optional(),types:c.any().optional()}},{name:"schema_verification_code_config",tier:"catalog",description:`
929
947
  Changes apply immediately; use schema_undo to revert the last change. Ops:
930
948
  - op=ADD_SEND_VERIFICATION_CODE_CONFIGS \u2014 Creates custom verification-code channels: each names a delivery channel and the action flow that sends the code. The flow must already exist; its declared input parameters are seeded empty and echoed as bindable schema paths. The built-in SMS and email channels are chosen on a send action, not created here.
931
949
  - op=DELETE_SEND_VERIFICATION_CODE_CONFIGS \u2014 Deletes channels by id. As in the editor, deletion does not clear the handlers that point at them: the result lists every handler whose sendVerificationCodeConfigId still names a deleted channel, which the project validator then reports.
@@ -954,7 +972,7 @@ Changes apply immediately; use schema_undo to revert the last change. Ops:
954
972
  - op=UPDATE_ZAI_CONFIG_INPUT_ARGS (req: configId, items)
955
973
  - op=UPDATE_ZAI_CONFIG_OUTPUT (req: configId)
956
974
  - op=UPDATE_ZAI_CONFIG_TOOL (req: configId, toolId)
957
- - 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"}},"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.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_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))})(),zU=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=>jn().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=>jn().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)
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)
958
976
  The deployed app's end-users obtain a JWT by logging in / registering against the same GraphQL API;
959
977
  unauthenticated requests fall back to the anonymous role. Distinct from the developer \`login\` that
960
978
  authenticates THIS CLI to ${t.brand}. ${e}
@@ -1025,68 +1043,68 @@ for exact input field casing). Confirm on the frontend with Stripe.js Elements u
1025
1043
  paymentClientSecret; stripeReadableAmount is a display-ready amount string. stripePay(payDetails)
1026
1044
  is the older variant returning the bare clientSecret string. To reconcile after confirmation, query
1027
1045
  findOrderIdByPaymentIntentId(paymentIntentId:\u2026). Stripe subscriptions and refunds are modeled in
1028
- payments.md \u2014 drive them from there.`}var tC=t=>({role:"user",content:{type:"text",text:t}}),zn=(t,e)=>({description:t,messages:[tC(e)]}),ny=()=>Xg({brand:Ps().productName,zeroApiUrl:jn().zeroApiUrlTemplate}),Dt=t=>{let e=Fg[t];if(!e)throw new Error(`runtime protocol section '${t}' missing from the plugin manifest`);return e},Do=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?`
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?`
1029
1047
 
1030
1048
  Current tables in the loaded schema:
1031
1049
  ${t}`:`
1032
1050
 
1033
- (No schema is loaded yet \u2014 call schema_session op=LOAD, then schema_table op=GET_INFOS to learn the current structure.)`;function tj(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 zn("Project inspection workflow",`Give me a briefing on ${i}.
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}.
1034
1052
 
1035
1053
  Steps:
1036
1054
  ${a&&!o?`- get_projects to resolve the exId from the name.
1037
1055
  `:""}- set_current_project to pin it, then project_inspect (op DETAIL then METADATA) for apps, config, plan/capability, deployment, and RPS.
1038
1056
  - schema_session op=LOAD and schema_table op=GET_INFOS to understand the data model.
1039
- - 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 zn("Safe schema-editing workflow",`Apply this data-model change${a?` to project ${a}`:""}: "${o}".
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}".
1040
1058
 
1041
- ${Do("database")}
1059
+ ${Ro("database")}
1042
1060
 
1043
- ${Do("type")}
1061
+ ${Ro("type")}
1044
1062
 
1045
- 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 zn("Data query workflow",`Answer this question about the project's data: "${o}".
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}".
1046
1064
 
1047
- ${Dt("query-language")}
1065
+ ${Rt("query-language")}
1048
1066
 
1049
- ${Dt("filter-grammar")}
1067
+ ${Rt("filter-grammar")}
1050
1068
 
1051
- ${Dt("aggregations")}
1069
+ ${Rt("aggregations")}
1052
1070
 
1053
- ${Dt("formula-catalog")}
1071
+ ${Rt("formula-catalog")}
1054
1072
 
1055
- ${Dt("runtime-enums")}
1073
+ ${Rt("runtime-enums")}
1056
1074
 
1057
1075
  ${Qg(s)}
1058
1076
 
1059
1077
  ${ey()}
1060
1078
 
1061
- 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 zn("Actionflow / AI agent / API / payment invocation workflow",`Goal: "${o}".
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}".
1062
1080
 
1063
1081
  First read the project schema (project_inspect op=DETAIL / schema_session op=LOAD) to find the
1064
1082
  actionflow / agent / API id, its version, and its input argument names. Then invoke it via
1065
1083
  runtime_graphql against the runtime endpoint${a?` (${Ps().runtimeGraphqlUrl(a)})`:""}.
1066
1084
 
1067
- ${Dt("actionflow-invocation")}
1085
+ ${Rt("actionflow-invocation")}
1068
1086
 
1069
- ${Dt("ai-agent-invocation")}
1087
+ ${Rt("ai-agent-invocation")}
1070
1088
 
1071
- ${Dt("api-invocation")}
1089
+ ${Rt("api-invocation")}
1072
1090
 
1073
- ${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()=>zn("Binary asset upload workflow",`Upload a binary asset and reference it from a row.
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.
1074
1092
 
1075
- ${Dt("asset-upload")}
1093
+ ${Rt("asset-upload")}
1076
1094
 
1077
1095
  Run the presigned-URL mutation through runtime_graphql, perform the PUT yourself, then
1078
- 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}".
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}".
1079
1097
 
1080
- ${Do("permissions")}
1098
+ ${Ro("permissions")}
1081
1099
 
1082
- ${Do("logs")}
1100
+ ${Ro("logs")}
1083
1101
 
1084
1102
  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
1085
1103
  runtime_graphql read. State exactly which editor Settings change (and whether a
1086
- 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}".
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}".
1087
1105
 
1088
- ${Do("logs")}
1106
+ ${Ro("logs")}
1089
1107
 
1090
1108
  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
1091
1109
  configuration mistakes from platform bugs, and state exactly which editor change or sync_backend
1092
- step is needed to fix it.`))}export{aC as a,cy as b,fy as c,kt as d,sC as e,jn as f,uC as g,c as h,NU as i,Eu as j,qP as k,VP as l,Xe as m,jt as n,Ft as o,Hc as p,Pp as q,$ as r,LD 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,UD as I,zw 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,tj as _};
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 _};