vibelearn 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +630 -0
- package/README.md +287 -0
- package/package.json +129 -0
- package/plugin/.claude-plugin/CLAUDE.md +4 -0
- package/plugin/.claude-plugin/plugin.json +23 -0
- package/plugin/.cli-installed +1 -0
- package/plugin/CLAUDE.md +6 -0
- package/plugin/hooks/CLAUDE.md +6 -0
- package/plugin/hooks/bugfixes-2026-01-10.md +92 -0
- package/plugin/hooks/hooks.json +79 -0
- package/plugin/modes/code--ar.json +24 -0
- package/plugin/modes/code--bn.json +24 -0
- package/plugin/modes/code--chill.json +8 -0
- package/plugin/modes/code--cs.json +24 -0
- package/plugin/modes/code--da.json +24 -0
- package/plugin/modes/code--de.json +24 -0
- package/plugin/modes/code--el.json +24 -0
- package/plugin/modes/code--es.json +24 -0
- package/plugin/modes/code--fi.json +24 -0
- package/plugin/modes/code--fr.json +24 -0
- package/plugin/modes/code--he.json +24 -0
- package/plugin/modes/code--hi.json +24 -0
- package/plugin/modes/code--hu.json +24 -0
- package/plugin/modes/code--id.json +24 -0
- package/plugin/modes/code--it.json +24 -0
- package/plugin/modes/code--ja.json +24 -0
- package/plugin/modes/code--ko.json +24 -0
- package/plugin/modes/code--nl.json +24 -0
- package/plugin/modes/code--no.json +24 -0
- package/plugin/modes/code--pl.json +24 -0
- package/plugin/modes/code--pt-br.json +24 -0
- package/plugin/modes/code--ro.json +24 -0
- package/plugin/modes/code--ru.json +24 -0
- package/plugin/modes/code--sv.json +24 -0
- package/plugin/modes/code--th.json +24 -0
- package/plugin/modes/code--tr.json +24 -0
- package/plugin/modes/code--uk.json +24 -0
- package/plugin/modes/code--ur.json +25 -0
- package/plugin/modes/code--vi.json +24 -0
- package/plugin/modes/code--zh.json +24 -0
- package/plugin/modes/code.json +125 -0
- package/plugin/modes/email-investigation.json +120 -0
- package/plugin/modes/law-study--chill.json +7 -0
- package/plugin/modes/law-study-CLAUDE.md +85 -0
- package/plugin/modes/law-study.json +120 -0
- package/plugin/package.json +23 -0
- package/plugin/scripts/CLAUDE.md +5 -0
- package/plugin/scripts/bun-runner.js +176 -0
- package/plugin/scripts/mcp-server.cjs +141 -0
- package/plugin/scripts/smart-install.js +592 -0
- package/plugin/scripts/statusline-counts.js +61 -0
- package/plugin/scripts/vl-cli.cjs +104 -0
- package/plugin/scripts/worker-cli.js +19 -0
- package/plugin/scripts/worker-service.cjs +1919 -0
- package/plugin/scripts/worker-wrapper.cjs +2 -0
- package/plugin/skills/smart-explore/SKILL.md +145 -0
- package/plugin/skills/timeline-report/SKILL.md +91 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";var g$=Object.create;var As=Object.defineProperty;var v$=Object.getOwnPropertyDescriptor;var _$=Object.getOwnPropertyNames;var y$=Object.getPrototypeOf,$$=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),In=(t,e)=>{for(var r in e)As(t,r,{get:e[r],enumerable:!0})},b$=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _$(e))!$$.call(t,o)&&o!==r&&As(t,o,{get:()=>e[o],enumerable:!(n=v$(e,o))||n.enumerable});return t};var vi=(t,e,r)=>(r=t!=null?g$(y$(t)):{},b$(e||!t||!t.__esModule?As(r,"default",{value:t,enumerable:!0}):r,t));var Lo=S(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.regexpCode=re.getEsmExportName=re.getProperty=re.safeStringify=re.stringify=re.strConcat=re.addCodeArg=re.str=re._=re.nil=re._Code=re.Name=re.IDENTIFIER=re._CodeOrName=void 0;var Uo=class{};re._CodeOrName=Uo;re.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var xr=class extends Uo{constructor(e){if(super(),!re.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}}};re.Name=xr;var it=class extends Uo{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof xr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};re._Code=it;re.nil=new it("");function ov(t,...e){let r=[t[0]],n=0;for(;n<e.length;)jd(r,e[n]),r.push(t[++n]);return new it(r)}re._=ov;var Od=new it("+");function iv(t,...e){let r=[Mo(t[0])],n=0;for(;n<e.length;)r.push(Od),jd(r,e[n]),r.push(Od,Mo(t[++n]));return cw(r),new it(r)}re.str=iv;function jd(t,e){e instanceof it?t.push(...e._items):e instanceof xr?t.push(e):t.push(dw(e))}re.addCodeArg=jd;function cw(t){let e=1;for(;e<t.length-1;){if(t[e]===Od){let r=uw(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function uw(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof xr||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 xr))return`"${t}${e.slice(1)}`}function lw(t,e){return e.emptyStr()?t:t.emptyStr()?e:iv`${t}${e}`}re.strConcat=lw;function dw(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Mo(Array.isArray(t)?t.join(","):t)}function pw(t){return new it(Mo(t))}re.stringify=pw;function Mo(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}re.safeStringify=Mo;function fw(t){return typeof t=="string"&&re.IDENTIFIER.test(t)?new it(`.${t}`):ov`[${t}]`}re.getProperty=fw;function mw(t){if(typeof t=="string"&&re.IDENTIFIER.test(t))return new it(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}re.getEsmExportName=mw;function hw(t){return new it(t.toString())}re.regexpCode=hw});var Dd=S(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.ValueScope=Fe.ValueScopeName=Fe.Scope=Fe.varKinds=Fe.UsedValueState=void 0;var Ve=Lo(),Nd=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||(Fe.UsedValueState=Ma={}));Fe.varKinds={const:new Ve.Name("const"),let:new Ve.Name("let"),var:new Ve.Name("var")};var La=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ve.Name?e:this.name(e)}name(e){return new Ve.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};Fe.Scope=La;var qa=class extends Ve.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ve._)`.${new Ve.Name(r)}[${n}]`}};Fe.ValueScopeName=qa;var gw=(0,Ve._)`\n`,Rd=class extends La{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?gw:Ve.nil}}get(){return this._scope}name(e){return new qa(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ve._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=Ve.nil;for(let a in e){let s=e[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,Ma.Started);let l=r(u);if(l){let d=this.opts.es5?Fe.varKinds.var:Fe.varKinds.const;i=(0,Ve._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Ve._)`${i}${l}${this.opts._n}`;else throw new Nd(u);c.set(u,Ma.Completed)})}return i}};Fe.ValueScope=Rd});var B=S(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.or=K.and=K.not=K.CodeGen=K.operators=K.varKinds=K.ValueScopeName=K.ValueScope=K.Scope=K.Name=K.regexpCode=K.stringify=K.getProperty=K.nil=K.strConcat=K.str=K._=void 0;var Q=Lo(),pt=Dd(),ir=Lo();Object.defineProperty(K,"_",{enumerable:!0,get:function(){return ir._}});Object.defineProperty(K,"str",{enumerable:!0,get:function(){return ir.str}});Object.defineProperty(K,"strConcat",{enumerable:!0,get:function(){return ir.strConcat}});Object.defineProperty(K,"nil",{enumerable:!0,get:function(){return ir.nil}});Object.defineProperty(K,"getProperty",{enumerable:!0,get:function(){return ir.getProperty}});Object.defineProperty(K,"stringify",{enumerable:!0,get:function(){return ir.stringify}});Object.defineProperty(K,"regexpCode",{enumerable:!0,get:function(){return ir.regexpCode}});Object.defineProperty(K,"Name",{enumerable:!0,get:function(){return ir.Name}});var Ba=Dd();Object.defineProperty(K,"Scope",{enumerable:!0,get:function(){return Ba.Scope}});Object.defineProperty(K,"ValueScope",{enumerable:!0,get:function(){return Ba.ValueScope}});Object.defineProperty(K,"ValueScopeName",{enumerable:!0,get:function(){return Ba.ValueScopeName}});Object.defineProperty(K,"varKinds",{enumerable:!0,get:function(){return Ba.varKinds}});K.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var Mt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Ad=class extends Mt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?pt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=un(this.rhs,e,r)),this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},Va=class extends Mt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Q.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=un(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Q.Name?{}:{...this.lhs.names};return Ja(e,this.rhs)}},Zd=class extends Va{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Cd=class extends Mt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Ud=class extends Mt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Md=class extends Mt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Ld=class extends Mt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=un(this.code,e,r),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},qo=class extends Mt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(vw(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>wr(e,r.names),{})}},Lt=class extends qo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},qd=class extends qo{},cn=class extends Lt{};cn.kind="else";var kr=class t extends Lt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new cn(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(av(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=un(this.condition,e,r),this}get names(){let e=super.names;return Ja(e,this.condition),this.else&&wr(e,this.else.names),e}};kr.kind="if";var Sr=class extends Lt{};Sr.kind="for";var Vd=class extends Sr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=un(this.iteration,e,r),this}get names(){return wr(super.names,this.iteration.names)}},Fd=class extends Sr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?pt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=Ja(super.names,this.from);return Ja(e,this.to)}},Fa=class extends Sr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=un(this.iterable,e,r),this}get names(){return wr(super.names,this.iterable.names)}},Vo=class extends Lt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Vo.kind="func";var Fo=class extends qo{render(e){return"return "+super.render(e)}};Fo.kind="return";var Jd=class extends Lt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&wr(e,this.catch.names),this.finally&&wr(e,this.finally.names),e}},Jo=class extends Lt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Jo.kind="catch";var Bo=class extends Lt{render(e){return"finally"+super.render(e)}};Bo.kind="finally";var Bd=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new pt.Scope({parent:e}),this._nodes=[new qd]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Ad(e,i,n)),i}const(e,r,n){return this._def(pt.varKinds.const,e,r,n)}let(e,r,n){return this._def(pt.varKinds.let,e,r,n)}var(e,r,n){return this._def(pt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Va(e,r,n))}add(e,r){return this._leafNode(new Zd(e,K.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Q.nil&&this._leafNode(new Ld(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Q.addCodeArg)(r,o));return r.push("}"),new Q._Code(r)}if(e,r,n){if(this._blockNode(new kr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new kr(e))}else(){return this._elseNode(new cn)}endIf(){return this._endBlockNode(kr,cn)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Vd(e),r)}forRange(e,r,n,o,i=this.opts.es5?pt.varKinds.var:pt.varKinds.let){let a=this._scope.toName(e);return this._for(new Fd(i,a,r,n),()=>o(a))}forOf(e,r,n,o=pt.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let a=r instanceof Q.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Q._)`${a}.length`,s=>{this.var(i,(0,Q._)`${a}[${s}]`),n(i)})}return this._for(new Fa("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?pt.varKinds.var:pt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Q._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Fa("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Sr)}label(e){return this._leafNode(new Cd(e))}break(e){return this._leafNode(new Ud(e))}return(e){let r=new Fo;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Fo)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Jd;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Jo(i),r(i)}return n&&(this._currNode=o.finally=new Bo,this.code(n)),this._endBlockNode(Jo,Bo)}throw(e){return this._leafNode(new Md(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Q.nil,n,o){return this._blockNode(new Vo(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Vo)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof kr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};K.CodeGen=Bd;function wr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Ja(t,e){return e instanceof Q._CodeOrName?wr(t,e.names):t}function un(t,e,r){if(t instanceof Q.Name)return n(t);if(!o(t))return t;return new Q._Code(t._items.reduce((i,a)=>(a instanceof Q.Name&&(a=n(a)),a instanceof Q._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||e[i.str]!==1?i:(delete e[i.str],a)}function o(i){return i instanceof Q._Code&&i._items.some(a=>a instanceof Q.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function vw(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function av(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Q._)`!${Wd(t)}`}K.not=av;var _w=sv(K.operators.AND);function yw(...t){return t.reduce(_w)}K.and=yw;var $w=sv(K.operators.OR);function bw(...t){return t.reduce($w)}K.or=bw;function sv(t){return(e,r)=>e===Q.nil?r:r===Q.nil?e:(0,Q._)`${Wd(e)} ${t} ${Wd(r)}`}function Wd(t){return t instanceof Q.Name?t:(0,Q._)`(${t})`}});var ee=S(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.checkStrictMode=H.getErrorPath=H.Type=H.useFunc=H.setEvaluated=H.evaluatedPropsToName=H.mergeEvaluated=H.eachItem=H.unescapeJsonPointer=H.escapeJsonPointer=H.escapeFragment=H.unescapeFragment=H.schemaRefOrVal=H.schemaHasRulesButRef=H.schemaHasRules=H.checkUnknownRules=H.alwaysValidSchema=H.toHash=void 0;var le=B(),xw=Lo();function kw(t){let e={};for(let r of t)e[r]=!0;return e}H.toHash=kw;function Sw(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(lv(t,e),!dv(e,t.self.RULES.all))}H.alwaysValidSchema=Sw;function lv(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||mv(t,`unknown keyword: "${i}"`)}H.checkUnknownRules=lv;function dv(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}H.schemaHasRules=dv;function ww(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}H.schemaHasRulesButRef=ww;function zw({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,le._)`${r}`}return(0,le._)`${t}${e}${(0,le.getProperty)(n)}`}H.schemaRefOrVal=zw;function Iw(t){return pv(decodeURIComponent(t))}H.unescapeFragment=Iw;function Ew(t){return encodeURIComponent(Gd(t))}H.escapeFragment=Ew;function Gd(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}H.escapeJsonPointer=Gd;function pv(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}H.unescapeJsonPointer=pv;function Tw(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}H.eachItem=Tw;function cv({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof le.Name?(i instanceof le.Name?t(o,i,a):e(o,i,a),a):i instanceof le.Name?(e(o,a,i),i):r(i,a);return s===le.Name&&!(c instanceof le.Name)?n(o,c):c}}H.mergeEvaluated={props:cv({mergeNames:(t,e,r)=>t.if((0,le._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,le._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,le._)`${r} || {}`).code((0,le._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,le._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,le._)`${r} || {}`),Hd(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:fv}),items:cv({mergeNames:(t,e,r)=>t.if((0,le._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,le._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,le._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,le._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function fv(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,le._)`{}`);return e!==void 0&&Hd(t,r,e),r}H.evaluatedPropsToName=fv;function Hd(t,e,r){Object.keys(r).forEach(n=>t.assign((0,le._)`${e}${(0,le.getProperty)(n)}`,!0))}H.setEvaluated=Hd;var uv={};function Pw(t,e){return t.scopeValue("func",{ref:e,code:uv[e.code]||(uv[e.code]=new xw._Code(e.code))})}H.useFunc=Pw;var Kd;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Kd||(H.Type=Kd={}));function Ow(t,e,r){if(t instanceof le.Name){let n=e===Kd.Num;return r?n?(0,le._)`"[" + ${t} + "]"`:(0,le._)`"['" + ${t} + "']"`:n?(0,le._)`"/" + ${t}`:(0,le._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,le.getProperty)(t).toString():"/"+Gd(t)}H.getErrorPath=Ow;function mv(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}H.checkStrictMode=mv});var qt=S(Xd=>{"use strict";Object.defineProperty(Xd,"__esModule",{value:!0});var Oe=B(),jw={data:new Oe.Name("data"),valCxt:new Oe.Name("valCxt"),instancePath:new Oe.Name("instancePath"),parentData:new Oe.Name("parentData"),parentDataProperty:new Oe.Name("parentDataProperty"),rootData:new Oe.Name("rootData"),dynamicAnchors:new Oe.Name("dynamicAnchors"),vErrors:new Oe.Name("vErrors"),errors:new Oe.Name("errors"),this:new Oe.Name("this"),self:new Oe.Name("self"),scope:new Oe.Name("scope"),json:new Oe.Name("json"),jsonPos:new Oe.Name("jsonPos"),jsonLen:new Oe.Name("jsonLen"),jsonPart:new Oe.Name("jsonPart")};Xd.default=jw});var Wo=S(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.extendErrors=je.resetErrorsCount=je.reportExtraError=je.reportError=je.keyword$DataError=je.keywordError=void 0;var te=B(),Wa=ee(),Ue=qt();je.keywordError={message:({keyword:t})=>(0,te.str)`must pass "${t}" keyword validation`};je.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,te.str)`"${t}" keyword must be ${e} ($data)`:(0,te.str)`"${t}" keyword is invalid ($data)`};function Nw(t,e=je.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:a,allErrors:s}=o,c=vv(t,e,r);n??(a||s)?hv(i,c):gv(o,(0,te._)`[${c}]`)}je.reportError=Nw;function Rw(t,e=je.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:a}=n,s=vv(t,e,r);hv(o,s),i||a||gv(n,Ue.default.vErrors)}je.reportExtraError=Rw;function Dw(t,e){t.assign(Ue.default.errors,e),t.if((0,te._)`${Ue.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,te._)`${Ue.default.vErrors}.length`,e),()=>t.assign(Ue.default.vErrors,null)))}je.resetErrorsCount=Dw;function Aw({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",o,Ue.default.errors,s=>{t.const(a,(0,te._)`${Ue.default.vErrors}[${s}]`),t.if((0,te._)`${a}.instancePath === undefined`,()=>t.assign((0,te._)`${a}.instancePath`,(0,te.strConcat)(Ue.default.instancePath,i.errorPath))),t.assign((0,te._)`${a}.schemaPath`,(0,te.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,te._)`${a}.schema`,r),t.assign((0,te._)`${a}.data`,n))})}je.extendErrors=Aw;function hv(t,e){let r=t.const("err",e);t.if((0,te._)`${Ue.default.vErrors} === null`,()=>t.assign(Ue.default.vErrors,(0,te._)`[${r}]`),(0,te._)`${Ue.default.vErrors}.push(${r})`),t.code((0,te._)`${Ue.default.errors}++`)}function gv(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,te._)`new ${t.ValidationError}(${e})`):(r.assign((0,te._)`${n}.errors`,e),r.return(!1))}var zr={keyword:new te.Name("keyword"),schemaPath:new te.Name("schemaPath"),params:new te.Name("params"),propertyName:new te.Name("propertyName"),message:new te.Name("message"),schema:new te.Name("schema"),parentSchema:new te.Name("parentSchema")};function vv(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,te._)`{}`:Zw(t,e,r)}function Zw(t,e,r={}){let{gen:n,it:o}=t,i=[Cw(o,r),Uw(t,r)];return Mw(t,e,i),n.object(...i)}function Cw({errorPath:t},{instancePath:e}){let r=e?(0,te.str)`${t}${(0,Wa.getErrorPath)(e,Wa.Type.Str)}`:t;return[Ue.default.instancePath,(0,te.strConcat)(Ue.default.instancePath,r)]}function Uw({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,te.str)`${e}/${t}`;return r&&(o=(0,te.str)`${o}${(0,Wa.getErrorPath)(r,Wa.Type.Str)}`),[zr.schemaPath,o]}function Mw(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([zr.keyword,o],[zr.params,typeof e=="function"?e(t):e||(0,te._)`{}`]),c.messages&&n.push([zr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([zr.schema,a],[zr.parentSchema,(0,te._)`${l}${d}`],[Ue.default.data,i]),u&&n.push([zr.propertyName,u])}});var yv=S(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.boolOrEmptySchema=ln.topBoolOrEmptySchema=void 0;var Lw=Wo(),qw=B(),Vw=qt(),Fw={message:"boolean schema is false"};function Jw(t){let{gen:e,schema:r,validateName:n}=t;r===!1?_v(t,!1):typeof r=="object"&&r.$async===!0?e.return(Vw.default.data):(e.assign((0,qw._)`${n}.errors`,null),e.return(!0))}ln.topBoolOrEmptySchema=Jw;function Bw(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),_v(t)):r.var(e,!0)}ln.boolOrEmptySchema=Bw;function _v(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Lw.reportError)(o,Fw,void 0,e)}});var Yd=S(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.getRules=dn.isJSONType=void 0;var Ww=["string","number","integer","boolean","null","object","array"],Kw=new Set(Ww);function Gw(t){return typeof t=="string"&&Kw.has(t)}dn.isJSONType=Gw;function Hw(){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:{}}}dn.getRules=Hw});var Qd=S(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.shouldUseRule=ar.shouldUseGroup=ar.schemaHasRulesForType=void 0;function Xw({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&$v(t,n)}ar.schemaHasRulesForType=Xw;function $v(t,e){return e.rules.some(r=>bv(t,r))}ar.shouldUseGroup=$v;function bv(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}ar.shouldUseRule=bv});var Ko=S(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.reportTypeError=Ne.checkDataTypes=Ne.checkDataType=Ne.coerceAndCheckDataType=Ne.getJSONTypes=Ne.getSchemaTypes=Ne.DataType=void 0;var Yw=Yd(),Qw=Qd(),e0=Wo(),J=B(),xv=ee(),pn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(pn||(Ne.DataType=pn={}));function t0(t){let e=kv(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}Ne.getSchemaTypes=t0;function kv(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Yw.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ne.getJSONTypes=kv;function r0(t,e){let{gen:r,data:n,opts:o}=t,i=n0(e,o.coerceTypes),a=e.length>0&&!(i.length===0&&e.length===1&&(0,Qw.schemaHasRulesForType)(t,e[0]));if(a){let s=tp(e,n,o.strictNumbers,pn.Wrong);r.if(s,()=>{i.length?o0(t,e,i):rp(t)})}return a}Ne.coerceAndCheckDataType=r0;var Sv=new Set(["string","number","integer","boolean","null"]);function n0(t,e){return e?t.filter(r=>Sv.has(r)||e==="array"&&r==="array"):[]}function o0(t,e,r){let{gen:n,data:o,opts:i}=t,a=n.let("dataType",(0,J._)`typeof ${o}`),s=n.let("coerced",(0,J._)`undefined`);i.coerceTypes==="array"&&n.if((0,J._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,J._)`${o}[0]`).assign(a,(0,J._)`typeof ${o}`).if(tp(e,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,J._)`${s} !== undefined`);for(let u of r)(Sv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),rp(t),n.endIf(),n.if((0,J._)`${s} !== undefined`,()=>{n.assign(o,s),i0(t,s)});function c(u){switch(u){case"string":n.elseIf((0,J._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,J._)`"" + ${o}`).elseIf((0,J._)`${o} === null`).assign(s,(0,J._)`""`);return;case"number":n.elseIf((0,J._)`${a} == "boolean" || ${o} === null
|
|
4
|
+
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,J._)`+${o}`);return;case"integer":n.elseIf((0,J._)`${a} === "boolean" || ${o} === null
|
|
5
|
+
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,J._)`+${o}`);return;case"boolean":n.elseIf((0,J._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,J._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,J._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,J._)`${a} === "string" || ${a} === "number"
|
|
6
|
+
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,J._)`[${o}]`)}}}function i0({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,J._)`${e} !== undefined`,()=>t.assign((0,J._)`${e}[${r}]`,n))}function ep(t,e,r,n=pn.Correct){let o=n===pn.Correct?J.operators.EQ:J.operators.NEQ,i;switch(t){case"null":return(0,J._)`${e} ${o} null`;case"array":i=(0,J._)`Array.isArray(${e})`;break;case"object":i=(0,J._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=a((0,J._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=a();break;default:return(0,J._)`typeof ${e} ${o} ${t}`}return n===pn.Correct?i:(0,J.not)(i);function a(s=J.nil){return(0,J.and)((0,J._)`typeof ${e} == "number"`,s,r?(0,J._)`isFinite(${e})`:J.nil)}}Ne.checkDataType=ep;function tp(t,e,r,n){if(t.length===1)return ep(t[0],e,r,n);let o,i=(0,xv.toHash)(t);if(i.array&&i.object){let a=(0,J._)`typeof ${e} != "object"`;o=i.null?a:(0,J._)`!${e} || ${a}`,delete i.null,delete i.array,delete i.object}else o=J.nil;i.number&&delete i.integer;for(let a in i)o=(0,J.and)(o,ep(a,e,r,n));return o}Ne.checkDataTypes=tp;var a0={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,J._)`{type: ${t}}`:(0,J._)`{type: ${e}}`};function rp(t){let e=s0(t);(0,e0.reportError)(e,a0)}Ne.reportTypeError=rp;function s0(t){let{gen:e,data:r,schema:n}=t,o=(0,xv.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var zv=S(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.assignDefaults=void 0;var fn=B(),c0=ee();function u0(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)wv(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>wv(t,i,o.default))}Ka.assignDefaults=u0;function wv(t,e,r){let{gen:n,compositeRule:o,data:i,opts:a}=t;if(r===void 0)return;let s=(0,fn._)`${i}${(0,fn.getProperty)(e)}`;if(o){(0,c0.checkStrictMode)(t,`default is ignored for: ${s}`);return}let c=(0,fn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,fn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,fn._)`${s} = ${(0,fn.stringify)(r)}`)}});var at=S(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;var he=B(),np=ee(),sr=qt(),l0=ee();function d0(t,e){let{gen:r,data:n,it:o}=t;r.if(ip(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,he._)`${e}`},!0),t.error()})}ae.checkReportMissingProp=d0;function p0({gen:t,data:e,it:{opts:r}},n,o){return(0,he.or)(...n.map(i=>(0,he.and)(ip(t,e,i,r.ownProperties),(0,he._)`${o} = ${i}`)))}ae.checkMissingProp=p0;function f0(t,e){t.setParams({missingProperty:e},!0),t.error()}ae.reportMissingProp=f0;function Iv(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,he._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=Iv;function op(t,e,r){return(0,he._)`${Iv(t)}.call(${e}, ${r})`}ae.isOwnProperty=op;function m0(t,e,r,n){let o=(0,he._)`${e}${(0,he.getProperty)(r)} !== undefined`;return n?(0,he._)`${o} && ${op(t,e,r)}`:o}ae.propertyInData=m0;function ip(t,e,r,n){let o=(0,he._)`${e}${(0,he.getProperty)(r)} === undefined`;return n?(0,he.or)(o,(0,he.not)(op(t,e,r))):o}ae.noPropertyInData=ip;function Ev(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ae.allSchemaProperties=Ev;function h0(t,e){return Ev(e).filter(r=>!(0,np.alwaysValidSchema)(t,e[r]))}ae.schemaProperties=h0;function g0({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,he._)`${t}, ${e}, ${n}${o}`:e,d=[[sr.default.instancePath,(0,he.strConcat)(sr.default.instancePath,i)],[sr.default.parentData,a.parentData],[sr.default.parentDataProperty,a.parentDataProperty],[sr.default.rootData,sr.default.rootData]];a.opts.dynamicRef&&d.push([sr.default.dynamicAnchors,sr.default.dynamicAnchors]);let p=(0,he._)`${l}, ${r.object(...d)}`;return c!==he.nil?(0,he._)`${s}.call(${c}, ${p})`:(0,he._)`${s}(${p})`}ae.callValidateCode=g0;var v0=(0,he._)`new RegExp`;function _0({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,he._)`${o.code==="new RegExp"?v0:(0,l0.useFunc)(t,o)}(${r}, ${n})`})}ae.usePattern=_0;function y0(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let s=e.let("valid",!0);return a(()=>e.assign(s,!1)),s}return e.var(i,!0),a(()=>e.break()),i;function a(s){let c=e.const("len",(0,he._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:np.Type.Num},i),e.if((0,he.not)(i),s)})}}ae.validateArray=y0;function $0(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,np.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);e.assign(a,(0,he._)`${a} || ${s}`),t.mergeValidEvaluated(l,s)||e.if((0,he.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}ae.validateUnion=$0});var Ov=S($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.validateKeywordUsage=$t.validSchemaType=$t.funcKeywordCode=$t.macroKeywordCode=void 0;var Me=B(),Ir=qt(),b0=at(),x0=Wo();function k0(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=t,s=e.macro.call(a.self,o,i,a),c=Pv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");t.subschema({schema:s,schemaPath:Me.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}$t.macroKeywordCode=k0;function S0(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=t;z0(c,e);let u=!s&&e.compile?e.compile.call(c.self,i,a,c):e.validate,l=Pv(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)h(),e.modifying&&Tv(t),_(()=>t.error());else{let b=e.async?f():g();e.modifying&&Tv(t),_(()=>w0(t,b))}}function f(){let b=n.let("ruleErrs",null);return n.try(()=>h((0,Me._)`await `),E=>n.assign(d,!1).if((0,Me._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Me._)`${E}.errors`),()=>n.throw(E))),b}function g(){let b=(0,Me._)`${l}.errors`;return n.assign(b,null),h(Me.nil),b}function h(b=e.async?(0,Me._)`await `:Me.nil){let E=c.opts.passContext?Ir.default.this:Ir.default.self,I=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Me._)`${b}${(0,b0.callValidateCode)(t,l,E,I)}`,e.modifying)}function _(b){var E;n.if((0,Me.not)((E=e.valid)!==null&&E!==void 0?E:d),b)}}$t.funcKeywordCode=S0;function Tv(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Me._)`${n.parentData}[${n.parentDataProperty}]`))}function w0(t,e){let{gen:r}=t;r.if((0,Me._)`Array.isArray(${e})`,()=>{r.assign(Ir.default.vErrors,(0,Me._)`${Ir.default.vErrors} === null ? ${e} : ${Ir.default.vErrors}.concat(${e})`).assign(Ir.default.errors,(0,Me._)`${Ir.default.vErrors}.length`),(0,x0.extendErrors)(t)},()=>t.error())}function z0({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Pv(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Me.stringify)(r)})}function I0(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}$t.validSchemaType=I0;function E0({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}$t.validateKeywordUsage=E0});var Nv=S(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.extendSubschemaMode=cr.extendSubschemaData=cr.getSubschema=void 0;var bt=B(),jv=ee();function T0(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,bt._)`${t.schemaPath}${(0,bt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,bt._)`${t.schemaPath}${(0,bt.getProperty)(e)}${(0,bt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,jv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}cr.getSubschema=T0;function P0(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=s.let("data",(0,bt._)`${e.data}${(0,bt.getProperty)(r)}`,!0);c(p),t.errorPath=(0,bt.str)`${u}${(0,jv.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,bt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof bt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(t.propertyName=a)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}cr.extendSubschemaData=P0;function O0(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}cr.extendSubschemaMode=O0});var ap=S((dC,Rv)=>{"use strict";Rv.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var Av=S((pC,Dv)=>{"use strict";var ur=Dv.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Ga(e,n,o,t,"",t)};ur.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ur.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ur.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ur.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 Ga(t,e,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ur.arrayKeywords)for(var p=0;p<d.length;p++)Ga(t,e,r,d[p],o+"/"+l+"/"+p,i,o,l,n,p)}else if(l in ur.propsKeywords){if(d&&typeof d=="object")for(var f in d)Ga(t,e,r,d[f],o+"/"+l+"/"+j0(f),i,o,l,n,f)}else(l in ur.keywords||t.allKeys&&!(l in ur.skipKeywords))&&Ga(t,e,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function j0(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Go=S(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.getSchemaRefs=Je.resolveUrl=Je.normalizeId=Je._getFullPath=Je.getFullPath=Je.inlineRef=void 0;var N0=ee(),R0=ap(),D0=Av(),A0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Z0(t,e=!0){return typeof t=="boolean"?!0:e===!0?!sp(t):e?Zv(t)<=e:!1}Je.inlineRef=Z0;var C0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function sp(t){for(let e in t){if(C0.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(sp)||typeof r=="object"&&sp(r))return!0}return!1}function Zv(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!A0.has(r)&&(typeof t[r]=="object"&&(0,N0.eachItem)(t[r],n=>e+=Zv(n)),e===1/0))return 1/0}return e}function Cv(t,e="",r){r!==!1&&(e=mn(e));let n=t.parse(e);return Uv(t,n)}Je.getFullPath=Cv;function Uv(t,e){return t.serialize(e).split("#")[0]+"#"}Je._getFullPath=Uv;var U0=/#\/?$/;function mn(t){return t?t.replace(U0,""):""}Je.normalizeId=mn;function M0(t,e,r){return r=mn(r),t.resolve(e,r)}Je.resolveUrl=M0;var L0=/^[a-z_][-a-z0-9._]*$/i;function q0(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=mn(t[r]||e),i={"":o},a=Cv(n,o,!1),s={},c=new Set;return D0(t,{allKeys:!0},(d,p,f,g)=>{if(g===void 0)return;let h=a+p,_=i[g];typeof d[r]=="string"&&(_=b.call(this,d[r])),E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),i[p]=_;function b(I){let A=this.opts.uriResolver.resolve;if(I=mn(_?A(_,I):I),c.has(I))throw l(I);c.add(I);let j=this.refs[I];return typeof j=="string"&&(j=this.refs[j]),typeof j=="object"?u(d,j.schema,I):I!==mn(h)&&(I[0]==="#"?(u(d,s[I],I),s[I]=d):this.refs[I]=h),I}function E(I){if(typeof I=="string"){if(!L0.test(I))throw new Error(`invalid anchor "${I}"`);b.call(this,`#${I}`)}}}),s;function u(d,p,f){if(p!==void 0&&!R0(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Je.getSchemaRefs=q0});var Yo=S(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.getData=lr.KeywordCxt=lr.validateFunctionCode=void 0;var Fv=yv(),Mv=Ko(),up=Qd(),Ha=Ko(),V0=zv(),Xo=Ov(),cp=Nv(),O=B(),U=qt(),F0=Go(),Vt=ee(),Ho=Wo();function J0(t){if(Wv(t)&&(Kv(t),Bv(t))){K0(t);return}Jv(t,()=>(0,Fv.topBoolOrEmptySchema)(t))}lr.validateFunctionCode=J0;function Jv({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,O._)`${U.default.data}, ${U.default.valCxt}`,n.$async,()=>{t.code((0,O._)`"use strict"; ${Lv(r,o)}`),W0(t,o),t.code(i)}):t.func(e,(0,O._)`${U.default.data}, ${B0(o)}`,n.$async,()=>t.code(Lv(r,o)).code(i))}function B0(t){return(0,O._)`{${U.default.instancePath}="", ${U.default.parentData}, ${U.default.parentDataProperty}, ${U.default.rootData}=${U.default.data}${t.dynamicRef?(0,O._)`, ${U.default.dynamicAnchors}={}`:O.nil}}={}`}function W0(t,e){t.if(U.default.valCxt,()=>{t.var(U.default.instancePath,(0,O._)`${U.default.valCxt}.${U.default.instancePath}`),t.var(U.default.parentData,(0,O._)`${U.default.valCxt}.${U.default.parentData}`),t.var(U.default.parentDataProperty,(0,O._)`${U.default.valCxt}.${U.default.parentDataProperty}`),t.var(U.default.rootData,(0,O._)`${U.default.valCxt}.${U.default.rootData}`),e.dynamicRef&&t.var(U.default.dynamicAnchors,(0,O._)`${U.default.valCxt}.${U.default.dynamicAnchors}`)},()=>{t.var(U.default.instancePath,(0,O._)`""`),t.var(U.default.parentData,(0,O._)`undefined`),t.var(U.default.parentDataProperty,(0,O._)`undefined`),t.var(U.default.rootData,U.default.data),e.dynamicRef&&t.var(U.default.dynamicAnchors,(0,O._)`{}`)})}function K0(t){let{schema:e,opts:r,gen:n}=t;Jv(t,()=>{r.$comment&&e.$comment&&Hv(t),Q0(t),n.let(U.default.vErrors,null),n.let(U.default.errors,0),r.unevaluated&&G0(t),Gv(t),rz(t)})}function G0(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,O._)`${r}.evaluated`),e.if((0,O._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,O._)`${t.evaluated}.props`,(0,O._)`undefined`)),e.if((0,O._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,O._)`${t.evaluated}.items`,(0,O._)`undefined`))}function Lv(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function H0(t,e){if(Wv(t)&&(Kv(t),Bv(t))){X0(t,e);return}(0,Fv.boolOrEmptySchema)(t,e)}function Bv({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Wv(t){return typeof t.schema!="boolean"}function X0(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&Hv(t),ez(t),tz(t);let i=n.const("_errs",U.default.errors);Gv(t,i),n.var(e,(0,O._)`${i} === ${U.default.errors}`)}function Kv(t){(0,Vt.checkUnknownRules)(t),Y0(t)}function Gv(t,e){if(t.opts.jtd)return qv(t,[],!1,e);let r=(0,Mv.getSchemaTypes)(t.schema),n=(0,Mv.coerceAndCheckDataType)(t,r);qv(t,r,!n,e)}function Y0(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Vt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Q0(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Vt.checkStrictMode)(t,"default is ignored in the schema root")}function ez(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,F0.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function tz(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Hv({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,O._)`${U.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,O.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,O._)`${U.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function rz(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,O._)`${U.default.errors} === 0`,()=>e.return(U.default.data),()=>e.throw((0,O._)`new ${o}(${U.default.vErrors})`)):(e.assign((0,O._)`${n}.errors`,U.default.vErrors),i.unevaluated&&nz(t),e.return((0,O._)`${U.default.errors} === 0`))}function nz({gen:t,evaluated:e,props:r,items:n}){r instanceof O.Name&&t.assign((0,O._)`${e}.props`,r),n instanceof O.Name&&t.assign((0,O._)`${e}.items`,n)}function qv(t,e,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Vt.schemaHasRulesButRef)(i,l))){o.block(()=>Yv(t,"$ref",l.all.$ref.definition));return}c.jtd||oz(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,up.shouldUseGroup)(i,p)&&(p.type?(o.if((0,Ha.checkDataType)(p.type,a,c.strictNumbers)),Vv(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0,Ha.reportTypeError)(t)),o.endIf()):Vv(t,p),s||o.if((0,O._)`${U.default.errors} === ${n||0}`))}}function Vv(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,V0.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,up.shouldUseRule)(n,i)&&Yv(t,i.keyword,i.definition,e.type)})}function oz(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(iz(t,e),t.opts.allowUnionTypes||az(t,e),sz(t,t.dataTypes))}function iz(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Xv(t.dataTypes,r)||lp(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),uz(t,e)}}function az(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&lp(t,"use allowUnionTypes to allow union type keyword")}function sz(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,up.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>cz(e,a))&&lp(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function cz(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Xv(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function uz(t,e){let r=[];for(let n of t.dataTypes)Xv(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function lp(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(t,e,t.opts.strictTypes)}var Xa=class{constructor(e,r,n){if((0,Xo.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Vt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Qv(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Xo.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",U.default.errors))}result(e,r,n){this.failResult((0,O.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,O.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,O._)`${r} !== undefined && (${(0,O.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ho.reportExtraError:Ho.reportError)(this,this.def.error,r)}$dataError(){(0,Ho.reportError)(this,this.def.$dataError||Ho.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ho.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=O.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),e!==O.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==O.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,O.or)(a(),s());function a(){if(n.length){if(!(r instanceof O.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,O._)`${(0,Ha.checkDataTypes)(c,r,i.opts.strictNumbers,Ha.DataType.Wrong)}`}return O.nil}function s(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(e,r){let n=(0,cp.getSubschema)(this.it,e);(0,cp.extendSubschemaData)(n,this.it,e),(0,cp.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return H0(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Vt.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Vt.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,O.Name)),!0}};lr.KeywordCxt=Xa;function Yv(t,e,r,n){let o=new Xa(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Xo.funcKeywordCode)(o,r):"macro"in r?(0,Xo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Xo.funcKeywordCode)(o,r)}var lz=/^\/(?:[^~]|~0|~1)*$/,dz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Qv(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return U.default.rootData;if(t[0]==="/"){if(!lz.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=U.default.rootData}else{let u=dz.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,O._)`${i}${(0,O.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,O._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}lr.getData=Qv});var Ya=S(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var dp=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};pp.default=dp});var Qo=S(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var fp=Go(),mp=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,fp.resolveUrl)(e,r,n),this.missingSchema=(0,fp.normalizeId)((0,fp.getFullPath)(e,this.missingRef))}};hp.default=mp});var es=S(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.resolveSchema=st.getCompilingSchema=st.resolveRef=st.compileSchema=st.SchemaEnv=void 0;var ft=B(),pz=Ya(),Er=qt(),mt=Go(),e_=ee(),fz=Yo(),hn=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,mt.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};st.SchemaEnv=hn;function vp(t){let e=t_.call(this,t);if(e)return e;let r=(0,mt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new ft.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;t.$async&&(s=a.scopeValue("Error",{ref:pz.default,code:(0,ft._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Er.default.data,parentData:Er.default.parentData,parentDataProperty:Er.default.parentDataProperty,dataNames:[Er.default.data],dataPathArr:[ft.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ft.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ft.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ft._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,fz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Er.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Er.default.self}`,`${Er.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:h}=u;f.evaluated={props:g instanceof ft.Name?void 0:g,items:h instanceof ft.Name?void 0:h,dynamicProps:g instanceof ft.Name,dynamicItems:h instanceof ft.Name},f.source&&(f.source.evaluated=(0,ft.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}st.compileSchema=vp;function mz(t,e,r){var n;r=(0,mt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=vz.call(this,t,r);if(i===void 0){let a=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new hn({schema:a,schemaId:s,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=hz.call(this,i)}st.resolveRef=mz;function hz(t){return(0,mt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:vp.call(this,t)}function t_(t){for(let e of this._compilations)if(gz(e,t))return e}st.getCompilingSchema=t_;function gz(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function vz(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Qa.call(this,t,e)}function Qa(t,e){let r=this.opts.uriResolver.parse(e),n=(0,mt._getFullPath)(this.opts.uriResolver,r),o=(0,mt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return gp.call(this,r,t);let i=(0,mt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Qa.call(this,t,a);return typeof s?.schema!="object"?void 0:gp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||vp.call(this,a),i===(0,mt.normalizeId)(e)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,mt.resolveUrl)(this.opts.uriResolver,o,u)),new hn({schema:s,schemaId:c,root:t,baseId:o})}return gp.call(this,r,a)}}st.resolveSchema=Qa;var _z=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function gp(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,e_.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!_z.has(s)&&u&&(e=(0,mt.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,e_.schemaHasRulesButRef)(r,this.RULES)){let s=(0,mt.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=Qa.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new hn({schema:r,schemaId:a,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var r_=S((_C,yz)=>{yz.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 yp=S((yC,a_)=>{"use strict";var $z=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o_=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);function _p(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var bz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function n_(t){return t.length=0,!0}function xz(t,e,r){if(t.length){let n=_p(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function kz(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=xz;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=n_}else{o.push(u);continue}}return o.length&&(s===n_?r.zone=o.join(""):a?n.push(o.join("")):n.push(_p(o))),r.address=n.join(""),r}function i_(t){if(Sz(t,":")<2)return{host:t,isIPV6:!1};let e=kz(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function Sz(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function wz(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.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]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function zz(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function Iz(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!o_(r)){let n=i_(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}a_.exports={nonSimpleDomain:bz,recomposeAuthority:Iz,normalizeComponentEncoding:zz,removeDotSegments:wz,isIPv4:o_,isUUID:$z,normalizeIPv6:i_,stringArrayToHexStripped:_p}});var d_=S(($C,l_)=>{"use strict";var{isUUID:Ez}=yp(),Tz=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Pz=["http","https","ws","wss","urn","urn:uuid"];function Oz(t){return Pz.indexOf(t)!==-1}function $p(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 s_(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function c_(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 jz(t){return t.secure=$p(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Nz(t){if((t.port===($p(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function Rz(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(Tz);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=bp(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Dz(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=bp(o);i&&(t=i.serialize(t,e));let a=t,s=t.nss;return a.path=`${n||e.nid}:${s}`,e.skipEscape=!0,a}function Az(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!Ez(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Zz(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var u_={scheme:"http",domainHost:!0,parse:s_,serialize:c_},Cz={scheme:"https",domainHost:u_.domainHost,parse:s_,serialize:c_},ts={scheme:"ws",domainHost:!0,parse:jz,serialize:Nz},Uz={scheme:"wss",domainHost:ts.domainHost,parse:ts.parse,serialize:ts.serialize},Mz={scheme:"urn",parse:Rz,serialize:Dz,skipNormalize:!0},Lz={scheme:"urn:uuid",parse:Az,serialize:Zz,skipNormalize:!0},rs={http:u_,https:Cz,ws:ts,wss:Uz,urn:Mz,"urn:uuid":Lz};Object.setPrototypeOf(rs,null);function bp(t){return t&&(rs[t]||rs[t.toLowerCase()])||void 0}l_.exports={wsIsSecure:$p,SCHEMES:rs,isValidSchemeName:Oz,getSchemeHandler:bp}});var m_=S((bC,os)=>{"use strict";var{normalizeIPv6:qz,removeDotSegments:ei,recomposeAuthority:Vz,normalizeComponentEncoding:ns,isIPv4:Fz,nonSimpleDomain:Jz}=yp(),{SCHEMES:Bz,getSchemeHandler:p_}=d_();function Wz(t,e){return typeof t=="string"?t=xt(Ft(t,e),e):typeof t=="object"&&(t=Ft(xt(t,e),e)),t}function Kz(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=f_(Ft(t,n),Ft(e,n),n,!0);return n.skipEscape=!0,xt(o,n)}function f_(t,e,r,n){let o={};return n||(t=Ft(xt(t,r),r),e=Ft(xt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=ei(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=ei(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=ei(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=ei(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 Gz(t,e,r){return typeof t=="string"?(t=unescape(t),t=xt(ns(Ft(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=xt(ns(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=xt(ns(Ft(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=xt(ns(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function xt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=p_(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=Vz(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=ei(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var Hz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ft(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(Hz);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(Fz(n.host)===!1){let c=qz(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=p_(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&Jz(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var xp={SCHEMES:Bz,normalize:Wz,resolve:Kz,resolveComponent:f_,equal:Gz,serialize:xt,parse:Ft};os.exports=xp;os.exports.default=xp;os.exports.fastUri=xp});var g_=S(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var h_=m_();h_.code='require("ajv/dist/runtime/uri").default';kp.default=h_});var S_=S(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.CodeGen=ze.Name=ze.nil=ze.stringify=ze.str=ze._=ze.KeywordCxt=void 0;var Xz=Yo();Object.defineProperty(ze,"KeywordCxt",{enumerable:!0,get:function(){return Xz.KeywordCxt}});var gn=B();Object.defineProperty(ze,"_",{enumerable:!0,get:function(){return gn._}});Object.defineProperty(ze,"str",{enumerable:!0,get:function(){return gn.str}});Object.defineProperty(ze,"stringify",{enumerable:!0,get:function(){return gn.stringify}});Object.defineProperty(ze,"nil",{enumerable:!0,get:function(){return gn.nil}});Object.defineProperty(ze,"Name",{enumerable:!0,get:function(){return gn.Name}});Object.defineProperty(ze,"CodeGen",{enumerable:!0,get:function(){return gn.CodeGen}});var Yz=Ya(),b_=Qo(),Qz=Yd(),ti=es(),eI=B(),ri=Go(),is=Ko(),wp=ee(),v_=r_(),tI=g_(),x_=(t,e)=>new RegExp(t,e);x_.code="new RegExp";var rI=["removeAdditional","useDefaults","coerceTypes"],nI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),oI={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."},iI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},__=200;function aI(t){var e,r,n,o,i,a,s,c,u,l,d,p,f,g,h,_,b,E,I,A,j,Le,de,Bt,Qe;let Wt=t.strict,Ds=(e=t.code)===null||e===void 0?void 0:e.optimize,Df=Ds===!0||Ds===void 0?1:Ds||0,Af=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:x_,h$=(o=t.uriResolver)!==null&&o!==void 0?o:tI.default;return{strictSchema:(a=(i=t.strictSchema)!==null&&i!==void 0?i:Wt)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=t.strictNumbers)!==null&&s!==void 0?s:Wt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:Wt)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:Wt)!==null&&p!==void 0?p:"log",strictRequired:(g=(f=t.strictRequired)!==null&&f!==void 0?f:Wt)!==null&&g!==void 0?g:!1,code:t.code?{...t.code,optimize:Df,regExp:Af}:{optimize:Df,regExp:Af},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:__,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:__,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(E=t.messages)!==null&&E!==void 0?E:!0,inlineRefs:(I=t.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(A=t.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(j=t.addUsedSchema)!==null&&j!==void 0?j:!0,validateSchema:(Le=t.validateSchema)!==null&&Le!==void 0?Le:!0,validateFormats:(de=t.validateFormats)!==null&&de!==void 0?de:!0,unicodeRegExp:(Bt=t.unicodeRegExp)!==null&&Bt!==void 0?Bt:!0,int32range:(Qe=t.int32range)!==null&&Qe!==void 0?Qe:!0,uriResolver:h$}}var ni=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...aI(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new eI.ValueScope({scope:{},prefixes:nI,es5:r,lines:n}),this.logger=pI(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Qz.getRules)(),y_.call(this,oI,e,"NOT SUPPORTED"),y_.call(this,iI,e,"DEPRECATED","warn"),this._metaOpts=lI.call(this),e.formats&&cI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&uI.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),sI.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=v_;n==="id"&&(o={...v_},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof b_.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:a}=this.opts;if(i=e[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,ri.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=$_.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ti.SchemaEnv({schema:{},schemaId:n});if(r=ti.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=$_.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,ri.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(mI.call(this,n,r),!r)return(0,wp.eachItem)(n,i=>Sp.call(this,i)),this;gI.call(this,r);let o={...r,type:(0,is.getJSONTypes)(r.type),schemaType:(0,is.getJSONTypes)(r.schemaType)};return(0,wp.eachItem)(n,o.type.length===0?i=>Sp.call(this,i,o):i=>o.type.forEach(a=>Sp.call(this,i,o,a))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),a=e;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=k_(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e=="object")a=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,ri.normalizeId)(a||n);let u=ri.getSchemaRefs.call(this,e,n);return c=new ti.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):ti.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{ti.compileSchema.call(this,e)}finally{this.opts=r}}};ni.ValidationError=Yz.default;ni.MissingRefError=b_.default;ze.default=ni;function y_(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function $_(t){return t=(0,ri.normalizeId)(t),this.schemas[t]||this.refs[t]}function sI(){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 cI(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function uI(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function lI(){let t={...this.opts};for(let e of rI)delete t[e];return t}var dI={log(){},warn(){},error(){}};function pI(t){if(t===!1)return dI;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 fI=/^[a-z_$][a-z0-9_$:-]*$/i;function mI(t,e){let{RULES:r}=this;if((0,wp.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!fI.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Sp(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,is.getJSONTypes)(e.type),schemaType:(0,is.getJSONTypes)(e.schemaType)}};e.before?hI.call(this,a,s,e.before):a.rules.push(s),i.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function hI(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function gI(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=k_(e)),t.validateSchema=this.compile(e,!0))}var vI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function k_(t){return{anyOf:[t,vI]}}});var w_=S(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var _I={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};zp.default=_I});var T_=S(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callRef=Tr.getValidate=void 0;var yI=Qo(),z_=at(),Be=B(),vn=qt(),I_=es(),as=ee(),$I={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=I_.resolveRef.call(c,u,o,r);if(l===void 0)throw new yI.default(n.opts.uriResolver,o,r);if(l instanceof I_.SchemaEnv)return p(l);return f(l);function d(){if(i===u)return ss(t,a,i,i.$async);let g=e.scopeValue("root",{ref:u});return ss(t,(0,Be._)`${g}.validate`,u,u.$async)}function p(g){let h=E_(t,g);ss(t,h,g,g.$async)}function f(g){let h=e.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,Be.stringify)(g)}:{ref:g}),_=e.name("valid"),b=t.subschema({schema:g,dataTypes:[],schemaPath:Be.nil,topSchemaRef:h,errSchemaPath:r},_);t.mergeEvaluated(b),t.ok(_)}}};function E_(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Be._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Tr.getValidate=E_;function ss(t,e,r,n){let{gen:o,it:i}=t,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?vn.default.this:Be.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,Be._)`await ${(0,z_.callValidateCode)(t,e,u)}`),f(e),a||o.assign(g,!0)},h=>{o.if((0,Be._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),p(h),a||o.assign(g,!1)}),t.ok(g)}function d(){t.result((0,z_.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(g){let h=(0,Be._)`${g}.errors`;o.assign(vn.default.vErrors,(0,Be._)`${vn.default.vErrors} === null ? ${h} : ${vn.default.vErrors}.concat(${h})`),o.assign(vn.default.errors,(0,Be._)`${vn.default.vErrors}.length`)}function f(g){var h;if(!i.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(i.props=as.mergeEvaluated.props(o,_.props,i.props));else{let b=o.var("props",(0,Be._)`${g}.evaluated.props`);i.props=as.mergeEvaluated.props(o,b,i.props,Be.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=as.mergeEvaluated.items(o,_.items,i.items));else{let b=o.var("items",(0,Be._)`${g}.evaluated.items`);i.items=as.mergeEvaluated.items(o,b,i.items,Be.Name)}}}Tr.callRef=ss;Tr.default=$I});var P_=S(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var bI=w_(),xI=T_(),kI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",bI.default,xI.default];Ip.default=kI});var O_=S(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});var cs=B(),dr=cs.operators,us={maximum:{okStr:"<=",ok:dr.LTE,fail:dr.GT},minimum:{okStr:">=",ok:dr.GTE,fail:dr.LT},exclusiveMaximum:{okStr:"<",ok:dr.LT,fail:dr.GTE},exclusiveMinimum:{okStr:">",ok:dr.GT,fail:dr.LTE}},SI={message:({keyword:t,schemaCode:e})=>(0,cs.str)`must be ${us[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,cs._)`{comparison: ${us[t].okStr}, limit: ${e}}`},wI={keyword:Object.keys(us),type:"number",schemaType:"number",$data:!0,error:SI,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,cs._)`${r} ${us[e].fail} ${n} || isNaN(${r})`)}};Ep.default=wI});var j_=S(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var oi=B(),zI={message:({schemaCode:t})=>(0,oi.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,oi._)`{multipleOf: ${t}}`},II={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:zI,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,a=e.let("res"),s=i?(0,oi._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,oi._)`${a} !== parseInt(${a})`;t.fail$data((0,oi._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Tp.default=II});var R_=S(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});function N_(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}Pp.default=N_;N_.code='require("ajv/dist/runtime/ucs2length").default'});var D_=S(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var Pr=B(),EI=ee(),TI=R_(),PI={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Pr.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Pr._)`{limit: ${t}}`},OI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:PI,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?Pr.operators.GT:Pr.operators.LT,a=o.opts.unicode===!1?(0,Pr._)`${r}.length`:(0,Pr._)`${(0,EI.useFunc)(t.gen,TI.default)}(${r})`;t.fail$data((0,Pr._)`${a} ${i} ${n}`)}};Op.default=OI});var A_=S(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var jI=at(),NI=ee(),_n=B(),RI={message:({schemaCode:t})=>(0,_n.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,_n._)`{pattern: ${t}}`},DI={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:RI,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,_n._)`new RegExp`:(0,NI.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,_n._)`${u}(${i}, ${s}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,_n._)`!${l}`)}else{let c=(0,jI.usePattern)(t,o);t.fail$data((0,_n._)`!${c}.test(${r})`)}}};jp.default=DI});var Z_=S(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var ii=B(),AI={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,ii.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,ii._)`{limit: ${t}}`},ZI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:AI,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?ii.operators.GT:ii.operators.LT;t.fail$data((0,ii._)`Object.keys(${r}).length ${o} ${n}`)}};Np.default=ZI});var C_=S(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var ai=at(),si=B(),CI=ee(),UI={message:({params:{missingProperty:t}})=>(0,si.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,si._)`{missingProperty: ${t}}`},MI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:UI,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:a}=t,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=t.parentSchema.properties,{definedProperties:g}=t.it;for(let h of r)if(f?.[h]===void 0&&!g.has(h)){let _=a.schemaEnv.baseId+a.errSchemaPath,b=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,CI.checkStrictMode)(a,b,a.opts.strictRequired)}}function u(){if(c||i)t.block$data(si.nil,d);else for(let f of r)(0,ai.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||i){let g=e.let("valid",!0);t.block$data(g,()=>p(f,g)),t.ok(g)}else e.if((0,ai.checkMissingProp)(t,r,f)),(0,ai.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,ai.noPropertyInData)(e,o,f,s.ownProperties),()=>t.error())})}function p(f,g){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(g,(0,ai.propertyInData)(e,o,f,s.ownProperties)),e.if((0,si.not)(g),()=>{t.error(),e.break()})},si.nil)}}};Rp.default=MI});var U_=S(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var ci=B(),LI={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,ci.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,ci._)`{limit: ${t}}`},qI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:LI,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?ci.operators.GT:ci.operators.LT;t.fail$data((0,ci._)`${r}.length ${o} ${n}`)}};Dp.default=qI});var ls=S(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var M_=ap();M_.code='require("ajv/dist/runtime/equal").default';Ap.default=M_});var L_=S(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var Zp=Ko(),Ie=B(),VI=ee(),FI=ls(),JI={message:({params:{i:t,j:e}})=>(0,Ie.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ie._)`{i: ${t}, j: ${e}}`},BI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:JI,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,Zp.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Ie._)`${a} === false`),t.ok(c);function l(){let g=e.let("i",(0,Ie._)`${r}.length`),h=e.let("j");t.setParams({i:g,j:h}),e.assign(c,!0),e.if((0,Ie._)`${g} > 1`,()=>(d()?p:f)(g,h))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function p(g,h){let _=e.name("item"),b=(0,Zp.checkDataTypes)(u,_,s.opts.strictNumbers,Zp.DataType.Wrong),E=e.const("indices",(0,Ie._)`{}`);e.for((0,Ie._)`;${g}--;`,()=>{e.let(_,(0,Ie._)`${r}[${g}]`),e.if(b,(0,Ie._)`continue`),u.length>1&&e.if((0,Ie._)`typeof ${_} == "string"`,(0,Ie._)`${_} += "_"`),e.if((0,Ie._)`typeof ${E}[${_}] == "number"`,()=>{e.assign(h,(0,Ie._)`${E}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,Ie._)`${E}[${_}] = ${g}`)})}function f(g,h){let _=(0,VI.useFunc)(e,FI.default),b=e.name("outer");e.label(b).for((0,Ie._)`;${g}--;`,()=>e.for((0,Ie._)`${h} = ${g}; ${h}--;`,()=>e.if((0,Ie._)`${_}(${r}[${g}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};Cp.default=BI});var q_=S(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var Up=B(),WI=ee(),KI=ls(),GI={message:"must be equal to constant",params:({schemaCode:t})=>(0,Up._)`{allowedValue: ${t}}`},HI={keyword:"const",$data:!0,error:GI,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,Up._)`!${(0,WI.useFunc)(e,KI.default)}(${r}, ${o})`):t.fail((0,Up._)`${i} !== ${r}`)}};Mp.default=HI});var V_=S(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var ui=B(),XI=ee(),YI=ls(),QI={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,ui._)`{allowedValues: ${t}}`},eE={keyword:"enum",schemaType:"array",$data:!0,error:QI,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,XI.useFunc)(e,YI.default)),l;if(s||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",i);l=(0,ui.or)(...o.map((g,h)=>p(f,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,f=>e.if((0,ui._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,g){let h=o[g];return typeof h=="object"&&h!==null?(0,ui._)`${u()}(${r}, ${f}[${g}])`:(0,ui._)`${r} === ${h}`}}};Lp.default=eE});var F_=S(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var tE=O_(),rE=j_(),nE=D_(),oE=A_(),iE=Z_(),aE=C_(),sE=U_(),cE=L_(),uE=q_(),lE=V_(),dE=[tE.default,rE.default,nE.default,oE.default,iE.default,aE.default,sE.default,cE.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},uE.default,lE.default];qp.default=dE});var Fp=S(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.validateAdditionalItems=void 0;var Or=B(),Vp=ee(),pE={message:({params:{len:t}})=>(0,Or.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Or._)`{limit: ${t}}`},fE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:pE,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Vp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}J_(t,n)}};function J_(t,e){let{gen:r,schema:n,data:o,keyword:i,it:a}=t;a.items=!0;let s=r.const("len",(0,Or._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Or._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,Vp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${e.length}`);r.if((0,Or.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,s,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:Vp.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}li.validateAdditionalItems=J_;li.default=fE});var Jp=S(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.validateTuple=void 0;var B_=B(),ds=ee(),mE=at(),hE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return W_(t,"additionalItems",e);r.items=!0,!(0,ds.alwaysValidSchema)(r,e)&&t.ok((0,mE.validateArray)(t))}};function W_(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=t;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=ds.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,B_._)`${i}.length`);r.forEach((d,p)=>{(0,ds.alwaysValidSchema)(s,d)||(n.if((0,B_._)`${u} > ${p}`,()=>t.subschema({keyword:a,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=s,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[e]===!1);if(p.strictTuples&&!h){let _=`"${a}" is ${g}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,ds.checkStrictMode)(s,_,p.strictTuples)}}}di.validateTuple=W_;di.default=hE});var K_=S(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var gE=Jp(),vE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,gE.validateTuple)(t,"items")};Bp.default=vE});var H_=S(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var G_=B(),_E=ee(),yE=at(),$E=Fp(),bE={message:({params:{len:t}})=>(0,G_.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,G_._)`{limit: ${t}}`},xE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:bE,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,_E.alwaysValidSchema)(n,e)&&(o?(0,$E.validateAdditionalItems)(t,o):t.ok((0,yE.validateArray)(t)))}};Wp.default=xE});var X_=S(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var ct=B(),ps=ee(),kE={message:({params:{min:t,max:e}})=>e===void 0?(0,ct.str)`must contain at least ${t} valid item(s)`:(0,ct.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ct._)`{minContains: ${t}}`:(0,ct._)`{minContains: ${t}, maxContains: ${e}}`},SE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:kE,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=e.const("len",(0,ct._)`${o}.length`);if(t.setParams({min:a,max:s}),s===void 0&&a===0){(0,ps.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,ps.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ps.alwaysValidSchema)(i,r)){let h=(0,ct._)`${l} >= ${a}`;s!==void 0&&(h=(0,ct._)`${h} && ${l} <= ${s}`),t.pass(h);return}i.items=!0;let d=e.name("valid");s===void 0&&a===1?f(d,()=>e.if(d,()=>e.break())):a===0?(e.let(d,!0),s!==void 0&&e.if((0,ct._)`${o}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let h=e.name("_valid"),_=e.let("count",0);f(h,()=>e.if(h,()=>g(_)))}function f(h,_){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:ps.Type.Num,compositeRule:!0},h),_()})}function g(h){e.code((0,ct._)`${h}++`),s===void 0?e.if((0,ct._)`${h} >= ${a}`,()=>e.assign(d,!0).break()):(e.if((0,ct._)`${h} > ${s}`,()=>e.assign(d,!1).break()),a===1?e.assign(d,!0):e.if((0,ct._)`${h} >= ${a}`,()=>e.assign(d,!0)))}}};Kp.default=SE});var ey=S(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.validateSchemaDeps=kt.validatePropertyDeps=kt.error=void 0;var Gp=B(),wE=ee(),pi=at();kt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Gp.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Gp._)`{property: ${t},
|
|
7
|
+
missingProperty: ${n},
|
|
8
|
+
depsCount: ${e},
|
|
9
|
+
deps: ${r}}`};var zE={keyword:"dependencies",type:"object",schemaType:"object",error:kt.error,code(t){let[e,r]=IE(t);Y_(t,e),Q_(t,r)}};function IE({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function Y_(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let a in e){let s=e[a];if(s.length===0)continue;let c=(0,pi.propertyInData)(r,n,a,o.opts.ownProperties);t.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,pi.checkReportMissingProp)(t,u)}):(r.if((0,Gp._)`${c} && (${(0,pi.checkMissingProp)(t,s,i)})`),(0,pi.reportMissingProp)(t,i),r.else())}}kt.validatePropertyDeps=Y_;function Q_(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,a=r.name("valid");for(let s in e)(0,wE.alwaysValidSchema)(i,e[s])||(r.if((0,pi.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:s},a);t.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),t.ok(a))}kt.validateSchemaDeps=Q_;kt.default=zE});var ry=S(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var ty=B(),EE=ee(),TE={message:"property name must be valid",params:({params:t})=>(0,ty._)`{propertyName: ${t.propertyName}}`},PE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:TE,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,EE.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),e.if((0,ty.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};Hp.default=PE});var Yp=S(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var fs=at(),ht=B(),OE=qt(),ms=ee(),jE={message:"must NOT have additional properties",params:({params:t})=>(0,ht._)`{additionalProperty: ${t.additionalProperty}}`},NE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jE,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,ms.alwaysValidSchema)(a,r))return;let u=(0,fs.allSchemaProperties)(n.properties),l=(0,fs.allSchemaProperties)(n.patternProperties);d(),t.ok((0,ht._)`${i} === ${OE.default.errors}`);function d(){e.forIn("key",o,_=>{!u.length&&!l.length?g(_):e.if(p(_),()=>g(_))})}function p(_){let b;if(u.length>8){let E=(0,ms.schemaRefOrVal)(a,n.properties,"properties");b=(0,fs.isOwnProperty)(e,E,_)}else u.length?b=(0,ht.or)(...u.map(E=>(0,ht._)`${_} === ${E}`)):b=ht.nil;return l.length&&(b=(0,ht.or)(b,...l.map(E=>(0,ht._)`${(0,fs.usePattern)(t,E)}.test(${_})`))),(0,ht.not)(b)}function f(_){e.code((0,ht._)`delete ${o}[${_}]`)}function g(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,ms.alwaysValidSchema)(a,r)){let b=e.name("valid");c.removeAdditional==="failing"?(h(_,b,!1),e.if((0,ht.not)(b),()=>{t.reset(),f(_)})):(h(_,b),s||e.if((0,ht.not)(b),()=>e.break()))}}function h(_,b,E){let I={keyword:"additionalProperties",dataProp:_,dataPropType:ms.Type.Str};E===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(I,b)}}};Xp.default=NE});var iy=S(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var RE=Yo(),ny=at(),Qp=ee(),oy=Yp(),DE={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&oy.default.code(new RE.KeywordCxt(i,oy.default,"additionalProperties"));let a=(0,ny.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Qp.mergeEvaluated.props(e,(0,Qp.toHash)(a),i.props));let s=a.filter(d=>!(0,Qp.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=e.name("valid");for(let d of s)u(d)?l(d):(e.if((0,ny.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};ef.default=DE});var uy=S(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var ay=at(),hs=B(),sy=ee(),cy=ee(),AE={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:a}=i,s=(0,ay.allSchemaProperties)(r),c=s.filter(h=>(0,sy.alwaysValidSchema)(i,r[h]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof hs.Name)&&(i.props=(0,cy.evaluatedPropsToName)(e,i.props));let{props:d}=i;p();function p(){for(let h of s)u&&f(h),i.allErrors?g(h):(e.var(l,!0),g(h),e.if(l))}function f(h){for(let _ in u)new RegExp(h).test(_)&&(0,sy.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){e.forIn("key",n,_=>{e.if((0,hs._)`${(0,ay.usePattern)(t,h)}.test(${_})`,()=>{let b=c.includes(h);b||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:cy.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,hs._)`${d}[${_}]`,!0):!b&&!i.allErrors&&e.if((0,hs.not)(l),()=>e.break())})})}}};tf.default=AE});var ly=S(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var ZE=ee(),CE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,ZE.alwaysValidSchema)(n,r)){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"}};rf.default=CE});var dy=S(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var UE=at(),ME={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:UE.validateUnion,error:{message:"must match a schema in anyOf"}};nf.default=ME});var py=S(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var gs=B(),LE=ee(),qE={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,gs._)`{passingSchemas: ${t.passing}}`},VE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:qE,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=e.let("valid",!1),s=e.let("passing",null),c=e.name("_valid");t.setParams({passing:s}),e.block(u),t.result(a,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let p;(0,LE.alwaysValidSchema)(o,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,gs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,gs._)`[${s}, ${d}]`).else(),e.if(c,()=>{e.assign(a,!0),e.assign(s,d),p&&t.mergeEvaluated(p,gs.Name)})})}}};of.default=VE});var fy=S(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var FE=ee(),JE={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,a)=>{if((0,FE.alwaysValidSchema)(n,i))return;let s=t.subschema({keyword:"allOf",schemaProp:a},o);t.ok(o),t.mergeEvaluated(s)})}};af.default=JE});var gy=S(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var vs=B(),hy=ee(),BE={message:({params:t})=>(0,vs.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,vs._)`{failingKeyword: ${t.ifClause}}`},WE={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:BE,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,hy.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=my(n,"then"),i=my(n,"else");if(!o&&!i)return;let a=e.let("valid",!0),s=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(s,u("then",l),u("else",l))}else o?e.if(s,u("then")):e.if((0,vs.not)(s),u("else"));t.pass(a,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},s);e.assign(a,s),t.mergeValidEvaluated(p,a),d?e.assign(d,(0,vs._)`${l}`):t.setParams({ifClause:l})}}}};function my(t,e){let r=t.schema[e];return r!==void 0&&!(0,hy.alwaysValidSchema)(t,r)}sf.default=WE});var vy=S(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var KE=ee(),GE={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,KE.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};cf.default=GE});var _y=S(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var HE=Fp(),XE=K_(),YE=Jp(),QE=H_(),eT=X_(),tT=ey(),rT=ry(),nT=Yp(),oT=iy(),iT=uy(),aT=ly(),sT=dy(),cT=py(),uT=fy(),lT=gy(),dT=vy();function pT(t=!1){let e=[aT.default,sT.default,cT.default,uT.default,lT.default,dT.default,rT.default,nT.default,tT.default,oT.default,iT.default];return t?e.push(XE.default,QE.default):e.push(HE.default,YE.default),e.push(eT.default),e}uf.default=pT});var yy=S(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var _e=B(),fT={message:({schemaCode:t})=>(0,_e.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,_e._)`{format: ${t}}`},mT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:fT,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():f();function p(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,_e._)`${g}[${a}]`),_=r.let("fType"),b=r.let("format");r.if((0,_e._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,_e._)`${h}.type || "string"`).assign(b,(0,_e._)`${h}.validate`),()=>r.assign(_,(0,_e._)`"string"`).assign(b,h)),t.fail$data((0,_e.or)(E(),I()));function E(){return c.strictSchema===!1?_e.nil:(0,_e._)`${a} && !${b}`}function I(){let A=l.$async?(0,_e._)`(${h}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,_e._)`${b}(${n})`,j=(0,_e._)`(typeof ${b} == "function" ? ${A} : ${b}.test(${n}))`;return(0,_e._)`${b} && ${b} !== true && ${_} === ${e} && !${j}`}}function f(){let g=d.formats[i];if(!g){E();return}if(g===!0)return;let[h,_,b]=I(g);h===e&&t.pass(A());function E(){if(c.strictSchema===!1){d.logger.warn(j());return}throw new Error(j());function j(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function I(j){let Le=j instanceof RegExp?(0,_e.regexpCode)(j):c.code.formats?(0,_e._)`${c.code.formats}${(0,_e.getProperty)(i)}`:void 0,de=r.scopeValue("formats",{key:i,ref:j,code:Le});return typeof j=="object"&&!(j instanceof RegExp)?[j.type||"string",j.validate,(0,_e._)`${de}.validate`]:["string",j,de]}function A(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,_e._)`await ${b}(${n})`}return typeof _=="function"?(0,_e._)`${b}(${n})`:(0,_e._)`${b}.test(${n})`}}}};lf.default=mT});var $y=S(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var hT=yy(),gT=[hT.default];df.default=gT});var by=S(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.contentVocabulary=yn.metadataVocabulary=void 0;yn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];yn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var ky=S(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var vT=P_(),_T=F_(),yT=_y(),$T=$y(),xy=by(),bT=[vT.default,_T.default,(0,yT.default)(),$T.default,xy.metadataVocabulary,xy.contentVocabulary];pf.default=bT});var wy=S(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.DiscrError=void 0;var Sy;(function(t){t.Tag="tag",t.Mapping="mapping"})(Sy||(_s.DiscrError=Sy={}))});var Iy=S(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var $n=B(),ff=wy(),zy=es(),xT=Qo(),kT=ee(),ST={message:({params:{discrError:t,tagName:e}})=>t===ff.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,$n._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},wT={keyword:"discriminator",type:"object",schemaType:"object",error:ST,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,$n._)`${r}${(0,$n.getProperty)(s)}`);e.if((0,$n._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:ff.DiscrError.Tag,tag:u,tagName:s})),t.ok(c);function l(){let f=p();e.if(!1);for(let g in f)e.elseIf((0,$n._)`${u} === ${g}`),e.assign(c,d(f[g]));e.else(),t.error(!1,{discrError:ff.DiscrError.Mapping,tag:u,tagName:s}),e.endIf()}function d(f){let g=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},g);return t.mergeEvaluated(h,$n.Name),g}function p(){var f;let g={},h=b(o),_=!0;for(let A=0;A<a.length;A++){let j=a[A];if(j?.$ref&&!(0,kT.schemaHasRulesButRef)(j,i.self.RULES)){let de=j.$ref;if(j=zy.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,de),j instanceof zy.SchemaEnv&&(j=j.schema),j===void 0)throw new xT.default(i.opts.uriResolver,i.baseId,de)}let Le=(f=j?.properties)===null||f===void 0?void 0:f[s];if(typeof Le!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);_=_&&(h||b(j)),E(Le,A)}if(!_)throw new Error(`discriminator: "${s}" must be required`);return g;function b({required:A}){return Array.isArray(A)&&A.includes(s)}function E(A,j){if(A.const)I(A.const,j);else if(A.enum)for(let Le of A.enum)I(Le,j);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function I(A,j){if(typeof A!="string"||A in g)throw new Error(`discriminator: "${s}" values must be unique strings`);g[A]=j}}}};mf.default=wT});var Ey=S((uU,zT)=>{zT.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 gf=S((ge,hf)=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.MissingRefError=ge.ValidationError=ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=ge.Ajv=void 0;var IT=S_(),ET=ky(),TT=Iy(),Ty=Ey(),PT=["/properties"],ys="http://json-schema.org/draft-07/schema",bn=class extends IT.default{_addVocabularies(){super._addVocabularies(),ET.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(TT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Ty,PT):Ty;this.addMetaSchema(e,ys,!1),this.refs["http://json-schema.org/schema"]=ys}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ys)?ys:void 0)}};ge.Ajv=bn;hf.exports=ge=bn;hf.exports.Ajv=bn;Object.defineProperty(ge,"__esModule",{value:!0});ge.default=bn;var OT=Yo();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return OT.KeywordCxt}});var xn=B();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return xn._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return xn.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return xn.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return xn.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return xn.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return xn.CodeGen}});var jT=Ya();Object.defineProperty(ge,"ValidationError",{enumerable:!0,get:function(){return jT.default}});var NT=Qo();Object.defineProperty(ge,"MissingRefError",{enumerable:!0,get:function(){return NT.default}})});var Zy=S(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.formatNames=wt.fastFormats=wt.fullFormats=void 0;function St(t,e){return{validate:t,compare:e}}wt.fullFormats={date:St(Ny,$f),time:St(_f(!0),bf),"date-time":St(Py(!0),Dy),"iso-time":St(_f(),Ry),"iso-date-time":St(Py(),Ay),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:UT,"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:BT,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:MT,int32:{type:"number",validate:VT},int64:{type:"number",validate:FT},float:{type:"number",validate:jy},double:{type:"number",validate:jy},password:!0,binary:!0};wt.fastFormats={...wt.fullFormats,date:St(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,$f),time:St(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,bf),"date-time":St(/^\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,Dy),"iso-time":St(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Ry),"iso-date-time":St(/^\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,Ay),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 RT(t){return t%4===0&&(t%100!==0||t%400===0)}var DT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,AT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Ny(t){let e=DT.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&RT(r)?29:AT[n])}function $f(t,e){if(t&&e)return t>e?1:t<e?-1:0}var vf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function _f(t){return function(r){let n=vf.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function bf(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function Ry(t,e){if(!(t&&e))return;let r=vf.exec(t),n=vf.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var yf=/t|\s/i;function Py(t){let e=_f(t);return function(n){let o=n.split(yf);return o.length===2&&Ny(o[0])&&e(o[1])}}function Dy(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function Ay(t,e){if(!(t&&e))return;let[r,n]=t.split(yf),[o,i]=e.split(yf),a=$f(r,o);if(a!==void 0)return a||bf(n,i)}var ZT=/\/|:/,CT=/^(?:[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 UT(t){return ZT.test(t)&&CT.test(t)}var Oy=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function MT(t){return Oy.lastIndex=0,Oy.test(t)}var LT=-(2**31),qT=2**31-1;function VT(t){return Number.isInteger(t)&&t<=qT&&t>=LT}function FT(t){return Number.isInteger(t)}function jy(){return!0}var JT=/[^\\]\\Z/;function BT(t){if(JT.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Cy=S(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.formatLimitDefinition=void 0;var WT=gf(),gt=B(),pr=gt.operators,$s={formatMaximum:{okStr:"<=",ok:pr.LTE,fail:pr.GT},formatMinimum:{okStr:">=",ok:pr.GTE,fail:pr.LT},formatExclusiveMaximum:{okStr:"<",ok:pr.LT,fail:pr.GTE},formatExclusiveMinimum:{okStr:">",ok:pr.GT,fail:pr.LTE}},KT={message:({keyword:t,schemaCode:e})=>(0,gt.str)`should be ${$s[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gt._)`{comparison: ${$s[t].okStr}, limit: ${e}}`};kn.formatLimitDefinition={keyword:Object.keys($s),type:"string",schemaType:"string",$data:!0,error:KT,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new WT.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=e.const("fmt",(0,gt._)`${p}[${c.schemaCode}]`);t.fail$data((0,gt.or)((0,gt._)`typeof ${f} != "object"`,(0,gt._)`${f} instanceof RegExp`,(0,gt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=s.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let g=e.scopeValue("formats",{key:p,ref:f,code:a.code.formats?(0,gt._)`${a.code.formats}${(0,gt.getProperty)(p)}`:void 0});t.fail$data(d(g))}function d(p){return(0,gt._)`${p}.compare(${r}, ${n}) ${$s[o].fail} 0`}},dependencies:["format"]};var GT=t=>(t.addKeyword(kn.formatLimitDefinition),t);kn.default=GT});var qy=S((fi,Ly)=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});var Sn=Zy(),HT=Cy(),xf=B(),Uy=new xf.Name("fullFormats"),XT=new xf.Name("fastFormats"),kf=(t,e={keywords:!0})=>{if(Array.isArray(e))return My(t,e,Sn.fullFormats,Uy),t;let[r,n]=e.mode==="fast"?[Sn.fastFormats,XT]:[Sn.fullFormats,Uy],o=e.formats||Sn.formatNames;return My(t,o,r,n),e.keywords&&(0,HT.default)(t),t};kf.get=(t,e="full")=>{let n=(e==="fast"?Sn.fastFormats:Sn.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function My(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,xf._)`require("ajv-formats/dist/formats").${n}`);for(let a of e)t.addFormat(a,r[a])}Ly.exports=fi=kf;Object.defineProperty(fi,"__esModule",{value:!0});fi.default=kf});var Tt=require("fs"),En=require("path"),Cf=require("os"),Zs=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(Zs||{}),Zf=(0,En.join)((0,Cf.homedir)(),".vibelearn"),Cs=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let e=(0,En.join)(Zf,"logs");(0,Tt.existsSync)(e)||(0,Tt.mkdirSync)(e,{recursive:!0});let r=new Date().toISOString().split("T")[0];this.logFilePath=(0,En.join)(e,`vibelearn-${r}.log`)}catch(e){console.error("[LOGGER] Failed to initialize log file:",e),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let e=(0,En.join)(Zf,"settings.json");if((0,Tt.existsSync)(e)){let r=(0,Tt.readFileSync)(e,"utf-8"),o=(JSON.parse(r).VIBELEARN_LOG_LEVEL||"INFO").toUpperCase();this.level=Zs[o]??1}else this.level=1}catch{this.level=1}return this.level}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
|
|
10
|
+
${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Object.keys(e);return r.length===0?"{}":r.length<=3?JSON.stringify(e):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,r){if(!r)return e;let n=r;if(typeof r=="string")try{n=JSON.parse(r)}catch{n=r}if(e==="Bash"&&n.command)return`${e}(${n.command})`;if(n.file_path)return`${e}(${n.file_path})`;if(n.notebook_path)return`${e}(${n.notebook_path})`;if(e==="Glob"&&n.pattern)return`${e}(${n.pattern})`;if(e==="Grep"&&n.pattern)return`${e}(${n.pattern})`;if(n.url)return`${e}(${n.url})`;if(n.query)return`${e}(${n.query})`;if(e==="Task"){if(n.subagent_type)return`${e}(${n.subagent_type})`;if(n.description)return`${e}(${n.description})`}return e==="Skill"&&n.skill?`${e}(${n.skill})`:e==="LSP"&&n.operation?`${e}(${n.operation})`:e}formatTimestamp(e){let r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),s=String(e.getSeconds()).padStart(2,"0"),c=String(e.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${o} ${i}:${a}:${s}.${c}`}log(e,r,n,o,i){if(e<this.getLevel())return;this.ensureLogFileInitialized();let a=this.formatTimestamp(new Date),s=Zs[e].padEnd(5),c=r.padEnd(6),u="";o?.correlationId?u=`[${o.correlationId}] `:o?.sessionId&&(u=`[session-${o.sessionId}] `);let l="";i!=null&&(i instanceof Error?l=this.getLevel()===0?`
|
|
11
|
+
${i.message}
|
|
12
|
+
${i.stack}`:` ${i.message}`:this.getLevel()===0&&typeof i=="object"?l=`
|
|
13
|
+
`+JSON.stringify(i,null,2):l=" "+this.formatData(i));let d="";if(o){let{sessionId:f,memorySessionId:g,correlationId:h,..._}=o;Object.keys(_).length>0&&(d=` {${Object.entries(_).map(([E,I])=>`${E}=${I}`).join(", ")}}`)}let p=`[${a}] [${s}] [${c}] ${u}${n}${d}${l}`;if(this.logFilePath)try{(0,Tt.appendFileSync)(this.logFilePath,p+`
|
|
14
|
+
`,"utf8")}catch(f){process.stderr.write(`[LOGGER] Failed to write to log file: ${f}
|
|
15
|
+
`)}else process.stderr.write(p+`
|
|
16
|
+
`)}debug(e,r,n,o){this.log(0,e,r,n,o)}info(e,r,n,o){this.log(1,e,r,n,o)}warn(e,r,n,o){this.log(2,e,r,n,o)}error(e,r,n,o){this.log(3,e,r,n,o)}dataIn(e,r,n,o){this.info(e,`\u2192 ${r}`,n,o)}dataOut(e,r,n,o){this.info(e,`\u2190 ${r}`,n,o)}success(e,r,n,o){this.info(e,`\u2713 ${r}`,n,o)}failure(e,r,n,o){this.error(e,`\u2717 ${r}`,n,o)}timing(e,r,n,o){this.info(e,`\u23F1 ${r}`,o,{duration:`${n}ms`})}happyPathError(e,r,n,o,i=""){let u=((new Error().stack||"").split(`
|
|
17
|
+
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=u?`${u[1].split("/").pop()}:${u[2]}`:"unknown",d={...n,location:l};return this.warn(e,`[HAPPY-PATH] ${r}`,d,o),i}},ve=new Cs;var X;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(X||(X={}));var Uf;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Uf||(Uf={}));var w=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pt=t=>{switch(typeof t){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(t)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(t)?w.array:t===null?w.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?w.promise:typeof Map<"u"&&t instanceof Map?w.map:typeof Set<"u"&&t instanceof Set?w.set:typeof Date<"u"&&t instanceof Date?w.date:w.object;default:return w.unknown}};var y=X.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"]);var We=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}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,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};We.create=t=>new We(t);var x$=(t,e)=>{let r;switch(t.code){case y.invalid_type:t.received===w.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,X.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${X.joinValues(t.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${X.joinValues(t.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${X.joinValues(t.options)}, received '${t.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:X.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case y.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case y.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=e.defaultError,X.assertNever(t)}return{message:r}},Kt=x$;var k$=Kt;function Tn(){return k$}var _i=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function x(t,e){let r=Tn(),n=_i({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Kt?void 0:Kt].filter(o=>!!o)});t.common.issues.push(n)}var Ee=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return Z;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return Z;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},Z=Object.freeze({status:"aborted"}),Nr=t=>({status:"dirty",value:t}),Re=t=>({status:"valid",value:t}),Us=t=>t.status==="aborted",Ms=t=>t.status==="dirty",fr=t=>t.status==="valid",Pn=t=>typeof Promise<"u"&&t instanceof Promise;var T;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(T||(T={}));var et=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,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}},Mf=(t,e)=>{if(fr(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 r=new We(t.common.issues);return this._error=r,this._error}}};function L(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))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:(a,s)=>{let{message:c}=t;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var W=class{get description(){return this._def.description}_getType(e){return Pt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Pt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ee,ctx:{common:e.parent.common,data:e.data,parsedType:Pt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Pn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pt(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Mf(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return fr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>fr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pt(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Pn(o)?o:Promise.resolve(o));return Mf(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:y.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new lt({schema:this,typeName:N.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:r=>this["~validate"](r)}}optional(){return ut.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ht.create(this)}promise(){return mr.create(this,this._def)}or(e){return Cr.create([this,e],this._def)}and(e){return Ur.create(this,e,this._def)}transform(e){return new lt({...L(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Fr({...L(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new yi({typeName:N.ZodBranded,type:this,...L(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Jr({...L(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return $i.create(this,e)}readonly(){return Br.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},S$=/^c[^\s-]{8,}$/i,w$=/^[0-9a-z]+$/,z$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I$=/^[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,E$=/^[a-z0-9_-]{21}$/i,T$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,P$=/^[-+]?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)?)??$/,O$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,j$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ls,N$=/^(?:(?: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])$/,R$=/^(?:(?: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])$/,D$=/^(([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]))$/,A$=/^(([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])$/,Z$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,C$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lf="((\\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])))",U$=new RegExp(`^${Lf}$`);function qf(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function M$(t){return new RegExp(`^${qf(t)}$`)}function L$(t){let e=`${Lf}T${qf(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function q$(t,e){return!!((e==="v4"||!e)&&N$.test(t)||(e==="v6"||!e)&&D$.test(t))}function V$(t,e){if(!T$.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function F$(t,e){return!!((e==="v4"||!e)&&R$.test(t)||(e==="v6"||!e)&&A$.test(t))}var Dr=class t extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.string){let i=this._getOrReturnCtx(e);return x(i,{code:y.invalid_type,expected:w.string,received:i.parsedType}),Z}let n=new Ee,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),x(o,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),x(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?x(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&x(o,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")O$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"email",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ls||(Ls=new RegExp(j$,"u")),Ls.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"emoji",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")I$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"uuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")E$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"nanoid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")S$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"cuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")w$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"cuid2",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")z$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"ulid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),x(o,{validation:"url",code:y.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"regex",code:y.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),x(o,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),x(o,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),x(o,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?L$(i).test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{code:y.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?U$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{code:y.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?M$(i).test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{code:y.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?P$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"duration",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?q$(e.data,i.version)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"ip",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?V$(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"jwt",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?F$(e.data,i.version)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"cidr",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Z$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"base64",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?C$.test(e.data)||(o=this._getOrReturnCtx(e,o),x(o,{validation:"base64url",code:y.invalid_string,message:i.message}),n.dirty()):X.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:y.invalid_string,...T.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...T.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...T.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...T.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,...T.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,...T.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...T.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...T.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...T.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...T.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...T.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...T.errToObj(r)})}nonempty(e){return this.min(1,T.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 r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Dr.create=t=>new Dr({checks:[],typeName:N.ZodString,coerce:t?.coerce??!1,...L(t)});function J$(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var On=class t extends W{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)!==w.number){let i=this._getOrReturnCtx(e);return x(i,{code:y.invalid_type,expected:w.number,received:i.parsedType}),Z}let n,o=new Ee;for(let i of this._def.checks)i.kind==="int"?X.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?J$(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:y.not_finite,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};On.create=t=>new On({checks:[],typeName:N.ZodNumber,coerce:t?.coerce||!1,...L(t)});var jn=class t extends W{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)!==w.bigint)return this._getInvalidInput(e);let n,o=new Ee;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),x(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return x(r,{code:y.invalid_type,expected:w.bigint,received:r.parsedType}),Z}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:T.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:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};jn.create=t=>new jn({checks:[],typeName:N.ZodBigInt,coerce:t?.coerce??!1,...L(t)});var Nn=class extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){let n=this._getOrReturnCtx(e);return x(n,{code:y.invalid_type,expected:w.boolean,received:n.parsedType}),Z}return Re(e.data)}};Nn.create=t=>new Nn({typeName:N.ZodBoolean,coerce:t?.coerce||!1,...L(t)});var Rn=class t extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){let i=this._getOrReturnCtx(e);return x(i,{code:y.invalid_type,expected:w.date,received:i.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return x(i,{code:y.invalid_date}),Z}let n=new Ee,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),x(o,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),x(o,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):X.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Rn.create=t=>new Rn({checks:[],coerce:t?.coerce||!1,typeName:N.ZodDate,...L(t)});var Dn=class extends W{_parse(e){if(this._getType(e)!==w.symbol){let n=this._getOrReturnCtx(e);return x(n,{code:y.invalid_type,expected:w.symbol,received:n.parsedType}),Z}return Re(e.data)}};Dn.create=t=>new Dn({typeName:N.ZodSymbol,...L(t)});var Ar=class extends W{_parse(e){if(this._getType(e)!==w.undefined){let n=this._getOrReturnCtx(e);return x(n,{code:y.invalid_type,expected:w.undefined,received:n.parsedType}),Z}return Re(e.data)}};Ar.create=t=>new Ar({typeName:N.ZodUndefined,...L(t)});var Zr=class extends W{_parse(e){if(this._getType(e)!==w.null){let n=this._getOrReturnCtx(e);return x(n,{code:y.invalid_type,expected:w.null,received:n.parsedType}),Z}return Re(e.data)}};Zr.create=t=>new Zr({typeName:N.ZodNull,...L(t)});var An=class extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return Re(e.data)}};An.create=t=>new An({typeName:N.ZodAny,...L(t)});var Gt=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Re(e.data)}};Gt.create=t=>new Gt({typeName:N.ZodUnknown,...L(t)});var vt=class extends W{_parse(e){let r=this._getOrReturnCtx(e);return x(r,{code:y.invalid_type,expected:w.never,received:r.parsedType}),Z}};vt.create=t=>new vt({typeName:N.ZodNever,...L(t)});var Zn=class extends W{_parse(e){if(this._getType(e)!==w.undefined){let n=this._getOrReturnCtx(e);return x(n,{code:y.invalid_type,expected:w.void,received:n.parsedType}),Z}return Re(e.data)}};Zn.create=t=>new Zn({typeName:N.ZodVoid,...L(t)});var Ht=class t extends W{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==w.array)return x(r,{code:y.invalid_type,expected:w.array,received:r.parsedType}),Z;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(x(r,{code:a?y.too_big:y.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(x(r,{code:y.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(x(r,{code:y.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new et(r,a,r.path,s)))).then(a=>Ee.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new et(r,a,r.path,s)));return Ee.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:T.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:T.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:T.toString(r)}})}nonempty(e){return this.min(1,e)}};Ht.create=(t,e)=>new Ht({type:t,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...L(e)});function Rr(t){if(t instanceof Ke){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ut.create(Rr(n))}return new Ke({...t._def,shape:()=>e})}else return t instanceof Ht?new Ht({...t._def,type:Rr(t.element)}):t instanceof ut?ut.create(Rr(t.unwrap())):t instanceof Nt?Nt.create(Rr(t.unwrap())):t instanceof jt?jt.create(t.items.map(e=>Rr(e))):t}var Ke=class t extends W{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(),r=X.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==w.object){let u=this._getOrReturnCtx(e);return x(u,{code:y.invalid_type,expected:w.object,received:u.parsedType}),Z}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof vt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new et(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof vt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(x(o,{code:y.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new et(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Ee.mergeObjectSync(n,u)):Ee.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.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:N.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of X.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of X.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Rr(this)}partial(e){let r={};for(let n of X.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of X.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ut;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return Vf(X.objectKeys(this.shape))}};Ke.create=(t,e)=>new Ke({shape:()=>t,unknownKeys:"strip",catchall:vt.create(),typeName:N.ZodObject,...L(e)});Ke.strictCreate=(t,e)=>new Ke({shape:()=>t,unknownKeys:"strict",catchall:vt.create(),typeName:N.ZodObject,...L(e)});Ke.lazycreate=(t,e)=>new Ke({shape:t,unknownKeys:"strip",catchall:vt.create(),typeName:N.ZodObject,...L(e)});var Cr=class extends W{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new We(s.ctx.common.issues));return x(r,{code:y.invalid_union,unionErrors:a}),Z}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new We(c));return x(r,{code:y.invalid_union,unionErrors:s}),Z}}get options(){return this._def.options}};Cr.create=(t,e)=>new Cr({options:t,typeName:N.ZodUnion,...L(e)});var Ot=t=>t instanceof Mr?Ot(t.schema):t instanceof lt?Ot(t.innerType()):t instanceof Lr?[t.value]:t instanceof qr?t.options:t instanceof Vr?X.objectValues(t.enum):t instanceof Fr?Ot(t._def.innerType):t instanceof Ar?[void 0]:t instanceof Zr?[null]:t instanceof ut?[void 0,...Ot(t.unwrap())]:t instanceof Nt?[null,...Ot(t.unwrap())]:t instanceof yi||t instanceof Br?Ot(t.unwrap()):t instanceof Jr?Ot(t._def.innerType):[],qs=class t extends W{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.object)return x(r,{code:y.invalid_type,expected:w.object,received:r.parsedType}),Z;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(x(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=Ot(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:N.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...L(n)})}};function Vs(t,e){let r=Pt(t),n=Pt(e);if(t===e)return{valid:!0,data:t};if(r===w.object&&n===w.object){let o=X.objectKeys(e),i=X.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let c=Vs(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===w.array&&n===w.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],c=Vs(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===w.date&&n===w.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ur=class extends W{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(Us(i)||Us(a))return Z;let s=Vs(i.value,a.value);return s.valid?((Ms(i)||Ms(a))&&r.dirty(),{status:r.value,value:s.data}):(x(n,{code:y.invalid_intersection_types}),Z)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ur.create=(t,e,r)=>new Ur({left:t,right:e,typeName:N.ZodIntersection,...L(r)});var jt=class t extends W{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.array)return x(n,{code:y.invalid_type,expected:w.array,received:n.parsedType}),Z;if(n.data.length<this._def.items.length)return x(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new et(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ee.mergeArray(r,a)):Ee.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};jt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jt({items:t,typeName:N.ZodTuple,rest:null,...L(e)})};var Fs=class t extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.object)return x(n,{code:y.invalid_type,expected:w.object,received:n.parsedType}),Z;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new et(n,s,n.path,s)),value:a._parse(new et(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ee.mergeObjectAsync(r,o):Ee.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof W?new t({keyType:e,valueType:r,typeName:N.ZodRecord,...L(n)}):new t({keyType:Dr.create(),valueType:e,typeName:N.ZodRecord,...L(r)})}},Cn=class extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.map)return x(n,{code:y.invalid_type,expected:w.map,received:n.parsedType}),Z;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new et(n,s,n.path,[u,"key"])),value:i._parse(new et(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return Z;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return Z;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Cn.create=(t,e,r)=>new Cn({valueType:e,keyType:t,typeName:N.ZodMap,...L(r)});var Un=class t extends W{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.set)return x(n,{code:y.invalid_type,expected:w.set,received:n.parsedType}),Z;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(x(n,{code:y.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(x(n,{code:y.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return Z;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new et(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:T.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:T.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Un.create=(t,e)=>new Un({valueType:t,minSize:null,maxSize:null,typeName:N.ZodSet,...L(e)});var Js=class t extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.function)return x(r,{code:y.invalid_type,expected:w.function,received:r.parsedType}),Z;function n(s,c){return _i({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Tn(),Kt].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function o(s,c){return _i({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Tn(),Kt].filter(u=>!!u),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof mr){let s=this;return Re(async function(...c){let u=new We([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return Re(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new We([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new We([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:jt.create(e).rest(Gt.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,r,n){return new t({args:e||jt.create([]).rest(Gt.create()),returns:r||Gt.create(),typeName:N.ZodFunction,...L(n)})}},Mr=class extends W{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Mr.create=(t,e)=>new Mr({getter:t,typeName:N.ZodLazy,...L(e)});var Lr=class extends W{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return x(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};Lr.create=(t,e)=>new Lr({value:t,typeName:N.ZodLiteral,...L(e)});function Vf(t,e){return new qr({values:t,typeName:N.ZodEnum,...L(e)})}var qr=class t extends W{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return x(r,{expected:X.joinValues(n),received:r.parsedType,code:y.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return x(r,{received:r.data,code:y.invalid_enum_value,options:n}),Z}return Re(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};qr.create=Vf;var Vr=class extends W{_parse(e){let r=X.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==w.string&&n.parsedType!==w.number){let o=X.objectValues(r);return x(n,{expected:X.joinValues(o),received:n.parsedType,code:y.invalid_type}),Z}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=X.objectValues(r);return x(n,{received:n.data,code:y.invalid_enum_value,options:o}),Z}return Re(e.data)}get enum(){return this._def.values}};Vr.create=(t,e)=>new Vr({values:t,typeName:N.ZodNativeEnum,...L(e)});var mr=class extends W{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.promise&&r.common.async===!1)return x(r,{code:y.invalid_type,expected:w.promise,received:r.parsedType}),Z;let n=r.parsedType===w.promise?r.data:Promise.resolve(r.data);return Re(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};mr.create=(t,e)=>new mr({type:t,typeName:N.ZodPromise,...L(e)});var lt=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{x(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return Z;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?Z:c.status==="dirty"?Nr(c.value):r.value==="dirty"?Nr(c.value):c});{if(r.value==="aborted")return Z;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?Z:s.status==="dirty"?Nr(s.value):r.value==="dirty"?Nr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Z:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Z:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!fr(a))return Z;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>fr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):Z);X.assertNever(o)}};lt.create=(t,e,r)=>new lt({schema:t,typeName:N.ZodEffects,effect:e,...L(r)});lt.createWithPreprocess=(t,e,r)=>new lt({schema:e,effect:{type:"preprocess",transform:t},typeName:N.ZodEffects,...L(r)});var ut=class extends W{_parse(e){return this._getType(e)===w.undefined?Re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ut.create=(t,e)=>new ut({innerType:t,typeName:N.ZodOptional,...L(e)});var Nt=class extends W{_parse(e){return this._getType(e)===w.null?Re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Nt.create=(t,e)=>new Nt({innerType:t,typeName:N.ZodNullable,...L(e)});var Fr=class extends W{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===w.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fr.create=(t,e)=>new Fr({innerType:t,typeName:N.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});var Jr=class extends W{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Pn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new We(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new We(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Jr.create=(t,e)=>new Jr({innerType:t,typeName:N.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});var Mn=class extends W{_parse(e){if(this._getType(e)!==w.nan){let n=this._getOrReturnCtx(e);return x(n,{code:y.invalid_type,expected:w.nan,received:n.parsedType}),Z}return{status:"valid",value:e.data}}};Mn.create=t=>new Mn({typeName:N.ZodNaN,...L(t)});var yi=class extends W{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},$i=class t extends W{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?Z:i.status==="dirty"?(r.dirty(),Nr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Z:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:N.ZodPipeline})}},Br=class extends W{_parse(e){let r=this._def.innerType._parse(e),n=o=>(fr(o)&&(o.value=Object.freeze(o.value)),o);return Pn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Br.create=(t,e)=>new Br({innerType:t,typeName:N.ZodReadonly,...L(e)});var YP={object:Ke.lazycreate},N;(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"})(N||(N={}));var QP=Dr.create,eO=On.create,tO=Mn.create,rO=jn.create,nO=Nn.create,oO=Rn.create,iO=Dn.create,aO=Ar.create,sO=Zr.create,cO=An.create,uO=Gt.create,lO=vt.create,dO=Zn.create,pO=Ht.create,B$=Ke.create,fO=Ke.strictCreate,mO=Cr.create,hO=qs.create,gO=Ur.create,vO=jt.create,_O=Fs.create,yO=Cn.create,$O=Un.create,bO=Js.create,xO=Mr.create,kO=Lr.create,SO=qr.create,wO=Vr.create,zO=mr.create,IO=lt.create,EO=ut.create,TO=Nt.create,PO=lt.createWithPreprocess,OO=$i.create;var Ff=Object.freeze({status:"aborted"});function m(t,e,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}var _t=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},hr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},bi={};function be(t){return t&&Object.assign(bi,t),bi}var $={};In($,{BIGINT_FORMAT_RANGES:()=>tc,Class:()=>Ws,NUMBER_FORMAT_RANGES:()=>ec,aborted:()=>er,allowsEval:()=>Hs,assert:()=>Q$,assertEqual:()=>G$,assertIs:()=>X$,assertNever:()=>Y$,assertNotEqual:()=>H$,assignProp:()=>Yt,base64ToUint8Array:()=>Yf,base64urlToUint8Array:()=>lb,cached:()=>Kr,captureStackTrace:()=>ki,cleanEnum:()=>ub,cleanRegex:()=>Vn,clone:()=>De,cloneDef:()=>tb,createTransparentProxy:()=>sb,defineLazy:()=>q,esc:()=>xi,escapeRegex:()=>tt,extend:()=>Kf,finalizeIssue:()=>qe,floatSafeRemainder:()=>Ks,getElementAtPath:()=>rb,getEnumValues:()=>qn,getLengthableOrigin:()=>Bn,getParsedType:()=>ab,getSizableOrigin:()=>Jn,hexToUint8Array:()=>pb,isObject:()=>gr,isPlainObject:()=>Qt,issue:()=>Gr,joinValues:()=>R,jsonStringifyReplacer:()=>Wr,merge:()=>cb,mergeDefs:()=>Rt,normalizeParams:()=>k,nullish:()=>Xt,numKeys:()=>ib,objectClone:()=>eb,omit:()=>Wf,optionalKeys:()=>Qs,parsedType:()=>C,partial:()=>Hf,pick:()=>Bf,prefixIssues:()=>Ge,primitiveTypes:()=>Ys,promiseAllObject:()=>nb,propertyKeyTypes:()=>Fn,randomString:()=>ob,required:()=>Xf,safeExtend:()=>Gf,shallowClone:()=>Xs,slugify:()=>Gs,stringifyPrimitive:()=>D,uint8ArrayToBase64:()=>Qf,uint8ArrayToBase64url:()=>db,uint8ArrayToHex:()=>fb,unwrapMessage:()=>Ln});function G$(t){return t}function H$(t){return t}function X$(t){}function Y$(t){throw new Error("Unexpected value in exhaustive check")}function Q$(t){}function qn(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function R(t,e="|"){return t.map(r=>D(r)).join(e)}function Wr(t,e){return typeof e=="bigint"?e.toString():e}function Kr(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Xt(t){return t==null}function Vn(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Ks(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var Jf=Symbol("evaluating");function q(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==Jf)return n===void 0&&(n=Jf,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function eb(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Yt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Rt(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function tb(t){return Rt(t._zod.def)}function rb(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function nb(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function ob(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function xi(t){return JSON.stringify(t)}function Gs(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ki="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function gr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Hs=Kr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Qt(t){if(gr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(gr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Xs(t){return Qt(t)?{...t}:Array.isArray(t)?[...t]:t}function ib(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var ab=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}`)}},Fn=new Set(["string","number","symbol"]),Ys=new Set(["string","number","bigint","boolean","symbol","undefined"]);function tt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function De(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function k(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 sb(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function D(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Qs(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var ec={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]},tc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Bf(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Rt(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=r.shape[s])}return Yt(this,"shape",a),a},checks:[]});return De(t,i)}function Wf(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Rt(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s]}return Yt(this,"shape",a),a},checks:[]});return De(t,i)}function Kf(t,e){if(!Qt(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Rt(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Yt(this,"shape",i),i}});return De(t,o)}function Gf(t,e){if(!Qt(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Rt(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return Yt(this,"shape",n),n}});return De(t,r)}function cb(t,e){let r=Rt(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Yt(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return De(t,r)}function Hf(t,e,r){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Rt(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return Yt(this,"shape",c),c},checks:[]});return De(e,a)}function Xf(t,e,r){let n=Rt(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new t({type:"nonoptional",innerType:o[a]});return Yt(this,"shape",i),i}});return De(e,n)}function er(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Ge(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Ln(t){return typeof t=="string"?t:t?.message}function qe(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Ln(t.inst?._zod.def?.error?.(t))??Ln(e?.error?.(t))??Ln(r.customError?.(t))??Ln(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Jn(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Bn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function C(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Gr(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function ub(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Yf(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function Qf(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function lb(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Yf(e+r)}function db(t){return Qf(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function pb(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function fb(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Ws=class{constructor(...e){}};var em=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Wr,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Si=m("$ZodError",em),Wn=m("$ZodError",em,{Parent:Error});function wi(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function zi(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(t),r}var Kn=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new _t;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>qe(c,i,be())));throw ki(s,o?.callee),s}return a.value},Gn=Kn(Wn),Hn=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>qe(c,i,be())));throw ki(s,o?.callee),s}return a.value},Xn=Hn(Wn),Yn=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new _t;return i.issues.length?{success:!1,error:new(t??Si)(i.issues.map(a=>qe(a,o,be())))}:{success:!0,data:i.value}},Hr=Yn(Wn),Qn=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>qe(a,o,be())))}:{success:!0,data:i.value}},eo=Qn(Wn),tm=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Kn(t)(e,r,o)};var rm=t=>(e,r,n)=>Kn(t)(e,r,n);var nm=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Hn(t)(e,r,o)};var om=t=>async(e,r,n)=>Hn(t)(e,r,n);var im=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yn(t)(e,r,o)};var am=t=>(e,r,n)=>Yn(t)(e,r,n);var sm=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qn(t)(e,r,o)};var cm=t=>async(e,r,n)=>Qn(t)(e,r,n);var rt={};In(rt,{base64:()=>vc,base64url:()=>Ii,bigint:()=>kc,boolean:()=>wc,browserEmail:()=>xb,cidrv4:()=>hc,cidrv6:()=>gc,cuid:()=>rc,cuid2:()=>nc,date:()=>yc,datetime:()=>bc,domain:()=>wb,duration:()=>cc,e164:()=>_c,email:()=>lc,emoji:()=>dc,extendedDuration:()=>hb,guid:()=>uc,hex:()=>zb,hostname:()=>Sb,html5Email:()=>yb,idnEmail:()=>bb,integer:()=>Sc,ipv4:()=>pc,ipv6:()=>fc,ksuid:()=>ac,lowercase:()=>Ec,mac:()=>mc,md5_base64:()=>Eb,md5_base64url:()=>Tb,md5_hex:()=>Ib,nanoid:()=>sc,null:()=>zc,number:()=>Ei,rfc5322Email:()=>$b,sha1_base64:()=>Ob,sha1_base64url:()=>jb,sha1_hex:()=>Pb,sha256_base64:()=>Rb,sha256_base64url:()=>Db,sha256_hex:()=>Nb,sha384_base64:()=>Zb,sha384_base64url:()=>Cb,sha384_hex:()=>Ab,sha512_base64:()=>Mb,sha512_base64url:()=>Lb,sha512_hex:()=>Ub,string:()=>xc,time:()=>$c,ulid:()=>oc,undefined:()=>Ic,unicodeEmail:()=>um,uppercase:()=>Tc,uuid:()=>vr,uuid4:()=>gb,uuid6:()=>vb,uuid7:()=>_b,xid:()=>ic});var rc=/^[cC][^\s-]{8,}$/,nc=/^[0-9a-z]+$/,oc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ic=/^[0-9a-vA-V]{20}$/,ac=/^[A-Za-z0-9]{27}$/,sc=/^[a-zA-Z0-9_-]{21}$/,cc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hb=/^[-+]?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)?)??$/,uc=/^([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})$/,vr=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gb=vr(4),vb=vr(6),_b=vr(7),lc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,yb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$b=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,um=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,bb=um,xb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,kb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function dc(){return new RegExp(kb,"u")}var pc=/^(?:(?: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])$/,fc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,mc=t=>{let e=tt(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},hc=/^((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])$/,gc=/^(([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])$/,vc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ii=/^[A-Za-z0-9_-]*$/,Sb=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,wb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,_c=/^\+[1-9]\d{6,14}$/,lm="(?:(?:\\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])))",yc=new RegExp(`^${lm}$`);function dm(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 $c(t){return new RegExp(`^${dm(t)}$`)}function bc(t){let e=dm({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${lm}T(?:${n})$`)}var xc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},kc=/^-?\d+n?$/,Sc=/^-?\d+$/,Ei=/^-?\d+(?:\.\d+)?$/,wc=/^(?:true|false)$/i,zc=/^null$/i;var Ic=/^undefined$/i;var Ec=/^[^A-Z]*$/,Tc=/^[^a-z]*$/,zb=/^[0-9a-fA-F]*$/;function to(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ro(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var Ib=/^[0-9a-fA-F]{32}$/,Eb=to(22,"=="),Tb=ro(22),Pb=/^[0-9a-fA-F]{40}$/,Ob=to(27,"="),jb=ro(27),Nb=/^[0-9a-fA-F]{64}$/,Rb=to(43,"="),Db=ro(43),Ab=/^[0-9a-fA-F]{96}$/,Zb=to(64,""),Cb=ro(64),Ub=/^[0-9a-fA-F]{128}$/,Mb=to(86,"=="),Lb=ro(86);var se=m("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),fm={number:"number",bigint:"bigint",object:"date"},Pc=m("$ZodCheckLessThan",(t,e)=>{se.init(t,e);let r=fm[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Oc=m("$ZodCheckGreaterThan",(t,e)=>{se.init(t,e);let r=fm[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),mm=m("$ZodCheckMultipleOf",(t,e)=>{se.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Ks(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),hm=m("$ZodCheckNumberFormat",(t,e)=>{se.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=ec[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=Sc)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:t,continue:!e.abort})}}),gm=m("$ZodCheckBigIntFormat",(t,e)=>{se.init(t,e);let[r,n]=tc[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),vm=m("$ZodCheckMaxSize",(t,e)=>{var r;se.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:Jn(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),_m=m("$ZodCheckMinSize",(t,e)=>{var r;se.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:Jn(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),ym=m("$ZodCheckSizeEquals",(t,e)=>{var r;se.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:Jn(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),$m=m("$ZodCheckMaxLength",(t,e)=>{var r;se.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=Bn(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),bm=m("$ZodCheckMinLength",(t,e)=>{var r;se.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=Bn(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),xm=m("$ZodCheckLengthEquals",(t,e)=>{var r;se.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=Bn(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),no=m("$ZodCheckStringFormat",(t,e)=>{var r,n;se.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.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})}):(n=t._zod).check??(n.check=()=>{})}),km=m("$ZodCheckRegex",(t,e)=>{no.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Sm=m("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Ec),no.init(t,e)}),wm=m("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Tc),no.init(t,e)}),zm=m("$ZodCheckIncludes",(t,e)=>{se.init(t,e);let r=tt(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),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})}}),Im=m("$ZodCheckStartsWith",(t,e)=>{se.init(t,e);let r=new RegExp(`^${tt(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Em=m("$ZodCheckEndsWith",(t,e)=>{se.init(t,e);let r=new RegExp(`.*${tt(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function pm(t,e,r){t.issues.length&&e.issues.push(...Ge(r,t.issues))}var Tm=m("$ZodCheckProperty",(t,e)=>{se.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>pm(o,r,e.property));pm(n,r,e.property)}}),Pm=m("$ZodCheckMimeType",(t,e)=>{se.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),Om=m("$ZodCheckOverwrite",(t,e)=>{se.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var Ti=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 n=e.split(`
|
|
18
|
+
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(`
|
|
19
|
+
`))}};var Nm={major:4,minor:3,patch:6};var M=m("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Nm;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,c)=>{let u=er(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new _t;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=er(a,p)))});else{if(a.issues.length===p)continue;u||(u=er(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(er(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new _t;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let u=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=t._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new _t;return c.then(u=>o(u,n,s))}return o(c,n,s)}}q(t,"~standard",()=>({validate:o=>{try{let i=Hr(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return eo(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),_r=m("$ZodString",(t,e)=>{M.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??xc(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),oe=m("$ZodStringFormat",(t,e)=>{no.init(t,e),_r.init(t,e)}),Nc=m("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=uc),oe.init(t,e)}),Rc=m("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=vr(n))}else e.pattern??(e.pattern=vr());oe.init(t,e)}),Dc=m("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=lc),oe.init(t,e)}),Ac=m("$ZodURL",(t,e)=>{oe.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Zc=m("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=dc()),oe.init(t,e)}),Cc=m("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=sc),oe.init(t,e)}),Uc=m("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=rc),oe.init(t,e)}),Mc=m("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=nc),oe.init(t,e)}),Lc=m("$ZodULID",(t,e)=>{e.pattern??(e.pattern=oc),oe.init(t,e)}),qc=m("$ZodXID",(t,e)=>{e.pattern??(e.pattern=ic),oe.init(t,e)}),Vc=m("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=ac),oe.init(t,e)}),Fc=m("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=bc(e)),oe.init(t,e)}),Jc=m("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=yc),oe.init(t,e)}),Bc=m("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=$c(e)),oe.init(t,e)}),Wc=m("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=cc),oe.init(t,e)}),Kc=m("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=pc),oe.init(t,e),t._zod.bag.format="ipv4"}),Gc=m("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=fc),oe.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Hc=m("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=mc(e.delimiter)),oe.init(t,e),t._zod.bag.format="mac"}),Xc=m("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=hc),oe.init(t,e)}),Yc=m("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=gc),oe.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Jm(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Qc=m("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=vc),oe.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{Jm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function qb(t){if(!Ii.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Jm(r)}var eu=m("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ii),oe.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{qb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),tu=m("$ZodE164",(t,e)=>{e.pattern??(e.pattern=_c),oe.init(t,e)});function Vb(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var ru=m("$ZodJWT",(t,e)=>{oe.init(t,e),t._zod.check=r=>{Vb(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),nu=m("$ZodCustomStringFormat",(t,e)=>{oe.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),Di=m("$ZodNumber",(t,e)=>{M.init(t,e),t._zod.pattern=t._zod.bag.pattern??Ei,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),ou=m("$ZodNumberFormat",(t,e)=>{hm.init(t,e),Di.init(t,e)}),oo=m("$ZodBoolean",(t,e)=>{M.init(t,e),t._zod.pattern=wc,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),Ai=m("$ZodBigInt",(t,e)=>{M.init(t,e),t._zod.pattern=kc,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),iu=m("$ZodBigIntFormat",(t,e)=>{gm.init(t,e),Ai.init(t,e)}),au=m("$ZodSymbol",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),su=m("$ZodUndefined",(t,e)=>{M.init(t,e),t._zod.pattern=Ic,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),cu=m("$ZodNull",(t,e)=>{M.init(t,e),t._zod.pattern=zc,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),uu=m("$ZodAny",(t,e)=>{M.init(t,e),t._zod.parse=r=>r}),lu=m("$ZodUnknown",(t,e)=>{M.init(t,e),t._zod.parse=r=>r}),du=m("$ZodNever",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),pu=m("$ZodVoid",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),fu=m("$ZodDate",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function Rm(t,e,r){t.issues.length&&e.issues.push(...Ge(r,t.issues)),e.value[r]=t.value}var mu=m("$ZodArray",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>Rm(u,r,a))):Rm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ri(t,e,r,n,o){if(t.issues.length){if(o&&!(r in n))return;e.issues.push(...Ge(r,t.issues))}t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function Bm(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Qs(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Wm(t,e,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in e){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:e[d],issues:[]},n);p instanceof Promise?t.push(p.then(f=>Ri(f,r,d,e,l))):Ri(p,r,d,e,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var Km=m("$ZodObject",(t,e)=>{if(M.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=Kr(()=>Bm(e));q(t._zod,"propValues",()=>{let s=e.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=gr,i=e.catchall,a;t._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],g=f._zod.optout==="optional",h=f._zod.run({value:u[p],issues:[]},c);h instanceof Promise?l.push(h.then(_=>Ri(_,s,p,u,g))):Ri(h,s,p,u,g)}return i?Wm(l,u,s,c,n.value,t):l.length?Promise.all(l).then(()=>s):s}}),Gm=m("$ZodObjectJIT",(t,e)=>{Km.init(t,e);let r=t._zod.parse,n=Kr(()=>Bm(e)),o=p=>{let f=new Ti(["shape","payload","ctx"]),g=n.value,h=I=>{let A=xi(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};f.write("const input = payload.value;");let _=Object.create(null),b=0;for(let I of g.keys)_[I]=`key_${b++}`;f.write("const newResult = {};");for(let I of g.keys){let A=_[I],j=xi(I),de=p[I]?._zod?.optout==="optional";f.write(`const ${A} = ${h(I)};`),de?f.write(`
|
|
20
|
+
if (${A}.issues.length) {
|
|
21
|
+
if (${j} in input) {
|
|
22
|
+
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
23
|
+
...iss,
|
|
24
|
+
path: iss.path ? [${j}, ...iss.path] : [${j}]
|
|
25
|
+
})));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${A}.value === undefined) {
|
|
30
|
+
if (${j} in input) {
|
|
31
|
+
newResult[${j}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${j}] = ${A}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`):f.write(`
|
|
38
|
+
if (${A}.issues.length) {
|
|
39
|
+
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
|
|
40
|
+
...iss,
|
|
41
|
+
path: iss.path ? [${j}, ...iss.path] : [${j}]
|
|
42
|
+
})));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (${A}.value === undefined) {
|
|
46
|
+
if (${j} in input) {
|
|
47
|
+
newResult[${j}] = undefined;
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
newResult[${j}] = ${A}.value;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let E=f.compile();return(I,A)=>E(p,I,A)},i,a=gr,s=!bi.jitless,u=s&&Hs.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=n.value);let g=p.value;return a(g)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(e.shape)),p=i(p,f),l?Wm([],g,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),p)}});function Dm(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!er(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>qe(a,n,be())))}),e)}var io=m("$ZodUnion",(t,e)=>{M.init(t,e),q(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),q(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),q(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),q(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Vn(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Dm(c,o,t,i)):Dm(s,o,t,i)}});function Am(t,e,r,n){let o=t.filter(i=>i.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>qe(a,n,be())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var hu=m("$ZodXor",(t,e)=>{io.init(t,e),e.inclusive=!1;let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>Am(c,o,t,i)):Am(s,o,t,i)}}),gu=m("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,io.init(t,e);let r=t._zod.parse;q(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Kr(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!gr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:t}),o)}}),vu=m("$ZodIntersection",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Zm(r,c,u)):Zm(r,i,a)}});function jc(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(Qt(t)&&Qt(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=jc(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=jc(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Zm(t,e,r){let n=new Map,o;for(let s of e.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else t.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else t.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&t.issues.push({...o,keys:i}),er(t))return t;let a=jc(e.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}var Zi=m("$ZodTuple",(t,e)=>{M.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!e.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:t,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>Pi(p,n,u))):Pi(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let p=e.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(f=>Pi(f,n,u))):Pi(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Pi(t,e,r){t.issues.length&&e.issues.push(...Ge(r,t.issues)),e.value[r]=t.value}var _u=m("$ZodRecord",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Qt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],a=e.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Ge(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Ge(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=e.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Ei.test(s)&&c.issues.length){let d=e.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>qe(d,n,be())),input:s,path:[s],inst:t});continue}let l=e.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Ge(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Ge(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),yu=m("$ZodMap",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=e.keyType._zod.run({value:a,issues:[]},n),u=e.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{Cm(l,d,r,a,o,t,n)})):Cm(c,u,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function Cm(t,e,r,n,o,i,a){t.issues.length&&(Fn.has(typeof n)?r.issues.push(...Ge(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(s=>qe(s,a,be()))})),e.issues.length&&(Fn.has(typeof n)?r.issues.push(...Ge(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>qe(s,a,be()))})),r.value.set(t.value,e.value)}var $u=m("$ZodSet",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>Um(c,r))):Um(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Um(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var bu=m("$ZodEnum",(t,e)=>{M.init(t,e);let r=qn(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>Fn.has(typeof o)).map(o=>typeof o=="string"?tt(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:t}),o}}),xu=m("$ZodLiteral",(t,e)=>{if(M.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?tt(n):n?tt(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),ku=m("$ZodFile",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),Su=m("$ZodTransform",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new hr(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new _t;return r.value=o,r}});function Mm(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var Ci=m("$ZodOptional",(t,e)=>{M.init(t,e),t._zod.optin="optional",t._zod.optout="optional",q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Vn(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Mm(i,r.value)):Mm(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),wu=m("$ZodExactOptional",(t,e)=>{Ci.init(t,e),q(t._zod,"values",()=>e.innerType._zod.values),q(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),zu=m("$ZodNullable",(t,e)=>{M.init(t,e),q(t._zod,"optin",()=>e.innerType._zod.optin),q(t._zod,"optout",()=>e.innerType._zod.optout),q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Vn(r.source)}|null)$`):void 0}),q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),Iu=m("$ZodDefault",(t,e)=>{M.init(t,e),t._zod.optin="optional",q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Lm(i,e)):Lm(o,e)}});function Lm(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Eu=m("$ZodPrefault",(t,e)=>{M.init(t,e),t._zod.optin="optional",q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Tu=m("$ZodNonOptional",(t,e)=>{M.init(t,e),q(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>qm(i,t)):qm(o,t)}});function qm(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 Pu=m("$ZodSuccess",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new hr("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),Ou=m("$ZodCatch",(t,e)=>{M.init(t,e),q(t._zod,"optin",()=>e.innerType._zod.optin),q(t._zod,"optout",()=>e.innerType._zod.optout),q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>qe(a,n,be()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>qe(i,n,be()))},input:r.value}),r.issues=[]),r)}}),ju=m("$ZodNaN",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),Nu=m("$ZodPipe",(t,e)=>{M.init(t,e),q(t._zod,"values",()=>e.in._zod.values),q(t._zod,"optin",()=>e.in._zod.optin),q(t._zod,"optout",()=>e.out._zod.optout),q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Oi(a,e.in,n)):Oi(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Oi(i,e.out,n)):Oi(o,e.out,n)}});function Oi(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var ao=m("$ZodCodec",(t,e)=>{M.init(t,e),q(t._zod,"values",()=>e.in._zod.values),q(t._zod,"optin",()=>e.in._zod.optin),q(t._zod,"optout",()=>e.out._zod.optout),q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>ji(a,e,n)):ji(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>ji(a,e,n)):ji(i,e,n)}}});function ji(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>Ni(t,i,e.out,r)):Ni(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>Ni(t,i,e.in,r)):Ni(t,o,e.in,r)}}function Ni(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var Ru=m("$ZodReadonly",(t,e)=>{M.init(t,e),q(t._zod,"propValues",()=>e.innerType._zod.propValues),q(t._zod,"values",()=>e.innerType._zod.values),q(t._zod,"optin",()=>e.innerType?._zod?.optin),q(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Vm):Vm(o)}});function Vm(t){return t.value=Object.freeze(t.value),t}var Du=m("$ZodTemplateLiteral",(t,e)=>{M.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Ys.has(typeof n))r.push(tt(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"string",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),Au=m("$ZodFunction",(t,e)=>(M.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?Gn(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?Gn(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Xn(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Xn(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Zi({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),Zu=m("$ZodPromise",(t,e)=>{M.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),Cu=m("$ZodLazy",(t,e)=>{M.init(t,e),q(t._zod,"innerType",()=>e.getter()),q(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),q(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),q(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),q(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),Uu=m("$ZodCustom",(t,e)=>{se.init(t,e),M.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>Fm(i,r,n,t));Fm(o,r,n,t)}});function Fm(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Gr(o))}}var Jb=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(o){return t[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=C(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${D(o.values[0])}`:`Invalid option: expected one of ${R(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=e(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=e(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Mu(){return{localeError:Jb()}}var Hm;var qu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Vu(){return new qu}(Hm=globalThis).__zod_globalRegistry??(Hm.__zod_globalRegistry=Vu());var Ae=globalThis.__zod_globalRegistry;function Fu(t,e){return new t({type:"string",...k(e)})}function Ui(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...k(e)})}function so(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...k(e)})}function Mi(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...k(e)})}function Li(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(e)})}function qi(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(e)})}function Vi(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(e)})}function co(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...k(e)})}function Fi(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...k(e)})}function Ji(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(e)})}function Bi(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...k(e)})}function Wi(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(e)})}function Ki(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...k(e)})}function Gi(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...k(e)})}function Hi(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(e)})}function Xi(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(e)})}function Yi(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(e)})}function Ju(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...k(e)})}function Qi(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(e)})}function ea(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(e)})}function ta(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...k(e)})}function ra(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...k(e)})}function na(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...k(e)})}function oa(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...k(e)})}function Bu(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(e)})}function Wu(t,e){return new t({type:"string",format:"date",check:"string_format",...k(e)})}function Ku(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...k(e)})}function Gu(t,e){return new t({type:"string",format:"duration",check:"string_format",...k(e)})}function Hu(t,e){return new t({type:"number",checks:[],...k(e)})}function Xu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...k(e)})}function Yu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...k(e)})}function Qu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...k(e)})}function el(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...k(e)})}function tl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...k(e)})}function rl(t,e){return new t({type:"boolean",...k(e)})}function nl(t,e){return new t({type:"bigint",...k(e)})}function ol(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...k(e)})}function il(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...k(e)})}function al(t,e){return new t({type:"symbol",...k(e)})}function sl(t,e){return new t({type:"undefined",...k(e)})}function cl(t,e){return new t({type:"null",...k(e)})}function ul(t){return new t({type:"any"})}function ll(t){return new t({type:"unknown"})}function dl(t,e){return new t({type:"never",...k(e)})}function pl(t,e){return new t({type:"void",...k(e)})}function fl(t,e){return new t({type:"date",...k(e)})}function ml(t,e){return new t({type:"nan",...k(e)})}function Dt(t,e){return new Pc({check:"less_than",...k(e),value:t,inclusive:!1})}function He(t,e){return new Pc({check:"less_than",...k(e),value:t,inclusive:!0})}function At(t,e){return new Oc({check:"greater_than",...k(e),value:t,inclusive:!1})}function Ze(t,e){return new Oc({check:"greater_than",...k(e),value:t,inclusive:!0})}function hl(t){return At(0,t)}function gl(t){return Dt(0,t)}function vl(t){return He(0,t)}function _l(t){return Ze(0,t)}function yr(t,e){return new mm({check:"multiple_of",...k(e),value:t})}function $r(t,e){return new vm({check:"max_size",...k(e),maximum:t})}function Zt(t,e){return new _m({check:"min_size",...k(e),minimum:t})}function Xr(t,e){return new ym({check:"size_equals",...k(e),size:t})}function Yr(t,e){return new $m({check:"max_length",...k(e),maximum:t})}function tr(t,e){return new bm({check:"min_length",...k(e),minimum:t})}function Qr(t,e){return new xm({check:"length_equals",...k(e),length:t})}function uo(t,e){return new km({check:"string_format",format:"regex",...k(e),pattern:t})}function lo(t){return new Sm({check:"string_format",format:"lowercase",...k(t)})}function po(t){return new wm({check:"string_format",format:"uppercase",...k(t)})}function fo(t,e){return new zm({check:"string_format",format:"includes",...k(e),includes:t})}function mo(t,e){return new Im({check:"string_format",format:"starts_with",...k(e),prefix:t})}function ho(t,e){return new Em({check:"string_format",format:"ends_with",...k(e),suffix:t})}function yl(t,e,r){return new Tm({check:"property",property:t,schema:e,...k(r)})}function go(t,e){return new Pm({check:"mime_type",mime:t,...k(e)})}function yt(t){return new Om({check:"overwrite",tx:t})}function vo(t){return yt(e=>e.normalize(t))}function _o(){return yt(t=>t.trim())}function yo(){return yt(t=>t.toLowerCase())}function $o(){return yt(t=>t.toUpperCase())}function ia(){return yt(t=>Gs(t))}function Xm(t,e,r){return new t({type:"array",element:e,...k(r)})}function $l(t,e){return new t({type:"file",...k(e)})}function bl(t,e,r){let n=k(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function xl(t,e,r){return new t({type:"custom",check:"custom",fn:e,...k(r)})}function kl(t){let e=Gb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Gr(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(Gr(o))}},t(r.value,r)));return e}function Gb(t,e){let r=new se({check:"custom",...k(e)});return r._zod.check=t,r}function Sl(t){let e=new se({check:"describe"});return e._zod.onattach=[r=>{let n=Ae.get(r)??{};Ae.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function wl(t){let e=new se({check:"meta"});return e._zod.onattach=[r=>{let n=Ae.get(r)??{};Ae.add(r,{...n,...t})}],e._zod.check=()=>{},e}function zl(t,e){let r=k(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(n),a=new Set(o),s=t.Codec??ao,c=t.Boolean??oo,u=t.String??_r,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,g)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:p,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function en(t,e,r,n={}){let o=k(n),i={...k(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}function aa(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Ae,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function pe(t,e,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);let s=t._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,l);else{let p=a.schema,f=e.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(a.ref||(a.ref=d),pe(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),e.io==="input"&&Ce(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function sa(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of t.seen.entries()){let s=t.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(a[0])?.id,p=t.external.uri??(g=>g);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${t.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let a of t.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
54
|
+
|
|
55
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let s=a[1];if(e===a[0]){i(a);continue}if(t.external){let u=t.external.registry.get(a[0])?.id;if(e!==a[0]&&u){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&t.reused==="ref"){i(a);continue}}}function ca(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=t.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=t.seen.get(l),f=p.schema;if(f.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(f.$ref&&p.def)for(let h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=t.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}t.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(a)}Object.assign(o,r.def??r.schema);let i=t.external?.defs??{};for(let a of t.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:bo(e,"input",t.processors),output:bo(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ce(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ce(n.element,r);if(n.type==="set")return Ce(n.valueType,r);if(n.type==="lazy")return Ce(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ce(n.innerType,r);if(n.type==="intersection")return Ce(n.left,r)||Ce(n.right,r);if(n.type==="record"||n.type==="map")return Ce(n.keyType,r)||Ce(n.valueType,r);if(n.type==="pipe")return Ce(n.in,r)||Ce(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ce(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ce(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ce(o,r))return!0;return!!(n.rest&&Ce(n.rest,r))}return!1}var Ym=(t,e={})=>r=>{let n=aa({...r,processors:e});return pe(t,n),sa(n,t),ca(n,t)},bo=(t,e,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=aa({...o??{},target:i,io:e,processors:r});return pe(t,a),sa(a,t),ca(a,t)};var Hb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Qm=(t,e,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=Hb[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},eh=(t,e,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&e.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},th=(t,e,r,n)=>{r.type="boolean"},rh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},nh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},oh=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ih=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ah=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},sh=(t,e,r,n)=>{r.not={}},ch=(t,e,r,n)=>{},uh=(t,e,r,n)=>{},lh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},dh=(t,e,r,n)=>{let o=t._zod.def,i=qn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},ph=(t,e,r,n)=>{let o=t._zod.def,i=[];for(let a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},fh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},mh=(t,e,r,n)=>{let o=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},hh=(t,e,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=t._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},gh=(t,e,r,n)=>{r.type="boolean"},vh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_h=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},yh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},$h=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},bh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},xh=(t,e,r,n)=>{let o=r,i=t._zod.def,{minimum:a,maximum:s}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=pe(i.element,e,{...n,path:[...n.path,"items"]})},kh=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=pe(a[u],e,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=pe(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},Il=(t,e,r,n)=>{let o=t._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>pe(s,e,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Sh=(t,e,r,n)=>{let o=t._zod.def,i=pe(o.left,e,{...n,path:[...n.path,"allOf",0]}),a=pe(o.right,e,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},wh=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,f)=>pe(p,e,{...n,path:[...n.path,a,f]})),u=i.rest?pe(i.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):e.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=t._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},zh=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=pe(i.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=pe(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=pe(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Ih=(t,e,r,n)=>{let o=t._zod.def,i=pe(o.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Eh=(t,e,r,n)=>{let o=t._zod.def;pe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},Th=(t,e,r,n)=>{let o=t._zod.def;pe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Ph=(t,e,r,n)=>{let o=t._zod.def;pe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Oh=(t,e,r,n)=>{let o=t._zod.def;pe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},jh=(t,e,r,n)=>{let o=t._zod.def,i=e.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;pe(i,e,n);let a=e.seen.get(t);a.ref=i},Nh=(t,e,r,n)=>{let o=t._zod.def;pe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.readOnly=!0},Rh=(t,e,r,n)=>{let o=t._zod.def;pe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},El=(t,e,r,n)=>{let o=t._zod.def;pe(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},Dh=(t,e,r,n)=>{let o=t._zod.innerType;pe(o,e,n);let i=e.seen.get(t);i.ref=o};function tn(t){return!!t._zod}function rr(t,e){return tn(t)?Hr(t,e):t.safeParse(e)}function ua(t){if(!t)return;let e;if(tn(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Uh(t){if(tn(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var xo={};In(xo,{ZodAny:()=>ng,ZodArray:()=>sg,ZodBase64:()=>Yl,ZodBase64URL:()=>Ql,ZodBigInt:()=>_a,ZodBigIntFormat:()=>rd,ZodBoolean:()=>va,ZodCIDRv4:()=>Hl,ZodCIDRv6:()=>Xl,ZodCUID:()=>Vl,ZodCUID2:()=>Fl,ZodCatch:()=>Ig,ZodCodec:()=>ud,ZodCustom:()=>ka,ZodCustomStringFormat:()=>So,ZodDate:()=>od,ZodDefault:()=>bg,ZodDiscriminatedUnion:()=>ug,ZodE164:()=>ed,ZodEmail:()=>Ml,ZodEmoji:()=>Ll,ZodEnum:()=>ko,ZodExactOptional:()=>_g,ZodFile:()=>gg,ZodFunction:()=>Ag,ZodGUID:()=>da,ZodIPv4:()=>Kl,ZodIPv6:()=>Gl,ZodIntersection:()=>lg,ZodJWT:()=>td,ZodKSUID:()=>Wl,ZodLazy:()=>Ng,ZodLiteral:()=>hg,ZodMAC:()=>Qh,ZodMap:()=>fg,ZodNaN:()=>Tg,ZodNanoID:()=>ql,ZodNever:()=>ig,ZodNonOptional:()=>sd,ZodNull:()=>rg,ZodNullable:()=>$g,ZodNumber:()=>ga,ZodNumberFormat:()=>rn,ZodObject:()=>ya,ZodOptional:()=>ad,ZodPipe:()=>cd,ZodPrefault:()=>kg,ZodPromise:()=>Dg,ZodReadonly:()=>Pg,ZodRecord:()=>xa,ZodSet:()=>mg,ZodString:()=>ma,ZodStringFormat:()=>ce,ZodSuccess:()=>zg,ZodSymbol:()=>eg,ZodTemplateLiteral:()=>jg,ZodTransform:()=>vg,ZodTuple:()=>dg,ZodType:()=>V,ZodULID:()=>Jl,ZodURL:()=>ha,ZodUUID:()=>Ct,ZodUndefined:()=>tg,ZodUnion:()=>$a,ZodUnknown:()=>og,ZodVoid:()=>ag,ZodXID:()=>Bl,ZodXor:()=>cg,_ZodString:()=>Ul,_default:()=>xg,_function:()=>mk,any:()=>Hx,array:()=>G,base64:()=>Nx,base64url:()=>Rx,bigint:()=>Jx,boolean:()=>$e,catch:()=>Eg,check:()=>hk,cidrv4:()=>Ox,cidrv6:()=>jx,codec:()=>dk,cuid:()=>kx,cuid2:()=>Sx,custom:()=>ld,date:()=>Yx,describe:()=>gk,discriminatedUnion:()=>ba,e164:()=>Dx,email:()=>fx,emoji:()=>bx,enum:()=>Pe,exactOptional:()=>yg,file:()=>sk,float32:()=>Lx,float64:()=>qx,function:()=>mk,guid:()=>mx,hash:()=>Mx,hex:()=>Ux,hostname:()=>Cx,httpUrl:()=>$x,instanceof:()=>_k,int:()=>Cl,int32:()=>Vx,int64:()=>Bx,intersection:()=>zo,ipv4:()=>Ex,ipv6:()=>Px,json:()=>$k,jwt:()=>Ax,keyof:()=>Qx,ksuid:()=>Ix,lazy:()=>Rg,literal:()=>P,looseObject:()=>Te,looseRecord:()=>nk,mac:()=>Tx,map:()=>ok,meta:()=>vk,nan:()=>lk,nanoid:()=>xx,nativeEnum:()=>ak,never:()=>nd,nonoptional:()=>wg,null:()=>wo,nullable:()=>pa,nullish:()=>ck,number:()=>ne,object:()=>z,optional:()=>me,partialRecord:()=>rk,pipe:()=>fa,prefault:()=>Sg,preprocess:()=>Sa,promise:()=>fk,readonly:()=>Og,record:()=>fe,refine:()=>Zg,set:()=>ik,strictObject:()=>ek,string:()=>v,stringFormat:()=>Zx,stringbool:()=>yk,success:()=>uk,superRefine:()=>Cg,symbol:()=>Kx,templateLiteral:()=>pk,transform:()=>id,tuple:()=>pg,uint32:()=>Fx,uint64:()=>Wx,ulid:()=>wx,undefined:()=>Gx,union:()=>ie,unknown:()=>ue,url:()=>yx,uuid:()=>hx,uuidv4:()=>gx,uuidv6:()=>vx,uuidv7:()=>_x,void:()=>Xx,xid:()=>zx,xor:()=>tk});var la={};In(la,{endsWith:()=>ho,gt:()=>At,gte:()=>Ze,includes:()=>fo,length:()=>Qr,lowercase:()=>lo,lt:()=>Dt,lte:()=>He,maxLength:()=>Yr,maxSize:()=>$r,mime:()=>go,minLength:()=>tr,minSize:()=>Zt,multipleOf:()=>yr,negative:()=>gl,nonnegative:()=>_l,nonpositive:()=>vl,normalize:()=>vo,overwrite:()=>yt,positive:()=>hl,property:()=>yl,regex:()=>uo,size:()=>Xr,slugify:()=>ia,startsWith:()=>mo,toLowerCase:()=>yo,toUpperCase:()=>$o,trim:()=>_o,uppercase:()=>po});var br={};In(br,{ZodISODate:()=>jl,ZodISODateTime:()=>Pl,ZodISODuration:()=>Al,ZodISOTime:()=>Rl,date:()=>Nl,datetime:()=>Ol,duration:()=>Zl,time:()=>Dl});var Pl=m("ZodISODateTime",(t,e)=>{Fc.init(t,e),ce.init(t,e)});function Ol(t){return Bu(Pl,t)}var jl=m("ZodISODate",(t,e)=>{Jc.init(t,e),ce.init(t,e)});function Nl(t){return Wu(jl,t)}var Rl=m("ZodISOTime",(t,e)=>{Bc.init(t,e),ce.init(t,e)});function Dl(t){return Ku(Rl,t)}var Al=m("ZodISODuration",(t,e)=>{Wc.init(t,e),ce.init(t,e)});function Zl(t){return Gu(Al,t)}var Mh=(t,e)=>{Si.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>zi(t,r)},flatten:{value:r=>wi(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Wr,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Wr,2)}},isEmpty:{get(){return t.issues.length===0}}})},ND=m("ZodError",Mh),Xe=m("ZodError",Mh,{Parent:Error});var Lh=Kn(Xe),qh=Hn(Xe),Vh=Yn(Xe),Fh=Qn(Xe),Jh=tm(Xe),Bh=rm(Xe),Wh=nm(Xe),Kh=om(Xe),Gh=im(Xe),Hh=am(Xe),Xh=sm(Xe),Yh=cm(Xe);var V=m("ZodType",(t,e)=>(M.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:bo(t,"input"),output:bo(t,"output")}}),t.toJSONSchema=Ym(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone($.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),t.with=t.check,t.clone=(r,n)=>De(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>Lh(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Vh(t,r,n),t.parseAsync=async(r,n)=>qh(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Fh(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>Jh(t,r,n),t.decode=(r,n)=>Bh(t,r,n),t.encodeAsync=async(r,n)=>Wh(t,r,n),t.decodeAsync=async(r,n)=>Kh(t,r,n),t.safeEncode=(r,n)=>Gh(t,r,n),t.safeDecode=(r,n)=>Hh(t,r,n),t.safeEncodeAsync=async(r,n)=>Xh(t,r,n),t.safeDecodeAsync=async(r,n)=>Yh(t,r,n),t.refine=(r,n)=>t.check(Zg(r,n)),t.superRefine=r=>t.check(Cg(r)),t.overwrite=r=>t.check(yt(r)),t.optional=()=>me(t),t.exactOptional=()=>yg(t),t.nullable=()=>pa(t),t.nullish=()=>me(pa(t)),t.nonoptional=r=>wg(t,r),t.array=()=>G(t),t.or=r=>ie([t,r]),t.and=r=>zo(t,r),t.transform=r=>fa(t,id(r)),t.default=r=>xg(t,r),t.prefault=r=>Sg(t,r),t.catch=r=>Eg(t,r),t.pipe=r=>fa(t,r),t.readonly=()=>Og(t),t.describe=r=>{let n=t.clone();return Ae.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ae.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ae.get(t);let n=t.clone();return Ae.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=r=>r(t),t)),Ul=m("_ZodString",(t,e)=>{_r.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Qm(t,n,o,i);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(uo(...n)),t.includes=(...n)=>t.check(fo(...n)),t.startsWith=(...n)=>t.check(mo(...n)),t.endsWith=(...n)=>t.check(ho(...n)),t.min=(...n)=>t.check(tr(...n)),t.max=(...n)=>t.check(Yr(...n)),t.length=(...n)=>t.check(Qr(...n)),t.nonempty=(...n)=>t.check(tr(1,...n)),t.lowercase=n=>t.check(lo(n)),t.uppercase=n=>t.check(po(n)),t.trim=()=>t.check(_o()),t.normalize=(...n)=>t.check(vo(...n)),t.toLowerCase=()=>t.check(yo()),t.toUpperCase=()=>t.check($o()),t.slugify=()=>t.check(ia())}),ma=m("ZodString",(t,e)=>{_r.init(t,e),Ul.init(t,e),t.email=r=>t.check(Ui(Ml,r)),t.url=r=>t.check(co(ha,r)),t.jwt=r=>t.check(oa(td,r)),t.emoji=r=>t.check(Fi(Ll,r)),t.guid=r=>t.check(so(da,r)),t.uuid=r=>t.check(Mi(Ct,r)),t.uuidv4=r=>t.check(Li(Ct,r)),t.uuidv6=r=>t.check(qi(Ct,r)),t.uuidv7=r=>t.check(Vi(Ct,r)),t.nanoid=r=>t.check(Ji(ql,r)),t.guid=r=>t.check(so(da,r)),t.cuid=r=>t.check(Bi(Vl,r)),t.cuid2=r=>t.check(Wi(Fl,r)),t.ulid=r=>t.check(Ki(Jl,r)),t.base64=r=>t.check(ta(Yl,r)),t.base64url=r=>t.check(ra(Ql,r)),t.xid=r=>t.check(Gi(Bl,r)),t.ksuid=r=>t.check(Hi(Wl,r)),t.ipv4=r=>t.check(Xi(Kl,r)),t.ipv6=r=>t.check(Yi(Gl,r)),t.cidrv4=r=>t.check(Qi(Hl,r)),t.cidrv6=r=>t.check(ea(Xl,r)),t.e164=r=>t.check(na(ed,r)),t.datetime=r=>t.check(Ol(r)),t.date=r=>t.check(Nl(r)),t.time=r=>t.check(Dl(r)),t.duration=r=>t.check(Zl(r))});function v(t){return Fu(ma,t)}var ce=m("ZodStringFormat",(t,e)=>{oe.init(t,e),Ul.init(t,e)}),Ml=m("ZodEmail",(t,e)=>{Dc.init(t,e),ce.init(t,e)});function fx(t){return Ui(Ml,t)}var da=m("ZodGUID",(t,e)=>{Nc.init(t,e),ce.init(t,e)});function mx(t){return so(da,t)}var Ct=m("ZodUUID",(t,e)=>{Rc.init(t,e),ce.init(t,e)});function hx(t){return Mi(Ct,t)}function gx(t){return Li(Ct,t)}function vx(t){return qi(Ct,t)}function _x(t){return Vi(Ct,t)}var ha=m("ZodURL",(t,e)=>{Ac.init(t,e),ce.init(t,e)});function yx(t){return co(ha,t)}function $x(t){return co(ha,{protocol:/^https?$/,hostname:rt.domain,...$.normalizeParams(t)})}var Ll=m("ZodEmoji",(t,e)=>{Zc.init(t,e),ce.init(t,e)});function bx(t){return Fi(Ll,t)}var ql=m("ZodNanoID",(t,e)=>{Cc.init(t,e),ce.init(t,e)});function xx(t){return Ji(ql,t)}var Vl=m("ZodCUID",(t,e)=>{Uc.init(t,e),ce.init(t,e)});function kx(t){return Bi(Vl,t)}var Fl=m("ZodCUID2",(t,e)=>{Mc.init(t,e),ce.init(t,e)});function Sx(t){return Wi(Fl,t)}var Jl=m("ZodULID",(t,e)=>{Lc.init(t,e),ce.init(t,e)});function wx(t){return Ki(Jl,t)}var Bl=m("ZodXID",(t,e)=>{qc.init(t,e),ce.init(t,e)});function zx(t){return Gi(Bl,t)}var Wl=m("ZodKSUID",(t,e)=>{Vc.init(t,e),ce.init(t,e)});function Ix(t){return Hi(Wl,t)}var Kl=m("ZodIPv4",(t,e)=>{Kc.init(t,e),ce.init(t,e)});function Ex(t){return Xi(Kl,t)}var Qh=m("ZodMAC",(t,e)=>{Hc.init(t,e),ce.init(t,e)});function Tx(t){return Ju(Qh,t)}var Gl=m("ZodIPv6",(t,e)=>{Gc.init(t,e),ce.init(t,e)});function Px(t){return Yi(Gl,t)}var Hl=m("ZodCIDRv4",(t,e)=>{Xc.init(t,e),ce.init(t,e)});function Ox(t){return Qi(Hl,t)}var Xl=m("ZodCIDRv6",(t,e)=>{Yc.init(t,e),ce.init(t,e)});function jx(t){return ea(Xl,t)}var Yl=m("ZodBase64",(t,e)=>{Qc.init(t,e),ce.init(t,e)});function Nx(t){return ta(Yl,t)}var Ql=m("ZodBase64URL",(t,e)=>{eu.init(t,e),ce.init(t,e)});function Rx(t){return ra(Ql,t)}var ed=m("ZodE164",(t,e)=>{tu.init(t,e),ce.init(t,e)});function Dx(t){return na(ed,t)}var td=m("ZodJWT",(t,e)=>{ru.init(t,e),ce.init(t,e)});function Ax(t){return oa(td,t)}var So=m("ZodCustomStringFormat",(t,e)=>{nu.init(t,e),ce.init(t,e)});function Zx(t,e,r={}){return en(So,t,e,r)}function Cx(t){return en(So,"hostname",rt.hostname,t)}function Ux(t){return en(So,"hex",rt.hex,t)}function Mx(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=rt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return en(So,n,o,e)}var ga=m("ZodNumber",(t,e)=>{Di.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>eh(t,n,o,i),t.gt=(n,o)=>t.check(At(n,o)),t.gte=(n,o)=>t.check(Ze(n,o)),t.min=(n,o)=>t.check(Ze(n,o)),t.lt=(n,o)=>t.check(Dt(n,o)),t.lte=(n,o)=>t.check(He(n,o)),t.max=(n,o)=>t.check(He(n,o)),t.int=n=>t.check(Cl(n)),t.safe=n=>t.check(Cl(n)),t.positive=n=>t.check(At(0,n)),t.nonnegative=n=>t.check(Ze(0,n)),t.negative=n=>t.check(Dt(0,n)),t.nonpositive=n=>t.check(He(0,n)),t.multipleOf=(n,o)=>t.check(yr(n,o)),t.step=(n,o)=>t.check(yr(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function ne(t){return Hu(ga,t)}var rn=m("ZodNumberFormat",(t,e)=>{ou.init(t,e),ga.init(t,e)});function Cl(t){return Xu(rn,t)}function Lx(t){return Yu(rn,t)}function qx(t){return Qu(rn,t)}function Vx(t){return el(rn,t)}function Fx(t){return tl(rn,t)}var va=m("ZodBoolean",(t,e)=>{oo.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>th(t,r,n,o)});function $e(t){return rl(va,t)}var _a=m("ZodBigInt",(t,e)=>{Ai.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>rh(t,n,o,i),t.gte=(n,o)=>t.check(Ze(n,o)),t.min=(n,o)=>t.check(Ze(n,o)),t.gt=(n,o)=>t.check(At(n,o)),t.gte=(n,o)=>t.check(Ze(n,o)),t.min=(n,o)=>t.check(Ze(n,o)),t.lt=(n,o)=>t.check(Dt(n,o)),t.lte=(n,o)=>t.check(He(n,o)),t.max=(n,o)=>t.check(He(n,o)),t.positive=n=>t.check(At(BigInt(0),n)),t.negative=n=>t.check(Dt(BigInt(0),n)),t.nonpositive=n=>t.check(He(BigInt(0),n)),t.nonnegative=n=>t.check(Ze(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(yr(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function Jx(t){return nl(_a,t)}var rd=m("ZodBigIntFormat",(t,e)=>{iu.init(t,e),_a.init(t,e)});function Bx(t){return ol(rd,t)}function Wx(t){return il(rd,t)}var eg=m("ZodSymbol",(t,e)=>{au.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>nh(t,r,n,o)});function Kx(t){return al(eg,t)}var tg=m("ZodUndefined",(t,e)=>{su.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ih(t,r,n,o)});function Gx(t){return sl(tg,t)}var rg=m("ZodNull",(t,e)=>{cu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>oh(t,r,n,o)});function wo(t){return cl(rg,t)}var ng=m("ZodAny",(t,e)=>{uu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ch(t,r,n,o)});function Hx(){return ul(ng)}var og=m("ZodUnknown",(t,e)=>{lu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>uh(t,r,n,o)});function ue(){return ll(og)}var ig=m("ZodNever",(t,e)=>{du.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>sh(t,r,n,o)});function nd(t){return dl(ig,t)}var ag=m("ZodVoid",(t,e)=>{pu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ah(t,r,n,o)});function Xx(t){return pl(ag,t)}var od=m("ZodDate",(t,e)=>{fu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>lh(t,n,o,i),t.min=(n,o)=>t.check(Ze(n,o)),t.max=(n,o)=>t.check(He(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function Yx(t){return fl(od,t)}var sg=m("ZodArray",(t,e)=>{mu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>xh(t,r,n,o),t.element=e.element,t.min=(r,n)=>t.check(tr(r,n)),t.nonempty=r=>t.check(tr(1,r)),t.max=(r,n)=>t.check(Yr(r,n)),t.length=(r,n)=>t.check(Qr(r,n)),t.unwrap=()=>t.element});function G(t,e){return Xm(sg,t,e)}function Qx(t){let e=t._zod.def.shape;return Pe(Object.keys(e))}var ya=m("ZodObject",(t,e)=>{Gm.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>kh(t,r,n,o),$.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Pe(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ue()}),t.loose=()=>t.clone({...t._zod.def,catchall:ue()}),t.strict=()=>t.clone({...t._zod.def,catchall:nd()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>$.extend(t,r),t.safeExtend=r=>$.safeExtend(t,r),t.merge=r=>$.merge(t,r),t.pick=r=>$.pick(t,r),t.omit=r=>$.omit(t,r),t.partial=(...r)=>$.partial(ad,t,r[0]),t.required=(...r)=>$.required(sd,t,r[0])});function z(t,e){let r={type:"object",shape:t??{},...$.normalizeParams(e)};return new ya(r)}function ek(t,e){return new ya({type:"object",shape:t,catchall:nd(),...$.normalizeParams(e)})}function Te(t,e){return new ya({type:"object",shape:t,catchall:ue(),...$.normalizeParams(e)})}var $a=m("ZodUnion",(t,e)=>{io.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Il(t,r,n,o),t.options=e.options});function ie(t,e){return new $a({type:"union",options:t,...$.normalizeParams(e)})}var cg=m("ZodXor",(t,e)=>{$a.init(t,e),hu.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Il(t,r,n,o),t.options=e.options});function tk(t,e){return new cg({type:"union",options:t,inclusive:!1,...$.normalizeParams(e)})}var ug=m("ZodDiscriminatedUnion",(t,e)=>{$a.init(t,e),gu.init(t,e)});function ba(t,e,r){return new ug({type:"union",options:e,discriminator:t,...$.normalizeParams(r)})}var lg=m("ZodIntersection",(t,e)=>{vu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Sh(t,r,n,o)});function zo(t,e){return new lg({type:"intersection",left:t,right:e})}var dg=m("ZodTuple",(t,e)=>{Zi.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>wh(t,r,n,o),t.rest=r=>t.clone({...t._zod.def,rest:r})});function pg(t,e,r){let n=e instanceof M,o=n?r:e,i=n?e:null;return new dg({type:"tuple",items:t,rest:i,...$.normalizeParams(o)})}var xa=m("ZodRecord",(t,e)=>{_u.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>zh(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function fe(t,e,r){return new xa({type:"record",keyType:t,valueType:e,...$.normalizeParams(r)})}function rk(t,e,r){let n=De(t);return n._zod.values=void 0,new xa({type:"record",keyType:n,valueType:e,...$.normalizeParams(r)})}function nk(t,e,r){return new xa({type:"record",keyType:t,valueType:e,mode:"loose",...$.normalizeParams(r)})}var fg=m("ZodMap",(t,e)=>{yu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>$h(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(Zt(...r)),t.nonempty=r=>t.check(Zt(1,r)),t.max=(...r)=>t.check($r(...r)),t.size=(...r)=>t.check(Xr(...r))});function ok(t,e,r){return new fg({type:"map",keyType:t,valueType:e,...$.normalizeParams(r)})}var mg=m("ZodSet",(t,e)=>{$u.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>bh(t,r,n,o),t.min=(...r)=>t.check(Zt(...r)),t.nonempty=r=>t.check(Zt(1,r)),t.max=(...r)=>t.check($r(...r)),t.size=(...r)=>t.check(Xr(...r))});function ik(t,e){return new mg({type:"set",valueType:t,...$.normalizeParams(e)})}var ko=m("ZodEnum",(t,e)=>{bu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,o,i)=>dh(t,n,o,i),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ko({...e,checks:[],...$.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ko({...e,checks:[],...$.normalizeParams(o),entries:i})}});function Pe(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new ko({type:"enum",entries:r,...$.normalizeParams(e)})}function ak(t,e){return new ko({type:"enum",entries:t,...$.normalizeParams(e)})}var hg=m("ZodLiteral",(t,e)=>{xu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ph(t,r,n,o),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 P(t,e){return new hg({type:"literal",values:Array.isArray(t)?t:[t],...$.normalizeParams(e)})}var gg=m("ZodFile",(t,e)=>{ku.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>hh(t,r,n,o),t.min=(r,n)=>t.check(Zt(r,n)),t.max=(r,n)=>t.check($r(r,n)),t.mime=(r,n)=>t.check(go(Array.isArray(r)?r:[r],n))});function sk(t){return $l(gg,t)}var vg=m("ZodTransform",(t,e)=>{Su.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>yh(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new hr(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push($.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function id(t){return new vg({type:"transform",transform:t})}var ad=m("ZodOptional",(t,e)=>{Ci.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>El(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function me(t){return new ad({type:"optional",innerType:t})}var _g=m("ZodExactOptional",(t,e)=>{wu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>El(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function yg(t){return new _g({type:"optional",innerType:t})}var $g=m("ZodNullable",(t,e)=>{zu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ih(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function pa(t){return new $g({type:"nullable",innerType:t})}function ck(t){return me(pa(t))}var bg=m("ZodDefault",(t,e)=>{Iu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Th(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function xg(t,e){return new bg({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():$.shallowClone(e)}})}var kg=m("ZodPrefault",(t,e)=>{Eu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ph(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Sg(t,e){return new kg({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():$.shallowClone(e)}})}var sd=m("ZodNonOptional",(t,e)=>{Tu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Eh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function wg(t,e){return new sd({type:"nonoptional",innerType:t,...$.normalizeParams(e)})}var zg=m("ZodSuccess",(t,e)=>{Pu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>gh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function uk(t){return new zg({type:"success",innerType:t})}var Ig=m("ZodCatch",(t,e)=>{Ou.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Oh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Eg(t,e){return new Ig({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Tg=m("ZodNaN",(t,e)=>{ju.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>fh(t,r,n,o)});function lk(t){return ml(Tg,t)}var cd=m("ZodPipe",(t,e)=>{Nu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>jh(t,r,n,o),t.in=e.in,t.out=e.out});function fa(t,e){return new cd({type:"pipe",in:t,out:e})}var ud=m("ZodCodec",(t,e)=>{cd.init(t,e),ao.init(t,e)});function dk(t,e,r){return new ud({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var Pg=m("ZodReadonly",(t,e)=>{Ru.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Nh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Og(t){return new Pg({type:"readonly",innerType:t})}var jg=m("ZodTemplateLiteral",(t,e)=>{Du.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>mh(t,r,n,o)});function pk(t,e){return new jg({type:"template_literal",parts:t,...$.normalizeParams(e)})}var Ng=m("ZodLazy",(t,e)=>{Cu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Dh(t,r,n,o),t.unwrap=()=>t._zod.def.getter()});function Rg(t){return new Ng({type:"lazy",getter:t})}var Dg=m("ZodPromise",(t,e)=>{Zu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Rh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function fk(t){return new Dg({type:"promise",innerType:t})}var Ag=m("ZodFunction",(t,e)=>{Au.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>_h(t,r,n,o)});function mk(t){return new Ag({type:"function",input:Array.isArray(t?.input)?pg(t?.input):t?.input??G(ue()),output:t?.output??ue()})}var ka=m("ZodCustom",(t,e)=>{Uu.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,n,o)=>vh(t,r,n,o)});function hk(t){let e=new se({check:"custom"});return e._zod.check=t,e}function ld(t,e){return bl(ka,t??(()=>!0),e)}function Zg(t,e={}){return xl(ka,t,e)}function Cg(t){return kl(t)}var gk=Sl,vk=wl;function _k(t,e={}){let r=new ka({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...$.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var yk=(...t)=>zl({Codec:ud,Boolean:va,String:ma},...t);function $k(t){let e=Rg(()=>ie([v(t),ne(),$e(),wo(),G(e),fe(v(),e)]));return e}function Sa(t,e){return fa(id(t),e)}var Ug;Ug||(Ug={});var LD={...xo,...la,iso:br};be(Mu());var pd="2025-11-25";var Mg=[pd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nr="io.modelcontextprotocol/related-task",za="2.0",xe=ld(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Lg=ie([v(),ne().int()]),qg=v(),a1=Te({ttl:ie([ne(),wo()]).optional(),pollInterval:ne().optional()}),Sk=z({ttl:ne().optional()}),wk=z({taskId:v()}),fd=Te({progressToken:Lg.optional(),[nr]:wk.optional()}),Ye=z({_meta:fd.optional()}),Io=Ye.extend({task:Sk.optional()}),Vg=t=>Io.safeParse(t).success,ke=z({method:v(),params:Ye.loose().optional()}),nt=z({_meta:fd.optional()}),ot=z({method:v(),params:nt.loose().optional()}),Se=Te({_meta:fd.optional()}),Ia=ie([v(),ne().int()]),Fg=z({jsonrpc:P(za),id:Ia,...ke.shape}).strict(),md=t=>Fg.safeParse(t).success,Jg=z({jsonrpc:P(za),...ot.shape}).strict(),Bg=t=>Jg.safeParse(t).success,hd=z({jsonrpc:P(za),id:Ia,result:Se}).strict(),Eo=t=>hd.safeParse(t).success;var Y;(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"})(Y||(Y={}));var gd=z({jsonrpc:P(za),id:Ia.optional(),error:z({code:ne().int(),message:v(),data:ue().optional()})}).strict();var Wg=t=>gd.safeParse(t).success;var Kg=ie([Fg,Jg,hd,gd]),s1=ie([hd,gd]),Ea=Se.strict(),zk=nt.extend({requestId:Ia.optional(),reason:v().optional()}),Ta=ot.extend({method:P("notifications/cancelled"),params:zk}),Ik=z({src:v(),mimeType:v().optional(),sizes:G(v()).optional(),theme:Pe(["light","dark"]).optional()}),To=z({icons:G(Ik).optional()}),nn=z({name:v(),title:v().optional()}),Gg=nn.extend({...nn.shape,...To.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Ek=zo(z({applyDefaults:$e().optional()}),fe(v(),ue())),Tk=Sa(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,zo(z({form:Ek.optional(),url:xe.optional()}),fe(v(),ue()).optional())),Pk=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({sampling:Te({createMessage:xe.optional()}).optional(),elicitation:Te({create:xe.optional()}).optional()}).optional()}),Ok=Te({list:xe.optional(),cancel:xe.optional(),requests:Te({tools:Te({call:xe.optional()}).optional()}).optional()}),jk=z({experimental:fe(v(),xe).optional(),sampling:z({context:xe.optional(),tools:xe.optional()}).optional(),elicitation:Tk.optional(),roots:z({listChanged:$e().optional()}).optional(),tasks:Pk.optional()}),Nk=Ye.extend({protocolVersion:v(),capabilities:jk,clientInfo:Gg}),vd=ke.extend({method:P("initialize"),params:Nk});var Rk=z({experimental:fe(v(),xe).optional(),logging:xe.optional(),completions:xe.optional(),prompts:z({listChanged:$e().optional()}).optional(),resources:z({subscribe:$e().optional(),listChanged:$e().optional()}).optional(),tools:z({listChanged:$e().optional()}).optional(),tasks:Ok.optional()}),Dk=Se.extend({protocolVersion:v(),capabilities:Rk,serverInfo:Gg,instructions:v().optional()}),_d=ot.extend({method:P("notifications/initialized"),params:nt.optional()});var Pa=ke.extend({method:P("ping"),params:Ye.optional()}),Ak=z({progress:ne(),total:me(ne()),message:me(v())}),Zk=z({...nt.shape,...Ak.shape,progressToken:Lg}),Oa=ot.extend({method:P("notifications/progress"),params:Zk}),Ck=Ye.extend({cursor:qg.optional()}),Po=ke.extend({params:Ck.optional()}),Oo=Se.extend({nextCursor:qg.optional()}),Uk=Pe(["working","input_required","completed","failed","cancelled"]),jo=z({taskId:v(),status:Uk,ttl:ie([ne(),wo()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:me(ne()),statusMessage:me(v())}),on=Se.extend({task:jo}),Mk=nt.merge(jo),No=ot.extend({method:P("notifications/tasks/status"),params:Mk}),ja=ke.extend({method:P("tasks/get"),params:Ye.extend({taskId:v()})}),Na=Se.merge(jo),Ra=ke.extend({method:P("tasks/result"),params:Ye.extend({taskId:v()})}),c1=Se.loose(),Da=Po.extend({method:P("tasks/list")}),Aa=Oo.extend({tasks:G(jo)}),Za=ke.extend({method:P("tasks/cancel"),params:Ye.extend({taskId:v()})}),Hg=Se.merge(jo),Xg=z({uri:v(),mimeType:me(v()),_meta:fe(v(),ue()).optional()}),Yg=Xg.extend({text:v()}),yd=v().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Qg=Xg.extend({blob:yd}),Ro=Pe(["user","assistant"]),an=z({audience:G(Ro).optional(),priority:ne().min(0).max(1).optional(),lastModified:br.datetime({offset:!0}).optional()}),ev=z({...nn.shape,...To.shape,uri:v(),description:me(v()),mimeType:me(v()),annotations:an.optional(),_meta:me(Te({}))}),Lk=z({...nn.shape,...To.shape,uriTemplate:v(),description:me(v()),mimeType:me(v()),annotations:an.optional(),_meta:me(Te({}))}),qk=Po.extend({method:P("resources/list")}),Vk=Oo.extend({resources:G(ev)}),Fk=Po.extend({method:P("resources/templates/list")}),Jk=Oo.extend({resourceTemplates:G(Lk)}),$d=Ye.extend({uri:v()}),Bk=$d,Wk=ke.extend({method:P("resources/read"),params:Bk}),Kk=Se.extend({contents:G(ie([Yg,Qg]))}),Gk=ot.extend({method:P("notifications/resources/list_changed"),params:nt.optional()}),Hk=$d,Xk=ke.extend({method:P("resources/subscribe"),params:Hk}),Yk=$d,Qk=ke.extend({method:P("resources/unsubscribe"),params:Yk}),eS=nt.extend({uri:v()}),tS=ot.extend({method:P("notifications/resources/updated"),params:eS}),rS=z({name:v(),description:me(v()),required:me($e())}),nS=z({...nn.shape,...To.shape,description:me(v()),arguments:me(G(rS)),_meta:me(Te({}))}),oS=Po.extend({method:P("prompts/list")}),iS=Oo.extend({prompts:G(nS)}),aS=Ye.extend({name:v(),arguments:fe(v(),v()).optional()}),sS=ke.extend({method:P("prompts/get"),params:aS}),bd=z({type:P("text"),text:v(),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),xd=z({type:P("image"),data:yd,mimeType:v(),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),kd=z({type:P("audio"),data:yd,mimeType:v(),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),cS=z({type:P("tool_use"),name:v(),id:v(),input:fe(v(),ue()),_meta:fe(v(),ue()).optional()}),uS=z({type:P("resource"),resource:ie([Yg,Qg]),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),lS=ev.extend({type:P("resource_link")}),Sd=ie([bd,xd,kd,lS,uS]),dS=z({role:Ro,content:Sd}),pS=Se.extend({description:v().optional(),messages:G(dS)}),fS=ot.extend({method:P("notifications/prompts/list_changed"),params:nt.optional()}),mS=z({title:v().optional(),readOnlyHint:$e().optional(),destructiveHint:$e().optional(),idempotentHint:$e().optional(),openWorldHint:$e().optional()}),hS=z({taskSupport:Pe(["required","optional","forbidden"]).optional()}),tv=z({...nn.shape,...To.shape,description:v().optional(),inputSchema:z({type:P("object"),properties:fe(v(),xe).optional(),required:G(v()).optional()}).catchall(ue()),outputSchema:z({type:P("object"),properties:fe(v(),xe).optional(),required:G(v()).optional()}).catchall(ue()).optional(),annotations:mS.optional(),execution:hS.optional(),_meta:fe(v(),ue()).optional()}),wd=Po.extend({method:P("tools/list")}),gS=Oo.extend({tools:G(tv)}),Ca=Se.extend({content:G(Sd).default([]),structuredContent:fe(v(),ue()).optional(),isError:$e().optional()}),u1=Ca.or(Se.extend({toolResult:ue()})),vS=Io.extend({name:v(),arguments:fe(v(),ue()).optional()}),Do=ke.extend({method:P("tools/call"),params:vS}),_S=ot.extend({method:P("notifications/tools/list_changed"),params:nt.optional()}),l1=z({autoRefresh:$e().default(!0),debounceMs:ne().int().nonnegative().default(300)}),Ao=Pe(["debug","info","notice","warning","error","critical","alert","emergency"]),yS=Ye.extend({level:Ao}),zd=ke.extend({method:P("logging/setLevel"),params:yS}),$S=nt.extend({level:Ao,logger:v().optional(),data:ue()}),bS=ot.extend({method:P("notifications/message"),params:$S}),xS=z({name:v().optional()}),kS=z({hints:G(xS).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),SS=z({mode:Pe(["auto","required","none"]).optional()}),wS=z({type:P("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:G(Sd).default([]),structuredContent:z({}).loose().optional(),isError:$e().optional(),_meta:fe(v(),ue()).optional()}),zS=ba("type",[bd,xd,kd]),wa=ba("type",[bd,xd,kd,cS,wS]),IS=z({role:Ro,content:ie([wa,G(wa)]),_meta:fe(v(),ue()).optional()}),ES=Io.extend({messages:G(IS),modelPreferences:kS.optional(),systemPrompt:v().optional(),includeContext:Pe(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:G(v()).optional(),metadata:xe.optional(),tools:G(tv).optional(),toolChoice:SS.optional()}),TS=ke.extend({method:P("sampling/createMessage"),params:ES}),Zo=Se.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Ro,content:zS}),Id=Se.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Ro,content:ie([wa,G(wa)])}),PS=z({type:P("boolean"),title:v().optional(),description:v().optional(),default:$e().optional()}),OS=z({type:P("string"),title:v().optional(),description:v().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Pe(["email","uri","date","date-time"]).optional(),default:v().optional()}),jS=z({type:Pe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),NS=z({type:P("string"),title:v().optional(),description:v().optional(),enum:G(v()),default:v().optional()}),RS=z({type:P("string"),title:v().optional(),description:v().optional(),oneOf:G(z({const:v(),title:v()})),default:v().optional()}),DS=z({type:P("string"),title:v().optional(),description:v().optional(),enum:G(v()),enumNames:G(v()).optional(),default:v().optional()}),AS=ie([NS,RS]),ZS=z({type:P("array"),title:v().optional(),description:v().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({type:P("string"),enum:G(v())}),default:G(v()).optional()}),CS=z({type:P("array"),title:v().optional(),description:v().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({anyOf:G(z({const:v(),title:v()}))}),default:G(v()).optional()}),US=ie([ZS,CS]),MS=ie([DS,AS,US]),LS=ie([MS,PS,OS,jS]),qS=Io.extend({mode:P("form").optional(),message:v(),requestedSchema:z({type:P("object"),properties:fe(v(),LS),required:G(v()).optional()})}),VS=Io.extend({mode:P("url"),message:v(),elicitationId:v(),url:v().url()}),FS=ie([qS,VS]),JS=ke.extend({method:P("elicitation/create"),params:FS}),BS=nt.extend({elicitationId:v()}),WS=ot.extend({method:P("notifications/elicitation/complete"),params:BS}),sn=Se.extend({action:Pe(["accept","decline","cancel"]),content:Sa(t=>t===null?void 0:t,fe(v(),ie([v(),ne(),$e(),G(v())])).optional())}),KS=z({type:P("ref/resource"),uri:v()});var GS=z({type:P("ref/prompt"),name:v()}),HS=Ye.extend({ref:ie([GS,KS]),argument:z({name:v(),value:v()}),context:z({arguments:fe(v(),v()).optional()}).optional()}),XS=ke.extend({method:P("completion/complete"),params:HS});var YS=Se.extend({completion:Te({values:G(v()).max(100),total:me(ne().int()),hasMore:me($e())})}),QS=z({uri:v().startsWith("file://"),name:v().optional(),_meta:fe(v(),ue()).optional()}),ew=ke.extend({method:P("roots/list"),params:Ye.optional()}),Ed=Se.extend({roots:G(QS)}),tw=ot.extend({method:P("notifications/roots/list_changed"),params:nt.optional()}),d1=ie([Pa,vd,XS,zd,sS,oS,qk,Fk,Wk,Xk,Qk,Do,wd,ja,Ra,Da,Za]),p1=ie([Ta,Oa,_d,tw,No]),f1=ie([Ea,Zo,Id,sn,Ed,Na,Aa,on]),m1=ie([Pa,TS,JS,ew,ja,Ra,Da,Za]),h1=ie([Ta,Oa,bS,tS,Gk,_S,fS,No,WS]),g1=ie([Ea,Dk,YS,pS,iS,Vk,Jk,Kk,Ca,gS,Na,Aa,on]),F=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===Y.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new dd(o.elicitations,r)}return new t(e,r,n)}},dd=class extends F{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Y.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function or(t){return t==="completed"||t==="failed"||t==="cancelled"}var H1=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Td(t){let r=ua(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Uh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Pd(t,e){let r=rr(t,e);if(!r.success)throw r.error;return r.data}var sw=6e4,Ua=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(Ta,r=>{this._oncancel(r)}),this.setNotificationHandler(Oa,r=>{this._onprogress(r)}),this.setRequestHandler(Pa,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ja,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new F(Y.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ra,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new F(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new F(Y.InvalidParams,`Task not found: ${i}`);if(!or(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(or(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[nr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Da,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new F(Y.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Za,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new F(Y.InvalidParams,`Task not found: ${r.params.taskId}`);if(or(o.status))throw new F(Y.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new F(Y.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof F?o:new F(Y.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,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),F.fromError(Y.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),Eo(i)||Wg(i)?this._onresponse(i):md(i)?this._onrequest(i,a):Bg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=F.fromError(Y.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,i=e.params?._meta?.[nr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:Y.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let s=Vg(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:e.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new F(Y.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let g=f.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Y.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Eo(e))n(e);else{let a=new F(e.error.code,e.error.message,e.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(Eo(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),Eo(e))o(e);else{let a=F.fromError(e.error.code,e.error.message,e.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(a){yield{type:"error",error:a instanceof F?a:new F(Y.InternalError,String(a))}}return}let i;try{let a=await this.request(e,on,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new F(Y.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},or(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new F(Y.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new F(Y.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof F?a:new F(Y.InternalError,String(a))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=E=>{l(E)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(E){d(E);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[nr]:c}});let g=E=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(E)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let I=E instanceof F?E:new F(Y.RequestTimeout,String(E));l(I)};this._responseHandlers.set(p,E=>{if(!n?.signal?.aborted){if(E instanceof Error)return l(E);try{let I=rr(r,E.result);I.success?u(I.data):l(I.error)}catch(I){l(I)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let h=n?.timeout??sw,_=()=>g(F.fromError(Y.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let E=I=>{let A=this._responseHandlers.get(p);A?A(I):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,E),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(p),l(I)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(E=>{this._cleanupTimeout(p),l(E)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Na,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Aa,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Hg,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[nr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[nr]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[nr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(e,r){let n=Td(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Pd(e,o);return Promise.resolve(r(a,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=Td(e);this._notificationHandlers.set(n,o=>{let i=Pd(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&md(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new F(Y.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new F(Y.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new F(Y.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new F(Y.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=No.parse({method:"notifications/tasks/status",params:s});await this.notification(c),or(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new F(Y.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(or(s.status))throw new F(Y.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=No.parse({method:"notifications/tasks/status",params:c});await this.notification(u),or(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function rv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function nv(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let a=r[o];rv(a)&&rv(i)?r[o]={...a,...i}:r[o]=i}return r}var Vy=vi(gf(),1),Fy=vi(qy(),1);function YT(){let t=new Vy.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Fy.default)(t),t}var bs=class{constructor(e){this._ajv=e??YT()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var xs=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.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],i=Array.isArray(o.content)?o.content:[o.content],a=i.some(l=>l.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Zo,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let i=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:i},sn,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function Jy(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function By(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var ks=class extends Ua{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ao.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new bs,this.setRequestHandler(vd,n=>this._oninitialize(n)),this.setNotificationHandler(_d,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(zd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Ao.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new xs(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=nv(this._capabilities,e)}setRequestHandler(e,r){let o=ua(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(tn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=rr(Do,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new F(Y.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let g=rr(on,p);if(!g.success){let h=g.error instanceof Error?g.error.message:String(g.error);throw new F(Y.InvalidParams,`Invalid task creation result: ${h}`)}return g.data}let f=rr(Ca,p);if(!f.success){let g=f.error instanceof Error?f.error.message:String(f.error);throw new F(Y.InvalidParams,`Invalid tools/call result: ${g}`)}return f.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){By(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Jy(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Mg.includes(r)?r:pd,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"},Ea)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Id,r):this.request({method:"sampling/createMessage",params:e},Zo,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},sn,r)}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"},i=await this.request({method:"elicitation/create",params:o},sn,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new F(Y.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof F?a:new F(Y.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Ed,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Sf=vi(require("node:process"),1);var Ss=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
56
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),QT(r)}clear(){this._buffer=void 0}};function QT(t){return Kg.parse(JSON.parse(t))}function Wy(t){return JSON.stringify(t)+`
|
|
57
|
+
`}var ws=class{constructor(e=Sf.default.stdin,r=Sf.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Ss,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=Wy(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var If=vi(require("path"),1);var wf={DEFAULT:3e5,HEALTH_CHECK:3e3,POST_SPAWN_WAIT:5e3,READINESS_WAIT:3e4,PORT_IN_USE_WAIT:3e3,WORKER_STARTUP_WAIT:1e3,PRE_RESTART_SETTLE_DELAY:2e3,POWERSHELL_COMMAND:1e4,WINDOWS_MULTIPLIER:1.5};function Ky(t){return process.platform==="win32"?Math.round(t*wf.WINDOWS_MULTIPLIER):t}var zt=require("fs"),zs=require("path"),Gy=require("os"),jr=class{static DEFAULTS={VIBELEARN_MODEL:"claude-sonnet-4-5",VIBELEARN_WORKER_PORT:"37778",VIBELEARN_WORKER_HOST:"127.0.0.1",VIBELEARN_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",VIBELEARN_PROVIDER:"claude",VIBELEARN_CLAUDE_AUTH_METHOD:"cli",VIBELEARN_GEMINI_API_KEY:"",VIBELEARN_GEMINI_MODEL:"gemini-2.5-flash-lite",VIBELEARN_GEMINI_RATE_LIMITING_ENABLED:"true",VIBELEARN_OPENROUTER_API_KEY:"",VIBELEARN_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",VIBELEARN_OPENROUTER_SITE_URL:"",VIBELEARN_OPENROUTER_APP_NAME:"vibelearn",VIBELEARN_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",VIBELEARN_OPENROUTER_MAX_TOKENS:"100000",VIBELEARN_DATA_DIR:(0,zs.join)((0,Gy.homedir)(),".vibelearn"),VIBELEARN_LOG_LEVEL:"INFO",VIBELEARN_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",VIBELEARN_MAX_CONCURRENT_AGENTS:"2",VIBELEARN_EXCLUDED_PROJECTS:"",VIBELEARN_CONTEXT_OBSERVATIONS:"50",VIBELEARN_CONTEXT_FULL_COUNT:"3",VIBELEARN_CONTEXT_FULL_FIELD:"narrative",VIBELEARN_CONTEXT_SESSION_COUNT:"10",VIBELEARN_CONTEXT_SHOW_READ_TOKENS:"true",VIBELEARN_CONTEXT_SHOW_WORK_TOKENS:"true",VIBELEARN_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",VIBELEARN_CONTEXT_SHOW_SAVINGS_PERCENT:"true",VIBELEARN_CONTEXT_SHOW_LAST_SUMMARY:"true",VIBELEARN_CONTEXT_SHOW_LAST_MESSAGE:"true",VIBELEARN_CONTEXT_OBSERVATION_TYPES:"",VIBELEARN_CONTEXT_OBSERVATION_CONCEPTS:"",VIBELEARN_FOLDER_CLAUDEMD_ENABLED:"false",VIBELEARN_FOLDER_MD_EXCLUDE:"[]",VIBELEARN_API_KEY:"",VIBELEARN_API_URL:"https://api.vibelearn.dev",VIBELEARN_AUTO_SYNC:"true",VIBELEARN_SYNC_SNIPPETS:"true"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return process.env[e]??this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){let r=this.get(e);return r==="true"||r===!0}static applyEnvOverrides(e){let r={...e};for(let n of Object.keys(this.DEFAULTS))process.env[n]!==void 0&&(r[n]=process.env[n]);return r}static loadFromFile(e){try{if(!(0,zt.existsSync)(e)){let a=this.getAllDefaults();try{let s=(0,zs.dirname)(e);(0,zt.existsSync)(s)||(0,zt.mkdirSync)(s,{recursive:!0}),(0,zt.writeFileSync)(e,JSON.stringify(a,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",e)}catch(s){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",e,s)}return this.applyEnvOverrides(a)}let r=(0,zt.readFileSync)(e,"utf-8"),n=JSON.parse(r),o=n;if(n.env&&typeof n.env=="object"){o=n.env;try{(0,zt.writeFileSync)(e,JSON.stringify(o,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",e)}catch(a){console.warn("[SETTINGS] Failed to auto-migrate settings file:",e,a)}}let i={...this.DEFAULTS};for(let a of Object.keys(this.DEFAULTS))o[a]!==void 0&&(i[a]=o[a]);return this.applyEnvOverrides(i)}catch(r){return console.warn("[SETTINGS] Failed to load settings, using defaults:",e,r),this.applyEnvOverrides(this.getAllDefaults())}}};var ye=require("path"),Is=require("os"),zf=require("fs");var Hy=require("url");var nP={};function eP(){return typeof __dirname<"u"?__dirname:(0,ye.dirname)((0,Hy.fileURLToPath)(nP.url))}var OU=eP();function tP(){if(process.env.VIBELEARN_DATA_DIR)return process.env.VIBELEARN_DATA_DIR.replace(/^~(?=$|\/)/,(0,Is.homedir)());let t=(0,ye.join)((0,Is.homedir)(),".vibelearn"),e=(0,ye.join)(t,"settings.json");try{if((0,zf.existsSync)(e)){let{readFileSync:r}=require("fs"),n=JSON.parse(r(e,"utf-8")),o=n.env??n;if(o.VIBELEARN_DATA_DIR)return o.VIBELEARN_DATA_DIR}}catch{}return t}var It=tP(),Es=process.env.CLAUDE_CONFIG_DIR||(0,ye.join)((0,Is.homedir)(),".claude"),rP=(0,ye.join)(Es,"plugins","marketplaces","vibelearn"),jU=(0,ye.join)(It,"archives"),NU=(0,ye.join)(It,"logs"),RU=(0,ye.join)(It,"trash"),DU=(0,ye.join)(It,"backups"),AU=(0,ye.join)(It,"modes"),ZU=(0,ye.join)(It,"settings.json"),CU=(0,ye.join)(It,"vibelearn.db"),UU=(0,ye.join)(It,"config.json"),MU=(0,ye.join)(It,"vector-db"),LU=(0,ye.join)(It,"observer-sessions"),qU=(0,ye.join)(Es,"settings.json"),VU=(0,ye.join)(Es,"commands"),FU=(0,ye.join)(Es,"CLAUDE.md");var oP=(()=>{let t=process.env.VIBELEARN_HEALTH_TIMEOUT_MS;if(t){let e=parseInt(t,10);if(Number.isFinite(e)&&e>=500&&e<=3e5)return e;ve.warn("SYSTEM","Invalid VIBELEARN_HEALTH_TIMEOUT_MS, using default",{value:t,min:500,max:3e5})}return Ky(wf.HEALTH_CHECK)})();function iP(t,e={},r){return new Promise((n,o)=>{let i=setTimeout(()=>o(new Error(`Request timed out after ${r}ms`)),r);fetch(t,e).then(a=>{clearTimeout(i),n(a)},a=>{clearTimeout(i),o(a)})})}var Ts=null,Ps=null;function aP(){if(Ts!==null)return Ts;let t=If.default.join(jr.get("VIBELEARN_DATA_DIR"),"settings.json"),e=jr.loadFromFile(t);return Ts=parseInt(e.VIBELEARN_WORKER_PORT,10),Ts}function sP(){if(Ps!==null)return Ps;let t=If.default.join(jr.get("VIBELEARN_DATA_DIR"),"settings.json");return Ps=jr.loadFromFile(t).VIBELEARN_WORKER_HOST,Ps}function cP(t){return`http://${sP()}:${aP()}${t}`}function Os(t,e={}){let r=e.method??"GET",n=e.timeoutMs??oP,o=cP(t),i={method:r};return e.headers&&(i.headers=e.headers),e.body&&(i.body=e.body),n>0?iP(o,i,n):fetch(o,i)}var zn=require("node:fs/promises"),hi=require("node:path");var Yy=require("node:child_process"),Et=require("node:fs"),Jt=require("node:path"),Of=require("node:os"),Pf=require("node:module"),bP={},Qy=typeof __filename<"u"?(0,Pf.createRequire)(__filename):(0,Pf.createRequire)(bP.url),uP={".js":"javascript",".mjs":"javascript",".cjs":"javascript",".jsx":"tsx",".ts":"typescript",".tsx":"tsx",".py":"python",".pyw":"python",".go":"go",".rs":"rust",".rb":"ruby",".java":"java",".c":"c",".h":"c",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp"};function e$(t){let e=t.slice(t.lastIndexOf("."));return uP[e]||"unknown"}var lP={javascript:"tree-sitter-javascript",typescript:"tree-sitter-typescript/typescript",tsx:"tree-sitter-typescript/tsx",python:"tree-sitter-python",go:"tree-sitter-go",rust:"tree-sitter-rust",ruby:"tree-sitter-ruby",java:"tree-sitter-java",c:"tree-sitter-c",cpp:"tree-sitter-cpp"};function t$(t){let e=lP[t];if(!e)return null;try{let r=Qy.resolve(e+"/package.json");return(0,Jt.dirname)(r)}catch{return null}}var dP={jsts:`
|
|
58
|
+
(function_declaration name: (identifier) @name) @func
|
|
59
|
+
(lexical_declaration (variable_declarator name: (identifier) @name value: [(arrow_function) (function_expression)])) @const_func
|
|
60
|
+
(class_declaration name: (type_identifier) @name) @cls
|
|
61
|
+
(method_definition name: (property_identifier) @name) @method
|
|
62
|
+
(interface_declaration name: (type_identifier) @name) @iface
|
|
63
|
+
(type_alias_declaration name: (type_identifier) @name) @tdef
|
|
64
|
+
(enum_declaration name: (identifier) @name) @enm
|
|
65
|
+
(import_statement) @imp
|
|
66
|
+
(export_statement) @exp
|
|
67
|
+
`,python:`
|
|
68
|
+
(function_definition name: (identifier) @name) @func
|
|
69
|
+
(class_definition name: (identifier) @name) @cls
|
|
70
|
+
(import_statement) @imp
|
|
71
|
+
(import_from_statement) @imp
|
|
72
|
+
`,go:`
|
|
73
|
+
(function_declaration name: (identifier) @name) @func
|
|
74
|
+
(method_declaration name: (field_identifier) @name) @method
|
|
75
|
+
(type_declaration (type_spec name: (type_identifier) @name)) @tdef
|
|
76
|
+
(import_declaration) @imp
|
|
77
|
+
`,rust:`
|
|
78
|
+
(function_item name: (identifier) @name) @func
|
|
79
|
+
(struct_item name: (type_identifier) @name) @struct_def
|
|
80
|
+
(enum_item name: (type_identifier) @name) @enm
|
|
81
|
+
(trait_item name: (type_identifier) @name) @trait_def
|
|
82
|
+
(impl_item type: (type_identifier) @name) @impl_def
|
|
83
|
+
(use_declaration) @imp
|
|
84
|
+
`,ruby:`
|
|
85
|
+
(method name: (identifier) @name) @func
|
|
86
|
+
(class name: (constant) @name) @cls
|
|
87
|
+
(module name: (constant) @name) @cls
|
|
88
|
+
(call method: (identifier) @name) @imp
|
|
89
|
+
`,java:`
|
|
90
|
+
(method_declaration name: (identifier) @name) @method
|
|
91
|
+
(class_declaration name: (identifier) @name) @cls
|
|
92
|
+
(interface_declaration name: (identifier) @name) @iface
|
|
93
|
+
(enum_declaration name: (identifier) @name) @enm
|
|
94
|
+
(import_declaration) @imp
|
|
95
|
+
`,generic:`
|
|
96
|
+
(function_declaration name: (identifier) @name) @func
|
|
97
|
+
(function_definition name: (identifier) @name) @func
|
|
98
|
+
(class_declaration name: (identifier) @name) @cls
|
|
99
|
+
(class_definition name: (identifier) @name) @cls
|
|
100
|
+
(import_statement) @imp
|
|
101
|
+
(import_declaration) @imp
|
|
102
|
+
`};function r$(t){switch(t){case"javascript":case"typescript":case"tsx":return"jsts";case"python":return"python";case"go":return"go";case"rust":return"rust";case"ruby":return"ruby";case"java":return"java";default:return"generic"}}var Ef=null,Tf=new Map;function n$(t){if(Tf.has(t))return Tf.get(t);Ef||(Ef=(0,Et.mkdtempSync)((0,Jt.join)((0,Of.tmpdir)(),"smart-read-queries-")));let e=(0,Jt.join)(Ef,`${t}.scm`);return(0,Et.writeFileSync)(e,dP[t]),Tf.set(t,e),e}var mi=null;function pP(){if(mi)return mi;try{let t=Qy.resolve("tree-sitter-cli/package.json"),e=(0,Jt.join)((0,Jt.dirname)(t),"tree-sitter");if((0,Et.existsSync)(e))return mi=e,e}catch{}return mi="tree-sitter",mi}function fP(t,e,r){return o$(t,[e],r).get(e)||[]}function o$(t,e,r){if(e.length===0)return new Map;let n=pP(),o=["query","-p",r,t,...e],i;try{i=(0,Yy.execFileSync)(n,o,{encoding:"utf-8",timeout:3e4,stdio:["pipe","pipe","pipe"]})}catch{return new Map}return mP(i)}function mP(t){let e=new Map,r=null,n=null;for(let o of t.split(`
|
|
103
|
+
`)){if(o.length>0&&!o.startsWith(" ")&&!o.startsWith(" ")){r=o.trim(),e.has(r)||e.set(r,[]),n=null;continue}if(!r)continue;let i=o.match(/^\s+pattern:\s+(\d+)/);if(i){n={pattern:parseInt(i[1]),captures:[]},e.get(r).push(n);continue}let a=o.match(/^\s+capture:\s+(?:\d+\s*-\s*)?(\w+),\s*start:\s*\((\d+),\s*(\d+)\),\s*end:\s*\((\d+),\s*(\d+)\)(?:,\s*text:\s*`([^`]*)`)?/);a&&n&&n.captures.push({tag:a[1],startRow:parseInt(a[2]),startCol:parseInt(a[3]),endRow:parseInt(a[4]),endCol:parseInt(a[5]),text:a[6]})}return e}var Xy={func:"function",const_func:"function",cls:"class",method:"method",iface:"interface",tdef:"type",enm:"enum",struct_def:"struct",trait_def:"trait",impl_def:"impl"},hP=new Set(["class","struct","impl","trait"]);function gP(t,e,r,n=200){let i=t[e]||"";if(!i.trimEnd().endsWith("{")&&!i.trimEnd().endsWith(":")){let a=t.slice(e,Math.min(e+10,r+1)).join(`
|
|
104
|
+
`),s=a.indexOf("{");s!==-1&&s<500&&(i=a.slice(0,s).replace(/\n/g," ").replace(/\s+/g," ").trim())}return i=i.replace(/\s*[{:]\s*$/,"").trim(),i.length>n&&(i=i.slice(0,n-3)+"..."),i}function vP(t,e){let r=[],n=!1;for(let o=e-1;o>=0;o--){let i=t[o].trim();if(i===""){if(n)break;continue}if(i.startsWith("/**")||i.startsWith("*")||i.startsWith("*/")||i.startsWith("//")||i.startsWith("///")||i.startsWith("//!")||i.startsWith("#")||i.startsWith("@"))r.unshift(t[o]),n=!0;else break}return r.length>0?r.join(`
|
|
105
|
+
`).trim():void 0}function _P(t,e,r){for(let n=e+1;n<=Math.min(e+3,r);n++){let o=t[n]?.trim();if(o){if(o.startsWith('"""')||o.startsWith("'''"))return o;break}}}function yP(t,e,r,n,o,i){switch(i){case"javascript":case"typescript":case"tsx":return n.some(a=>e>=a.startRow&&r<=a.endRow);case"python":return!t.startsWith("_");case"go":return t.length>0&&t[0]===t[0].toUpperCase()&&t[0]!==t[0].toLowerCase();case"rust":return o[e]?.trimStart().startsWith("pub")??!1;default:return!0}}function i$(t,e,r){let n=[],o=[],i=[],a=[];for(let c of t)for(let u of c.captures)u.tag==="exp"&&i.push({startRow:u.startRow,endRow:u.endRow}),u.tag==="imp"&&o.push(u.text||e[u.startRow]?.trim()||"");for(let c of t){let u=c.captures.find(E=>Xy[E.tag]),l=c.captures.find(E=>E.tag==="name");if(!u)continue;let d=l?.text||"anonymous",p=u.startRow,f=u.endRow,g=Xy[u.tag],h=vP(e,p),_=r==="python"?_P(e,p,f):void 0,b={name:d,kind:g,signature:gP(e,p,f),jsdoc:h||_,lineStart:p,lineEnd:f,exported:yP(d,p,f,i,e,r)};hP.has(g)&&(b.children=[],a.push({sym:b,startRow:p,endRow:f})),n.push(b)}let s=new Set;for(let c of a)for(let u of n)u!==c.sym&&u.lineStart>c.startRow&&u.lineEnd<=c.endRow&&(u.kind==="function"&&(u.kind="method"),c.sym.children.push(u),s.add(u));return{symbols:n.filter(c=>!s.has(c)),imports:o}}function js(t,e){let r=e$(e),n=t.split(`
|
|
106
|
+
`),o=t$(r);if(!o)return{filePath:e,language:r,symbols:[],imports:[],totalLines:n.length,foldedTokenEstimate:50};let i=r$(r),a=n$(i),s=e.slice(e.lastIndexOf("."))||".txt",c=(0,Et.mkdtempSync)((0,Jt.join)((0,Of.tmpdir)(),"smart-src-")),u=(0,Jt.join)(c,`source${s}`);(0,Et.writeFileSync)(u,t);try{let l=fP(a,u,o),d=i$(l,n,r),p=wn({filePath:e,language:r,symbols:d.symbols,imports:d.imports,totalLines:n.length,foldedTokenEstimate:0});return{filePath:e,language:r,symbols:d.symbols,imports:d.imports,totalLines:n.length,foldedTokenEstimate:Math.ceil(p.length/4)}}finally{(0,Et.rmSync)(c,{recursive:!0,force:!0})}}function a$(t){let e=new Map,r=new Map;for(let n of t){let o=e$(n.relativePath);r.has(o)||r.set(o,[]),r.get(o).push(n)}for(let[n,o]of r){let i=t$(n);if(!i){for(let l of o){let d=l.content.split(`
|
|
107
|
+
`);e.set(l.relativePath,{filePath:l.relativePath,language:n,symbols:[],imports:[],totalLines:d.length,foldedTokenEstimate:50})}continue}let a=r$(n),s=n$(a),c=o.map(l=>l.absolutePath),u=o$(s,c,i);for(let l of o){let d=l.content.split(`
|
|
108
|
+
`),p=u.get(l.absolutePath)||[],f=i$(p,d,n),g=wn({filePath:l.relativePath,language:n,symbols:f.symbols,imports:f.imports,totalLines:d.length,foldedTokenEstimate:0});e.set(l.relativePath,{filePath:l.relativePath,language:n,symbols:f.symbols,imports:f.imports,totalLines:d.length,foldedTokenEstimate:Math.ceil(g.length/4)})}}return e}function wn(t){let e=[];if(e.push(`\u{1F4C1} ${t.filePath} (${t.language}, ${t.totalLines} lines)`),e.push(""),t.imports.length>0){e.push(` \u{1F4E6} Imports: ${t.imports.length} statements`);for(let r of t.imports.slice(0,10))e.push(` ${r}`);t.imports.length>10&&e.push(` ... +${t.imports.length-10} more`),e.push("")}for(let r of t.symbols)e.push(s$(r," "));return e.join(`
|
|
109
|
+
`)}function s$(t,e){let r=[],n=$P(t.kind),o=t.exported?" [exported]":"",i=t.lineStart===t.lineEnd?`L${t.lineStart+1}`:`L${t.lineStart+1}-${t.lineEnd+1}`;if(r.push(`${e}${n} ${t.name}${o} (${i})`),r.push(`${e} ${t.signature}`),t.jsdoc){let s=t.jsdoc.split(`
|
|
110
|
+
`).find(c=>{let u=c.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").trim();return u.length>0&&!u.startsWith("/**")});if(s){let c=s.replace(/^[\s*/]+/,"").replace(/^['"`]{3}/,"").replace(/['"`]{3}$/,"").trim();c&&r.push(`${e} \u{1F4AC} ${c}`)}}if(t.children&&t.children.length>0)for(let a of t.children)r.push(s$(a,e+" "));return r.join(`
|
|
111
|
+
`)}function $P(t){return{function:"\u0192",method:"\u0192",class:"\u25C6",interface:"\u25C7",type:"\u25C7",const:"\u25CF",variable:"\u25CB",export:"\u2192",struct:"\u25C6",enum:"\u25A3",trait:"\u25C7",impl:"\u25C8",property:"\u25CB",getter:"\u21E2",setter:"\u21E0"}[t]||"\xB7"}function c$(t,e,r){let n=js(t,e),o=u=>{for(let l of u){if(l.name===r)return l;if(l.children){let d=o(l.children);if(d)return d}}return null},i=o(n.symbols);if(!i)return null;let a=t.split(`
|
|
112
|
+
`),s=i.lineStart;for(let u=i.lineStart-1;u>=0;u--){let l=a[u].trim();if(l===""||l.startsWith("*")||l.startsWith("/**")||l.startsWith("///")||l.startsWith("//")||l.startsWith("#")||l.startsWith("@")||l==="*/")s=u;else break}let c=a.slice(s,i.lineEnd+1).join(`
|
|
113
|
+
`);return`// \u{1F4CD} ${e} L${s+1}-${i.lineEnd+1}
|
|
114
|
+
${c}`}var xP=new Set([".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".go",".rs",".rb",".java",".cs",".cpp",".c",".h",".hpp",".swift",".kt",".php",".vue",".svelte"]),kP=new Set(["node_modules",".git","dist","build",".next","__pycache__",".venv","venv","env",".env","target","vendor",".cache",".turbo","coverage",".nyc_output",".claude",".smart-file-read"]),SP=512*1024;async function*u$(t,e,r=20){if(r<=0)return;let n;try{n=await(0,zn.readdir)(t,{withFileTypes:!0})}catch{return}for(let o of n){if(o.name.startsWith(".")&&o.name!=="."||kP.has(o.name))continue;let i=(0,hi.join)(t,o.name);if(o.isDirectory())yield*u$(i,e,r-1);else if(o.isFile()){let a=o.name.slice(o.name.lastIndexOf("."));xP.has(a)&&(yield i)}}}async function wP(t){try{let e=await(0,zn.stat)(t);if(e.size>SP||e.size===0)return null;let r=await(0,zn.readFile)(t,"utf-8");return r.slice(0,1e3).includes("\0")?null:r}catch{return null}}async function l$(t,e,r={}){let n=r.maxResults||20,o=e.toLowerCase(),i=o.split(/[\s_\-./]+/).filter(h=>h.length>0),a=[];for await(let h of u$(t,t)){if(r.filePattern&&!(0,hi.relative)(t,h).toLowerCase().includes(r.filePattern.toLowerCase()))continue;let _=await wP(h);_&&a.push({absolutePath:h,relativePath:(0,hi.relative)(t,h),content:_})}let s=a$(a),c=[],u=[],l=0;for(let[h,_]of s){l+=zP(_);let E=Ns(h.toLowerCase(),i)>0,I=[],A=(j,Le)=>{for(let de of j){let Bt=0,Qe="",Wt=Ns(de.name.toLowerCase(),i);Wt>0&&(Bt+=Wt*3,Qe="name match"),de.signature.toLowerCase().includes(o)&&(Bt+=2,Qe=Qe?`${Qe} + signature`:"signature match"),de.jsdoc&&de.jsdoc.toLowerCase().includes(o)&&(Bt+=1,Qe=Qe?`${Qe} + jsdoc`:"jsdoc match"),Bt>0&&(E=!0,I.push({filePath:h,symbolName:Le?`${Le}.${de.name}`:de.name,kind:de.kind,signature:de.signature,jsdoc:de.jsdoc,lineStart:de.lineStart,lineEnd:de.lineEnd,matchReason:Qe})),de.children&&A(de.children,de.name)}};A(_.symbols),E&&(c.push(_),u.push(...I))}u.sort((h,_)=>{let b=Ns(h.symbolName.toLowerCase(),i);return Ns(_.symbolName.toLowerCase(),i)-b});let d=u.slice(0,n),p=new Set(d.map(h=>h.filePath)),f=c.filter(h=>p.has(h.filePath)).slice(0,n),g=f.reduce((h,_)=>h+_.foldedTokenEstimate,0);return{foldedFiles:f,matchingSymbols:d,totalFilesScanned:a.length,totalSymbolsFound:l,tokenEstimate:g}}function Ns(t,e){let r=0;for(let n of e)if(t===n)r+=10;else if(t.includes(n))r+=5;else{let o=0,i=0;for(let a of n){let s=t.indexOf(a,o);s!==-1&&(i++,o=s+1)}i===n.length&&(r+=1)}return r}function zP(t){let e=t.symbols.length;for(let r of t.symbols)r.children&&(e+=r.children.length);return e}function d$(t,e){let r=[];if(r.push(`\u{1F50D} Smart Search: "${e}"`),r.push(` Scanned ${t.totalFilesScanned} files, found ${t.totalSymbolsFound} symbols`),r.push(` ${t.matchingSymbols.length} matches across ${t.foldedFiles.length} files (~${t.tokenEstimate} tokens for folded view)`),r.push(""),t.matchingSymbols.length===0)return r.push(" No matching symbols found."),r.join(`
|
|
115
|
+
`);r.push("\u2500\u2500 Matching Symbols \u2500\u2500"),r.push("");for(let n of t.matchingSymbols){if(r.push(` ${n.kind} ${n.symbolName} (${n.filePath}:${n.lineStart+1})`),r.push(` ${n.signature}`),n.jsdoc){let o=n.jsdoc.split(`
|
|
116
|
+
`).find(i=>i.replace(/^[\s*/]+/,"").trim().length>0);o&&r.push(` \u{1F4AC} ${o.replace(/^[\s*/]+/,"").trim()}`)}r.push("")}r.push("\u2500\u2500 Folded File Views \u2500\u2500"),r.push("");for(let n of t.foldedFiles)r.push(wn(n)),r.push("");return r.push("\u2500\u2500 Actions \u2500\u2500"),r.push(" To see full implementation: use smart_unfold with file path and symbol name"),r.join(`
|
|
117
|
+
`)}var jf=require("node:fs/promises"),Rs=require("node:path"),IP="0.1.1";console.log=(...t)=>{ve.error("CONSOLE","Intercepted console output (MCP protocol protection)",void 0,{args:t})};var p$={search:"/api/search",timeline:"/api/timeline"};async function f$(t,e){ve.debug("SYSTEM","\u2192 Worker API",void 0,{endpoint:t,params:e});try{let r=new URLSearchParams;for(let[a,s]of Object.entries(e))s!=null&&r.append(a,String(s));let n=`${t}?${r}`,o=await Os(n);if(!o.ok){let a=await o.text();throw new Error(`Worker API error (${o.status}): ${a}`)}let i=await o.json();return ve.debug("SYSTEM","\u2190 Worker API success",void 0,{endpoint:t}),i}catch(r){return ve.error("SYSTEM","\u2190 Worker API error",{endpoint:t},r),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function EP(t,e){ve.debug("HTTP","Worker API request (POST)",void 0,{endpoint:t});try{let r=await Os(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok){let o=await r.text();throw new Error(`Worker API error (${r.status}): ${o}`)}let n=await r.json();return ve.debug("HTTP","Worker API success (POST)",void 0,{endpoint:t}),{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}catch(r){return ve.error("HTTP","Worker API error (POST)",{endpoint:t},r),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function TP(){try{return(await Os("/api/health")).ok}catch(t){return ve.debug("SYSTEM","Worker health check failed",{},t),!1}}var m$=[{name:"__IMPORTANT",description:`3-LAYER WORKFLOW (ALWAYS FOLLOW):
|
|
118
|
+
1. search(query) \u2192 Get index with IDs (~50-100 tokens/result)
|
|
119
|
+
2. timeline(anchor=ID) \u2192 Get context around interesting results
|
|
120
|
+
3. get_observations([IDs]) \u2192 Fetch full details ONLY for filtered IDs
|
|
121
|
+
NEVER fetch full details without filtering first. 10x token savings.`,inputSchema:{type:"object",properties:{}},handler:async()=>({content:[{type:"text",text:`# Memory Search Workflow
|
|
122
|
+
|
|
123
|
+
**3-Layer Pattern (ALWAYS follow this):**
|
|
124
|
+
|
|
125
|
+
1. **Search** - Get index of results with IDs
|
|
126
|
+
\`search(query="...", limit=20, project="...")\`
|
|
127
|
+
Returns: Table with IDs, titles, dates (~50-100 tokens/result)
|
|
128
|
+
|
|
129
|
+
2. **Timeline** - Get context around interesting results
|
|
130
|
+
\`timeline(anchor=<ID>, depth_before=3, depth_after=3)\`
|
|
131
|
+
Returns: Chronological context showing what was happening
|
|
132
|
+
|
|
133
|
+
3. **Fetch** - Get full details ONLY for relevant IDs
|
|
134
|
+
\`get_observations(ids=[...])\` # ALWAYS batch for 2+ items
|
|
135
|
+
Returns: Complete details (~500-1000 tokens/result)
|
|
136
|
+
|
|
137
|
+
**Why:** 10x token savings. Never fetch full details without filtering first.`}]})},{name:"search",description:"Step 1: Search memory. Returns index with IDs. Params: query, limit, project, type, obs_type, dateStart, dateEnd, offset, orderBy",inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async t=>{let e=p$.search;return await f$(e,t)}},{name:"timeline",description:"Step 2: Get context around results. Params: anchor (observation ID) OR query (finds anchor automatically), depth_before, depth_after, project",inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async t=>{let e=p$.timeline;return await f$(e,t)}},{name:"get_observations",description:"Step 3: Fetch full details for filtered IDs. Params: ids (array of observation IDs, required), orderBy, limit, project",inputSchema:{type:"object",properties:{ids:{type:"array",items:{type:"number"},description:"Array of observation IDs to fetch (required)"}},required:["ids"],additionalProperties:!0},handler:async t=>await EP("/api/observations/batch",t)},{name:"smart_search",description:"Search codebase for symbols, functions, classes using tree-sitter AST parsing. Returns folded structural views with token counts. Use path parameter to scope the search.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Search term \u2014 matches against symbol names, file names, and file content"},path:{type:"string",description:"Root directory to search (default: current working directory)"},max_results:{type:"number",description:"Maximum results to return (default: 20)"},file_pattern:{type:"string",description:'Substring filter for file paths (e.g. ".ts", "src/services")'}},required:["query"]},handler:async t=>{let e=(0,Rs.resolve)(t.path||process.cwd()),r=await l$(e,t.query,{maxResults:t.max_results||20,filePattern:t.file_pattern});return{content:[{type:"text",text:d$(r,t.query)}]}}},{name:"smart_unfold",description:"Expand a specific symbol (function, class, method) from a file. Returns the full source code of just that symbol. Use after smart_search or smart_outline to read specific code.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"},symbol_name:{type:"string",description:"Name of the symbol to unfold (function, class, method, etc.)"}},required:["file_path","symbol_name"]},handler:async t=>{let e=(0,Rs.resolve)(t.file_path),r=await(0,jf.readFile)(e,"utf-8"),n=c$(r,e,t.symbol_name);if(n)return{content:[{type:"text",text:n}]};let o=js(r,e);if(o.symbols.length>0){let i=o.symbols.map(a=>` - ${a.name} (${a.kind})`).join(`
|
|
138
|
+
`);return{content:[{type:"text",text:`Symbol "${t.symbol_name}" not found in ${t.file_path}.
|
|
139
|
+
|
|
140
|
+
Available symbols:
|
|
141
|
+
${i}`}]}}return{content:[{type:"text",text:`Could not parse ${t.file_path}. File may be unsupported or empty.`}]}}},{name:"smart_outline",description:"Get structural outline of a file \u2014 shows all symbols (functions, classes, methods, types) with signatures but bodies folded. Much cheaper than reading the full file.",inputSchema:{type:"object",properties:{file_path:{type:"string",description:"Path to the source file"}},required:["file_path"]},handler:async t=>{let e=(0,Rs.resolve)(t.file_path),r=await(0,jf.readFile)(e,"utf-8"),n=js(r,e);return n.symbols.length>0?{content:[{type:"text",text:wn(n)}]}:{content:[{type:"text",text:`Could not parse ${t.file_path}. File may use an unsupported language or be empty.`}]}}}],Nf=new ks({name:"vibelearn",version:IP},{capabilities:{tools:{}}});Nf.setRequestHandler(wd,async()=>({tools:m$.map(t=>({name:t.name,description:t.description,inputSchema:t.inputSchema}))}));Nf.setRequestHandler(Do,async t=>{let e=m$.find(r=>r.name===t.params.name);if(!e)throw new Error(`Unknown tool: ${t.params.name}`);try{return await e.handler(t.params.arguments||{})}catch(r){return ve.error("SYSTEM","Tool execution failed",{tool:t.params.name},r),{content:[{type:"text",text:`Tool execution failed: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}});var PP=3e4,gi=null;function OP(){if(process.platform==="win32")return;let t=process.ppid;gi=setInterval(()=>{(process.ppid===1||process.ppid!==t)&&(ve.info("SYSTEM","Parent process died, self-exiting to prevent orphan",{initialPpid:t,currentPpid:process.ppid}),Rf())},PP),gi.unref&&gi.unref()}function Rf(){gi&&clearInterval(gi),ve.info("SYSTEM","MCP server shutting down"),process.exit(0)}process.on("SIGTERM",Rf);process.on("SIGINT",Rf);async function jP(){let t=new ws;await Nf.connect(t),ve.info("SYSTEM","VibeLearn search server started"),OP(),setTimeout(async()=>{await TP()?ve.info("SYSTEM","Worker available",void 0,{}):(ve.error("SYSTEM","Worker not available",void 0,{}),ve.error("SYSTEM","Tools will fail until Worker is started"),ve.error("SYSTEM","Start Worker with: npm run worker:restart"))},0)}jP().catch(t=>{ve.error("SYSTEM","Fatal error",void 0,t),process.exit(0)});
|