#!/usr/bin/env node "use strict";var l$=Object.create;var Ns=Object.defineProperty;var d$=Object.getOwnPropertyDescriptor;var p$=Object.getOwnPropertyNames;var f$=Object.getPrototypeOf,m$=Object.prototype.hasOwnProperty;var S=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wn=(e,t)=>{for(var r in t)Ns(e,r,{get:t[r],enumerable:!0})},h$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of p$(t))!m$.call(e,o)&&o!==r&&Ns(e,o,{get:()=>t[o],enumerable:!(n=d$(t,o))||n.enumerable});return e};var mi=(e,t,r)=>(r=e!=null?l$(f$(e)):{},h$(t||!e||!e.__esModule?Ns(r,"default",{value:e,enumerable:!0}):r,e));var Co=S(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.regexpCode=te.getEsmExportName=te.getProperty=te.safeStringify=te.stringify=te.strConcat=te.addCodeArg=te.str=te._=te.nil=te._Code=te.Name=te.IDENTIFIER=te._CodeOrName=void 0;var Ao=class{};te._CodeOrName=Ao;te.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var xr=class extends Ao{constructor(t){if(super(),!te.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};te.Name=xr;var it=class extends Ao{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof xr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};te._Code=it;te.nil=new it("");function Yg(e,...t){let r=[e[0]],n=0;for(;n{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ValueScope=Ve.ValueScopeName=Ve.Scope=Ve.varKinds=Ve.UsedValueState=void 0;var Fe=Co(),Od=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ca;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ca||(Ve.UsedValueState=Ca={}));Ve.varKinds={const:new Fe.Name("const"),let:new Fe.Name("let"),var:new Fe.Name("var")};var Ua=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Fe.Name?t:this.name(t)}name(t){return new Fe.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Ve.Scope=Ua;var Za=class extends Fe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Fe._)`.${new Fe.Name(r)}[${n}]`}};Ve.ValueScopeName=Za;var gw=(0,Fe._)`\n`,jd=class extends Ua{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?gw:Fe.nil}}get(){return this._scope}name(t){return new Za(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{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(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Fe._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=Fe.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,Ca.Started);let l=r(u);if(l){let d=this.opts.es5?Ve.varKinds.var:Ve.varKinds.const;i=(0,Fe._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Fe._)`${i}${l}${this.opts._n}`;else throw new Od(u);c.set(u,Ca.Completed)})}return i}};Ve.ValueScope=jd});var W=S(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.or=H.and=H.not=H.CodeGen=H.operators=H.varKinds=H.ValueScopeName=H.ValueScope=H.Scope=H.Name=H.regexpCode=H.stringify=H.getProperty=H.nil=H.strConcat=H.str=H._=void 0;var Q=Co(),pt=Dd(),ir=Co();Object.defineProperty(H,"_",{enumerable:!0,get:function(){return ir._}});Object.defineProperty(H,"str",{enumerable:!0,get:function(){return ir.str}});Object.defineProperty(H,"strConcat",{enumerable:!0,get:function(){return ir.strConcat}});Object.defineProperty(H,"nil",{enumerable:!0,get:function(){return ir.nil}});Object.defineProperty(H,"getProperty",{enumerable:!0,get:function(){return ir.getProperty}});Object.defineProperty(H,"stringify",{enumerable:!0,get:function(){return ir.stringify}});Object.defineProperty(H,"regexpCode",{enumerable:!0,get:function(){return ir.regexpCode}});Object.defineProperty(H,"Name",{enumerable:!0,get:function(){return ir.Name}});var Va=Dd();Object.defineProperty(H,"Scope",{enumerable:!0,get:function(){return Va.Scope}});Object.defineProperty(H,"ValueScope",{enumerable:!0,get:function(){return Va.ValueScope}});Object.defineProperty(H,"ValueScopeName",{enumerable:!0,get:function(){return Va.ValueScopeName}});Object.defineProperty(H,"varKinds",{enumerable:!0,get:function(){return Va.varKinds}});H.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 Ut=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Nd=class extends Ut{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?pt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=cn(this.rhs,t,r)),this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},La=class extends Ut{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof Q.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=cn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Q.Name?{}:{...this.lhs.names};return Fa(t,this.rhs)}},Rd=class extends La{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ad=class extends Ut{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Md=class extends Ut{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Cd=class extends Ut{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Ud=class extends Ut{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=cn(this.code,t,r),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},Uo=class extends Ut{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(t,r)||(vw(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>wr(t,r.names),{})}},Zt=class extends Uo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Zd=class extends Uo{},sn=class extends Zt{};sn.kind="else";var kr=class e extends Zt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new sn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(ev(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=cn(this.condition,t,r),this}get names(){let t=super.names;return Fa(t,this.condition),this.else&&wr(t,this.else.names),t}};kr.kind="if";var Sr=class extends Zt{};Sr.kind="for";var Ld=class extends Sr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=cn(this.iteration,t,r),this}get names(){return wr(super.names,this.iteration.names)}},qd=class extends Sr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?pt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Fa(super.names,this.from);return Fa(t,this.to)}},qa=class extends Sr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=cn(this.iterable,t,r),this}get names(){return wr(super.names,this.iterable.names)}},Zo=class extends Zt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Zo.kind="func";var Lo=class extends Uo{render(t){return"return "+super.render(t)}};Lo.kind="return";var Fd=class extends Zt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&wr(t,this.catch.names),this.finally&&wr(t,this.finally.names),t}},qo=class extends Zt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};qo.kind="catch";var Fo=class extends Zt{render(t){return"finally"+super.render(t)}};Fo.kind="finally";var Vd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` `:""},this._extScope=t,this._scope=new pt.Scope({parent:t}),this._nodes=[new Zd]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Nd(t,i,n)),i}const(t,r,n){return this._def(pt.varKinds.const,t,r,n)}let(t,r,n){return this._def(pt.varKinds.let,t,r,n)}var(t,r,n){return this._def(pt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new La(t,r,n))}add(t,r){return this._leafNode(new Rd(t,H.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Q.nil&&this._leafNode(new Ud(t)),this}object(...t){let r=["{"];for(let[n,o]of t)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(t,r,n){if(this._blockNode(new kr(t)),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(t){return this._elseNode(new kr(t))}else(){return this._elseNode(new sn)}endIf(){return this._endBlockNode(kr,sn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Ld(t),r)}forRange(t,r,n,o,i=this.opts.es5?pt.varKinds.var:pt.varKinds.let){let a=this._scope.toName(t);return this._for(new qd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=pt.varKinds.const){let i=this._scope.toName(t);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 qa("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?pt.varKinds.var:pt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Q._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new qa("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Sr)}label(t){return this._leafNode(new Ad(t))}break(t){return this._leafNode(new Md(t))}return(t){let r=new Lo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Lo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Fd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new qo(i),r(i)}return n&&(this._currNode=o.finally=new Fo,this.code(n)),this._endBlockNode(qo,Fo)}throw(t){return this._leafNode(new Cd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=Q.nil,n,o){return this._blockNode(new Zo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Zo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof kr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};H.CodeGen=Vd;function wr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Fa(e,t){return t instanceof Q._CodeOrName?wr(e,t.names):e}function cn(e,t,r){if(e instanceof Q.Name)return n(e);if(!o(e))return e;return new Q._Code(e._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||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof Q._Code&&i._items.some(a=>a instanceof Q.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function vw(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function ev(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Q._)`!${Jd(e)}`}H.not=ev;var _w=tv(H.operators.AND);function yw(...e){return e.reduce(_w)}H.and=yw;var $w=tv(H.operators.OR);function bw(...e){return e.reduce($w)}H.or=bw;function tv(e){return(t,r)=>t===Q.nil?r:r===Q.nil?t:(0,Q._)`${Jd(t)} ${e} ${Jd(r)}`}function Jd(e){return e instanceof Q.Name?e:(0,Q._)`(${e})`}});var re=S(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var le=W(),xw=Co();function kw(e){let t={};for(let r of e)t[r]=!0;return t}B.toHash=kw;function Sw(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(ov(e,t),!iv(t,e.self.RULES.all))}B.alwaysValidSchema=Sw;function ov(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||cv(e,`unknown keyword: "${i}"`)}B.checkUnknownRules=ov;function iv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}B.schemaHasRules=iv;function ww(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}B.schemaHasRulesButRef=ww;function zw({topSchemaRef:e,schemaPath:t},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._)`${e}${t}${(0,le.getProperty)(n)}`}B.schemaRefOrVal=zw;function Iw(e){return av(decodeURIComponent(e))}B.unescapeFragment=Iw;function Ew(e){return encodeURIComponent(Kd(e))}B.escapeFragment=Ew;function Kd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=Kd;function av(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=av;function Tw(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}B.eachItem=Tw;function rv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof le.Name?(i instanceof le.Name?e(o,i,a):t(o,i,a),a):i instanceof le.Name?(t(o,a,i),i):r(i,a);return s===le.Name&&!(c instanceof le.Name)?n(o,c):c}}B.mergeEvaluated={props:rv({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,le._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,le._)`${r} || {}`).code((0,le._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,le._)`${r} || {}`),Hd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:sv}),items:rv({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,le._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,le._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function sv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,le._)`{}`);return t!==void 0&&Hd(e,r,t),r}B.evaluatedPropsToName=sv;function Hd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,le._)`${t}${(0,le.getProperty)(n)}`,!0))}B.setEvaluated=Hd;var nv={};function Pw(e,t){return e.scopeValue("func",{ref:t,code:nv[t.code]||(nv[t.code]=new xw._Code(t.code))})}B.useFunc=Pw;var Wd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Wd||(B.Type=Wd={}));function Ow(e,t,r){if(e instanceof le.Name){let n=t===Wd.Num;return r?n?(0,le._)`"[" + ${e} + "]"`:(0,le._)`"['" + ${e} + "']"`:n?(0,le._)`"/" + ${e}`:(0,le._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,le.getProperty)(e).toString():"/"+Kd(e)}B.getErrorPath=Ow;function cv(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}B.checkStrictMode=cv});var Lt=S(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var Oe=W(),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")};Gd.default=jw});var Vo=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 ee=W(),Ja=re(),Ue=Lt();je.keywordError={message:({keyword:e})=>(0,ee.str)`must pass "${e}" keyword validation`};je.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ee.str)`"${e}" keyword must be ${t} ($data)`:(0,ee.str)`"${e}" keyword is invalid ($data)`};function Dw(e,t=je.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=dv(e,t,r);n??(a||s)?uv(i,c):lv(o,(0,ee._)`[${c}]`)}je.reportError=Dw;function Nw(e,t=je.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=dv(e,t,r);uv(o,s),i||a||lv(n,Ue.default.vErrors)}je.reportExtraError=Nw;function Rw(e,t){e.assign(Ue.default.errors,t),e.if((0,ee._)`${Ue.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ee._)`${Ue.default.vErrors}.length`,t),()=>e.assign(Ue.default.vErrors,null)))}je.resetErrorsCount=Rw;function Aw({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Ue.default.errors,s=>{e.const(a,(0,ee._)`${Ue.default.vErrors}[${s}]`),e.if((0,ee._)`${a}.instancePath === undefined`,()=>e.assign((0,ee._)`${a}.instancePath`,(0,ee.strConcat)(Ue.default.instancePath,i.errorPath))),e.assign((0,ee._)`${a}.schemaPath`,(0,ee.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,ee._)`${a}.schema`,r),e.assign((0,ee._)`${a}.data`,n))})}je.extendErrors=Aw;function uv(e,t){let r=e.const("err",t);e.if((0,ee._)`${Ue.default.vErrors} === null`,()=>e.assign(Ue.default.vErrors,(0,ee._)`[${r}]`),(0,ee._)`${Ue.default.vErrors}.push(${r})`),e.code((0,ee._)`${Ue.default.errors}++`)}function lv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,ee._)`new ${e.ValidationError}(${t})`):(r.assign((0,ee._)`${n}.errors`,t),r.return(!1))}var zr={keyword:new ee.Name("keyword"),schemaPath:new ee.Name("schemaPath"),params:new ee.Name("params"),propertyName:new ee.Name("propertyName"),message:new ee.Name("message"),schema:new ee.Name("schema"),parentSchema:new ee.Name("parentSchema")};function dv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ee._)`{}`:Mw(e,t,r)}function Mw(e,t,r={}){let{gen:n,it:o}=e,i=[Cw(o,r),Uw(e,r)];return Zw(e,t,i),n.object(...i)}function Cw({errorPath:e},{instancePath:t}){let r=t?(0,ee.str)`${e}${(0,Ja.getErrorPath)(t,Ja.Type.Str)}`:e;return[Ue.default.instancePath,(0,ee.strConcat)(Ue.default.instancePath,r)]}function Uw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,ee.str)`${t}/${e}`;return r&&(o=(0,ee.str)`${o}${(0,Ja.getErrorPath)(r,Ja.Type.Str)}`),[zr.schemaPath,o]}function Zw(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([zr.keyword,o],[zr.params,typeof t=="function"?t(e):t||(0,ee._)`{}`]),c.messages&&n.push([zr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([zr.schema,a],[zr.parentSchema,(0,ee._)`${l}${d}`],[Ue.default.data,i]),u&&n.push([zr.propertyName,u])}});var fv=S(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.boolOrEmptySchema=un.topBoolOrEmptySchema=void 0;var Lw=Vo(),qw=W(),Fw=Lt(),Vw={message:"boolean schema is false"};function Jw(e){let{gen:t,schema:r,validateName:n}=e;r===!1?pv(e,!1):typeof r=="object"&&r.$async===!0?t.return(Fw.default.data):(t.assign((0,qw._)`${n}.errors`,null),t.return(!0))}un.topBoolOrEmptySchema=Jw;function Ww(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),pv(e)):r.var(t,!0)}un.boolOrEmptySchema=Ww;function pv(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,Lw.reportError)(o,Vw,void 0,t)}});var Bd=S(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.getRules=ln.isJSONType=void 0;var Kw=["string","number","integer","boolean","null","object","array"],Hw=new Set(Kw);function Gw(e){return typeof e=="string"&&Hw.has(e)}ln.isJSONType=Gw;function Bw(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}ln.getRules=Bw});var Xd=S(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.shouldUseRule=ar.shouldUseGroup=ar.schemaHasRulesForType=void 0;function Xw({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&mv(e,n)}ar.schemaHasRulesForType=Xw;function mv(e,t){return t.rules.some(r=>hv(e,r))}ar.shouldUseGroup=mv;function hv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}ar.shouldUseRule=hv});var Jo=S(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.reportTypeError=De.checkDataTypes=De.checkDataType=De.coerceAndCheckDataType=De.getJSONTypes=De.getSchemaTypes=De.DataType=void 0;var Yw=Bd(),Qw=Xd(),e0=Vo(),F=W(),gv=re(),dn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(dn||(De.DataType=dn={}));function t0(e){let t=vv(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}De.getSchemaTypes=t0;function vv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Yw.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}De.getJSONTypes=vv;function r0(e,t){let{gen:r,data:n,opts:o}=e,i=n0(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,Qw.schemaHasRulesForType)(e,t[0]));if(a){let s=Qd(t,n,o.strictNumbers,dn.Wrong);r.if(s,()=>{i.length?o0(e,t,i):ep(e)})}return a}De.coerceAndCheckDataType=r0;var _v=new Set(["string","number","integer","boolean","null"]);function n0(e,t){return t?e.filter(r=>_v.has(r)||t==="array"&&r==="array"):[]}function o0(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,F._)`typeof ${o}`),s=n.let("coerced",(0,F._)`undefined`);i.coerceTypes==="array"&&n.if((0,F._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,F._)`${o}[0]`).assign(a,(0,F._)`typeof ${o}`).if(Qd(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,F._)`${s} !== undefined`);for(let u of r)(_v.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ep(e),n.endIf(),n.if((0,F._)`${s} !== undefined`,()=>{n.assign(o,s),i0(e,s)});function c(u){switch(u){case"string":n.elseIf((0,F._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,F._)`"" + ${o}`).elseIf((0,F._)`${o} === null`).assign(s,(0,F._)`""`);return;case"number":n.elseIf((0,F._)`${a} == "boolean" || ${o} === null || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,F._)`+${o}`);return;case"integer":n.elseIf((0,F._)`${a} === "boolean" || ${o} === null || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,F._)`+${o}`);return;case"boolean":n.elseIf((0,F._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,F._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,F._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,F._)`${a} === "string" || ${a} === "number" || ${a} === "boolean" || ${o} === null`).assign(s,(0,F._)`[${o}]`)}}}function i0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,F._)`${t} !== undefined`,()=>e.assign((0,F._)`${t}[${r}]`,n))}function Yd(e,t,r,n=dn.Correct){let o=n===dn.Correct?F.operators.EQ:F.operators.NEQ,i;switch(e){case"null":return(0,F._)`${t} ${o} null`;case"array":i=(0,F._)`Array.isArray(${t})`;break;case"object":i=(0,F._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,F._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,F._)`typeof ${t} ${o} ${e}`}return n===dn.Correct?i:(0,F.not)(i);function a(s=F.nil){return(0,F.and)((0,F._)`typeof ${t} == "number"`,s,r?(0,F._)`isFinite(${t})`:F.nil)}}De.checkDataType=Yd;function Qd(e,t,r,n){if(e.length===1)return Yd(e[0],t,r,n);let o,i=(0,gv.toHash)(e);if(i.array&&i.object){let a=(0,F._)`typeof ${t} != "object"`;o=i.null?a:(0,F._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=F.nil;i.number&&delete i.integer;for(let a in i)o=(0,F.and)(o,Yd(a,t,r,n));return o}De.checkDataTypes=Qd;var a0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,F._)`{type: ${e}}`:(0,F._)`{type: ${t}}`};function ep(e){let t=s0(e);(0,e0.reportError)(t,a0)}De.reportTypeError=ep;function s0(e){let{gen:t,data:r,schema:n}=e,o=(0,gv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var $v=S(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});Wa.assignDefaults=void 0;var pn=W(),c0=re();function u0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)yv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>yv(e,i,o.default))}Wa.assignDefaults=u0;function yv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,pn._)`${i}${(0,pn.getProperty)(t)}`;if(o){(0,c0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,pn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,pn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,pn._)`${s} = ${(0,pn.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=W(),tp=re(),sr=Lt(),l0=re();function d0(e,t){let{gen:r,data:n,it:o}=e;r.if(np(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,he._)`${t}`},!0),e.error()})}ae.checkReportMissingProp=d0;function p0({gen:e,data:t,it:{opts:r}},n,o){return(0,he.or)(...n.map(i=>(0,he.and)(np(e,t,i,r.ownProperties),(0,he._)`${o} = ${i}`)))}ae.checkMissingProp=p0;function f0(e,t){e.setParams({missingProperty:t},!0),e.error()}ae.reportMissingProp=f0;function bv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,he._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=bv;function rp(e,t,r){return(0,he._)`${bv(e)}.call(${t}, ${r})`}ae.isOwnProperty=rp;function m0(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} !== undefined`;return n?(0,he._)`${o} && ${rp(e,t,r)}`:o}ae.propertyInData=m0;function np(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} === undefined`;return n?(0,he.or)(o,(0,he.not)(rp(e,t,r))):o}ae.noPropertyInData=np;function xv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ae.allSchemaProperties=xv;function h0(e,t){return xv(t).filter(r=>!(0,tp.alwaysValidSchema)(e,t[r]))}ae.schemaProperties=h0;function g0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,he._)`${e}, ${t}, ${n}${o}`:t,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 m=(0,he._)`${l}, ${r.object(...d)}`;return c!==he.nil?(0,he._)`${s}.call(${c}, ${m})`:(0,he._)`${s}(${m})`}ae.callValidateCode=g0;var v0=(0,he._)`new RegExp`;function _0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,he._)`${o.code==="new RegExp"?v0:(0,l0.useFunc)(e,o)}(${r}, ${n})`})}ae.usePattern=_0;function y0(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,he._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:tp.Type.Num},i),t.if((0,he.not)(i),s)})}}ae.validateArray=y0;function $0(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,tp.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,he._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,he.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ae.validateUnion=$0});var wv=S($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.validateKeywordUsage=$t.validSchemaType=$t.funcKeywordCode=$t.macroKeywordCode=void 0;var Ze=W(),Ir=Lt(),b0=at(),x0=Vo();function k0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Sv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ze.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}$t.macroKeywordCode=k0;function S0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;z0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Sv(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&kv(e),_(()=>e.error());else{let b=t.async?p():g();t.modifying&&kv(e),_(()=>w0(e,b))}}function p(){let b=n.let("ruleErrs",null);return n.try(()=>h((0,Ze._)`await `),E=>n.assign(d,!1).if((0,Ze._)`${E} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Ze._)`${E}.errors`),()=>n.throw(E))),b}function g(){let b=(0,Ze._)`${l}.errors`;return n.assign(b,null),h(Ze.nil),b}function h(b=t.async?(0,Ze._)`await `:Ze.nil){let E=c.opts.passContext?Ir.default.this:Ir.default.self,I=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ze._)`${b}${(0,b0.callValidateCode)(e,l,E,I)}`,t.modifying)}function _(b){var E;n.if((0,Ze.not)((E=t.valid)!==null&&E!==void 0?E:d),b)}}$t.funcKeywordCode=S0;function kv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ze._)`${n.parentData}[${n.parentDataProperty}]`))}function w0(e,t){let{gen:r}=e;r.if((0,Ze._)`Array.isArray(${t})`,()=>{r.assign(Ir.default.vErrors,(0,Ze._)`${Ir.default.vErrors} === null ? ${t} : ${Ir.default.vErrors}.concat(${t})`).assign(Ir.default.errors,(0,Ze._)`${Ir.default.vErrors}.length`),(0,x0.extendErrors)(e)},()=>e.error())}function z0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Sv(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ze.stringify)(r)})}function I0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}$t.validSchemaType=I0;function E0({schema:e,opts:t,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(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}$t.validateKeywordUsage=E0});var Iv=S(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.extendSubschemaMode=cr.extendSubschemaData=cr.getSubschema=void 0;var bt=W(),zv=re();function T0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}${(0,bt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,zv.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(e,t,{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}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=s.let("data",(0,bt._)`${t.data}${(0,bt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,bt.str)`${u}${(0,zv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,bt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof bt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}cr.extendSubschemaData=P0;function O0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}cr.extendSubschemaMode=O0});var op=S((fC,Ev)=>{"use strict";Ev.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),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(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Pv=S((mC,Tv)=>{"use strict";var ur=Tv.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Ka(t,n,o,e,"",e)};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 Ka(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(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 m=0;m{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.getSchemaRefs=Je.resolveUrl=Je.normalizeId=Je._getFullPath=Je.getFullPath=Je.inlineRef=void 0;var D0=re(),N0=op(),R0=Pv(),A0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function M0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ip(e):t?Ov(e)<=t:!1}Je.inlineRef=M0;var C0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ip(e){for(let t in e){if(C0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ip)||typeof r=="object"&&ip(r))return!0}return!1}function Ov(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!A0.has(r)&&(typeof e[r]=="object"&&(0,D0.eachItem)(e[r],n=>t+=Ov(n)),t===1/0))return 1/0}return t}function jv(e,t="",r){r!==!1&&(t=fn(t));let n=e.parse(t);return Dv(e,n)}Je.getFullPath=jv;function Dv(e,t){return e.serialize(t).split("#")[0]+"#"}Je._getFullPath=Dv;var U0=/#\/?$/;function fn(e){return e?e.replace(U0,""):""}Je.normalizeId=fn;function Z0(e,t,r){return r=fn(r),e.resolve(t,r)}Je.resolveUrl=Z0;var L0=/^[a-z_][-a-z0-9._]*$/i;function q0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=fn(e[r]||t),i={"":o},a=jv(n,o,!1),s={},c=new Set;return R0(e,{allKeys:!0},(d,m,p,g)=>{if(g===void 0)return;let h=a+m,_=i[g];typeof d[r]=="string"&&(_=b.call(this,d[r])),E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),i[m]=_;function b(I){let A=this.opts.uriResolver.resolve;if(I=fn(_?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!==fn(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,m,p){if(m!==void 0&&!N0(d,m))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Je.getSchemaRefs=q0});var Go=S(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.getData=lr.KeywordCxt=lr.validateFunctionCode=void 0;var Cv=fv(),Nv=Jo(),sp=Xd(),Ha=Jo(),F0=$v(),Ho=wv(),ap=Iv(),O=W(),U=Lt(),V0=Wo(),qt=re(),Ko=Vo();function J0(e){if(Lv(e)&&(qv(e),Zv(e))){H0(e);return}Uv(e,()=>(0,Cv.topBoolOrEmptySchema)(e))}lr.validateFunctionCode=J0;function Uv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,O._)`${U.default.data}, ${U.default.valCxt}`,n.$async,()=>{e.code((0,O._)`"use strict"; ${Rv(r,o)}`),K0(e,o),e.code(i)}):e.func(t,(0,O._)`${U.default.data}, ${W0(o)}`,n.$async,()=>e.code(Rv(r,o)).code(i))}function W0(e){return(0,O._)`{${U.default.instancePath}="", ${U.default.parentData}, ${U.default.parentDataProperty}, ${U.default.rootData}=${U.default.data}${e.dynamicRef?(0,O._)`, ${U.default.dynamicAnchors}={}`:O.nil}}={}`}function K0(e,t){e.if(U.default.valCxt,()=>{e.var(U.default.instancePath,(0,O._)`${U.default.valCxt}.${U.default.instancePath}`),e.var(U.default.parentData,(0,O._)`${U.default.valCxt}.${U.default.parentData}`),e.var(U.default.parentDataProperty,(0,O._)`${U.default.valCxt}.${U.default.parentDataProperty}`),e.var(U.default.rootData,(0,O._)`${U.default.valCxt}.${U.default.rootData}`),t.dynamicRef&&e.var(U.default.dynamicAnchors,(0,O._)`${U.default.valCxt}.${U.default.dynamicAnchors}`)},()=>{e.var(U.default.instancePath,(0,O._)`""`),e.var(U.default.parentData,(0,O._)`undefined`),e.var(U.default.parentDataProperty,(0,O._)`undefined`),e.var(U.default.rootData,U.default.data),t.dynamicRef&&e.var(U.default.dynamicAnchors,(0,O._)`{}`)})}function H0(e){let{schema:t,opts:r,gen:n}=e;Uv(e,()=>{r.$comment&&t.$comment&&Vv(e),Q0(e),n.let(U.default.vErrors,null),n.let(U.default.errors,0),r.unevaluated&&G0(e),Fv(e),rz(e)})}function G0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,O._)`${r}.evaluated`),t.if((0,O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,O._)`${e.evaluated}.props`,(0,O._)`undefined`)),t.if((0,O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,O._)`${e.evaluated}.items`,(0,O._)`undefined`))}function Rv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function B0(e,t){if(Lv(e)&&(qv(e),Zv(e))){X0(e,t);return}(0,Cv.boolOrEmptySchema)(e,t)}function Zv({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Lv(e){return typeof e.schema!="boolean"}function X0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Vv(e),ez(e),tz(e);let i=n.const("_errs",U.default.errors);Fv(e,i),n.var(t,(0,O._)`${i} === ${U.default.errors}`)}function qv(e){(0,qt.checkUnknownRules)(e),Y0(e)}function Fv(e,t){if(e.opts.jtd)return Av(e,[],!1,t);let r=(0,Nv.getSchemaTypes)(e.schema),n=(0,Nv.coerceAndCheckDataType)(e,r);Av(e,r,!n,t)}function Y0(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,qt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Q0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,qt.checkStrictMode)(e,"default is ignored in the schema root")}function ez(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,V0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function tz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Vv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,O._)`${U.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,O.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,O._)`${U.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function rz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,O._)`${U.default.errors} === 0`,()=>t.return(U.default.data),()=>t.throw((0,O._)`new ${o}(${U.default.vErrors})`)):(t.assign((0,O._)`${n}.errors`,U.default.vErrors),i.unevaluated&&nz(e),t.return((0,O._)`${U.default.errors} === 0`))}function nz({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0,O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0,O._)`${t}.items`,n)}function Av(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,qt.schemaHasRulesButRef)(i,l))){o.block(()=>Wv(e,"$ref",l.all.$ref.definition));return}c.jtd||oz(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,sp.shouldUseGroup)(i,m)&&(m.type?(o.if((0,Ha.checkDataType)(m.type,a,c.strictNumbers)),Mv(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,Ha.reportTypeError)(e)),o.endIf()):Mv(e,m),s||o.if((0,O._)`${U.default.errors} === ${n||0}`))}}function Mv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,F0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,sp.shouldUseRule)(n,i)&&Wv(e,i.keyword,i.definition,t.type)})}function oz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(iz(e,t),e.opts.allowUnionTypes||az(e,t),sz(e,e.dataTypes))}function iz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Jv(e.dataTypes,r)||cp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),uz(e,t)}}function az(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&cp(e,"use allowUnionTypes to allow union type keyword")}function sz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,sp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>cz(t,a))&&cp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function cz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Jv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function uz(e,t){let r=[];for(let n of e.dataTypes)Jv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function cp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,qt.checkStrictMode)(e,t,e.opts.strictTypes)}var Ga=class{constructor(t,r,n){if((0,Ho.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,qt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Kv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Ho.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=t.gen.const("_errs",U.default.errors))}result(t,r,n){this.failResult((0,O.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,O.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,O._)`${r} !== undefined && (${(0,O.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Ko.reportExtraError:Ko.reportError)(this,this.def.error,r)}$dataError(){(0,Ko.reportError)(this,this.def.$dataError||Ko.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ko.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=O.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=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)),t!==O.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,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=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0,ap.getSubschema)(this.it,t);(0,ap.extendSubschemaData)(n,this.it,t),(0,ap.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return B0(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=qt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=qt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,O.Name)),!0}};lr.KeywordCxt=Ga;function Wv(e,t,r,n){let o=new Ga(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Ho.funcKeywordCode)(o,r):"macro"in r?(0,Ho.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Ho.funcKeywordCode)(o,r)}var lz=/^\/(?:[^~]|~0|~1)*$/,dz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Kv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return U.default.rootData;if(e[0]==="/"){if(!lz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=U.default.rootData}else{let u=dz.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,O._)`${i}${(0,O.getProperty)((0,qt.unescapeJsonPointer)(u))}`,a=(0,O._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}lr.getData=Kv});var Ba=S(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var up=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};lp.default=up});var Bo=S(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var dp=Wo(),pp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,dp.resolveUrl)(t,r,n),this.missingSchema=(0,dp.normalizeId)((0,dp.getFullPath)(t,this.missingRef))}};fp.default=pp});var Ya=S(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.resolveSchema=st.getCompilingSchema=st.resolveRef=st.compileSchema=st.SchemaEnv=void 0;var ft=W(),pz=Ba(),Er=Lt(),mt=Wo(),Hv=re(),fz=Go(),mn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,mt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};st.SchemaEnv=mn;function hp(e){let t=Gv.call(this,e);if(t)return t;let r=(0,mt.getFullPath)(this.opts.uriResolver,e.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;e.$async&&(s=a.scopeValue("Error",{ref:pz.default,code:(0,ft._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.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:e.schema,code:(0,ft.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ft.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ft._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(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,e));let p=new Function(`${Er.default.self}`,`${Er.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:h}=u;p.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},p.source&&(p.source.evaluated=(0,ft.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}st.compileSchema=hp;function mz(e,t,r){var n;r=(0,mt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=vz.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new mn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=hz.call(this,i)}st.resolveRef=mz;function hz(e){return(0,mt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:hp.call(this,e)}function Gv(e){for(let t of this._compilations)if(gz(t,e))return t}st.getCompilingSchema=Gv;function gz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function vz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Xa.call(this,e,t)}function Xa(e,t){let r=this.opts.uriResolver.parse(t),n=(0,mt._getFullPath)(this.opts.uriResolver,r),o=(0,mt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return mp.call(this,r,e);let i=(0,mt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Xa.call(this,e,a);return typeof s?.schema!="object"?void 0:mp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||hp.call(this,a),i===(0,mt.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,mt.resolveUrl)(this.opts.uriResolver,o,u)),new mn({schema:s,schemaId:c,root:e,baseId:o})}return mp.call(this,r,a)}}st.resolveSchema=Xa;var _z=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function mp(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Hv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!_z.has(s)&&u&&(t=(0,mt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Hv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,mt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Xa.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new mn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var Bv=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 vp=S((bC,e_)=>{"use strict";var $z=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Yv=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 gp(e){let t="",r=0,n=0;for(n=0;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var bz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Xv(e){return e.length=0,!0}function xz(e,t,r){if(e.length){let n=gp(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function kz(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=xz;for(let c=0;c7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=Xv}else{o.push(u);continue}}return o.length&&(s===Xv?r.zone=o.join(""):a?n.push(o.join("")):n.push(gp(o))),r.address=n.join(""),r}function Qv(e){if(Sz(e,":")<2)return{host:e,isIPV6:!1};let t=kz(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function Sz(e,t){let r=0;for(let n=0;n{"use strict";var{isUUID:Ez}=vp(),Tz=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Pz=["http","https","ws","wss","urn","urn:uuid"];function Oz(e){return Pz.indexOf(e)!==-1}function _p(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function t_(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function r_(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function jz(e){return e.secure=_p(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Dz(e){if((e.port===(_p(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Nz(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Tz);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=yp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Rz(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=yp(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function Az(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Ez(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Mz(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var n_={scheme:"http",domainHost:!0,parse:t_,serialize:r_},Cz={scheme:"https",domainHost:n_.domainHost,parse:t_,serialize:r_},Qa={scheme:"ws",domainHost:!0,parse:jz,serialize:Dz},Uz={scheme:"wss",domainHost:Qa.domainHost,parse:Qa.parse,serialize:Qa.serialize},Zz={scheme:"urn",parse:Nz,serialize:Rz,skipNormalize:!0},Lz={scheme:"urn:uuid",parse:Az,serialize:Mz,skipNormalize:!0},es={http:n_,https:Cz,ws:Qa,wss:Uz,urn:Zz,"urn:uuid":Lz};Object.setPrototypeOf(es,null);function yp(e){return e&&(es[e]||es[e.toLowerCase()])||void 0}o_.exports={wsIsSecure:_p,SCHEMES:es,isValidSchemeName:Oz,getSchemeHandler:yp}});var c_=S((kC,rs)=>{"use strict";var{normalizeIPv6:qz,removeDotSegments:Xo,recomposeAuthority:Fz,normalizeComponentEncoding:ts,isIPv4:Vz,nonSimpleDomain:Jz}=vp(),{SCHEMES:Wz,getSchemeHandler:a_}=i_();function Kz(e,t){return typeof e=="string"?e=xt(Ft(e,t),t):typeof e=="object"&&(e=Ft(xt(e,t),t)),e}function Hz(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=s_(Ft(e,n),Ft(t,n),n,!0);return n.skipEscape=!0,xt(o,n)}function s_(e,t,r,n){let o={};return n||(e=Ft(xt(e,r),r),t=Ft(xt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Xo(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Xo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Xo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=Xo(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function Gz(e,t,r){return typeof e=="string"?(e=unescape(e),e=xt(ts(Ft(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=xt(ts(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=xt(ts(Ft(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=xt(ts(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function xt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],i=a_(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=Fz(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=Xo(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 Bz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ft(e,t){let r=Object.assign({},t),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?e=r.scheme+":"+e:e="//"+e);let i=e.match(Bz);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(Vz(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=a_(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)&&(e.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 $p={SCHEMES:Wz,normalize:Kz,resolve:Hz,resolveComponent:s_,equal:Gz,serialize:xt,parse:Ft};rs.exports=$p;rs.exports.default=$p;rs.exports.fastUri=$p});var l_=S(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var u_=c_();u_.code='require("ajv/dist/runtime/uri").default';bp.default=u_});var __=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=Go();Object.defineProperty(ze,"KeywordCxt",{enumerable:!0,get:function(){return Xz.KeywordCxt}});var hn=W();Object.defineProperty(ze,"_",{enumerable:!0,get:function(){return hn._}});Object.defineProperty(ze,"str",{enumerable:!0,get:function(){return hn.str}});Object.defineProperty(ze,"stringify",{enumerable:!0,get:function(){return hn.stringify}});Object.defineProperty(ze,"nil",{enumerable:!0,get:function(){return hn.nil}});Object.defineProperty(ze,"Name",{enumerable:!0,get:function(){return hn.Name}});Object.defineProperty(ze,"CodeGen",{enumerable:!0,get:function(){return hn.CodeGen}});var Yz=Ba(),h_=Bo(),Qz=Bd(),Yo=Ya(),eI=W(),Qo=Wo(),ns=Jo(),kp=re(),d_=Bv(),tI=l_(),g_=(e,t)=>new RegExp(e,t);g_.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.'},p_=200;function aI(e){var t,r,n,o,i,a,s,c,u,l,d,m,p,g,h,_,b,E,I,A,j,Le,de,Wt,Qe;let Kt=e.strict,Ds=(t=e.code)===null||t===void 0?void 0:t.optimize,Nf=Ds===!0||Ds===void 0?1:Ds||0,Rf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:g_,u$=(o=e.uriResolver)!==null&&o!==void 0?o:tI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Kt)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Kt)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Kt)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:Kt)!==null&&m!==void 0?m:"log",strictRequired:(g=(p=e.strictRequired)!==null&&p!==void 0?p:Kt)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Nf,regExp:Rf}:{optimize:Nf,regExp:Rf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:p_,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:p_,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(I=e.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(A=e.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(j=e.addUsedSchema)!==null&&j!==void 0?j:!0,validateSchema:(Le=e.validateSchema)!==null&&Le!==void 0?Le:!0,validateFormats:(de=e.validateFormats)!==null&&de!==void 0?de:!0,unicodeRegExp:(Wt=e.unicodeRegExp)!==null&&Wt!==void 0?Wt:!0,int32range:(Qe=e.int32range)!==null&&Qe!==void 0?Qe:!0,uriResolver:u$}}var ei=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...aI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new eI.ValueScope({scope:{},prefixes:nI,es5:r,lines:n}),this.logger=pI(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Qz.getRules)(),f_.call(this,oI,t,"NOT SUPPORTED"),f_.call(this,iI,t,"DEPRECATED","warn"),this._metaOpts=lI.call(this),t.formats&&cI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&uI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),sI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=d_;n==="id"&&(o={...d_},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,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,t,r);async function o(l,d){await i.call(this,l.$schema);let m=this._addSchema(l,d);return m.validate||a.call(this,m)}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 h_.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(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,Qo.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$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,t);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(t){let r;for(;typeof(r=m_.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Yo.SchemaEnv({schema:{},schemaId:n});if(r=Yo.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=m_.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,Qo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,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,kp.eachItem)(n,i=>xp.call(this,i)),this;gI.call(this,r);let o={...r,type:(0,ns.getJSONTypes)(r.type),schemaType:(0,ns.getJSONTypes)(r.schemaType)};return(0,kp.eachItem)(n,o.type.length===0?i=>xp.call(this,i,o):i=>o.type.forEach(a=>xp.call(this,i,o,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;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]=v_(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,Qo.normalizeId)(a||n);let u=Qo.getSchemaRefs.call(this,t,n);return c=new Yo.SchemaEnv({schema:t,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(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Yo.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Yo.compileSchema.call(this,t)}finally{this.opts=r}}};ei.ValidationError=Yz.default;ei.MissingRefError=h_.default;ze.default=ei;function f_(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function m_(e){return e=(0,Qo.normalizeId)(e),this.schemas[e]||this.refs[e]}function sI(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function cI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function uI(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function lI(){let e={...this.opts};for(let t of rI)delete e[t];return e}var dI={log(){},warn(){},error(){}};function pI(e){if(e===!1)return dI;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var fI=/^[a-z_$][a-z0-9_$:-]*$/i;function mI(e,t){let{RULES:r}=this;if((0,kp.eachItem)(e,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`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function xp(e,t,r){var n;let o=t?.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[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,ns.getJSONTypes)(t.type),schemaType:(0,ns.getJSONTypes)(t.schemaType)}};t.before?hI.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function hI(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function gI(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=v_(t)),e.validateSchema=this.compile(t,!0))}var vI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function v_(e){return{anyOf:[e,vI]}}});var y_=S(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var _I={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Sp.default=_I});var k_=S(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callRef=Tr.getValidate=void 0;var yI=Bo(),$_=at(),We=W(),gn=Lt(),b_=Ya(),os=re(),$I={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=b_.resolveRef.call(c,u,o,r);if(l===void 0)throw new yI.default(n.opts.uriResolver,o,r);if(l instanceof b_.SchemaEnv)return m(l);return p(l);function d(){if(i===u)return is(e,a,i,i.$async);let g=t.scopeValue("root",{ref:u});return is(e,(0,We._)`${g}.validate`,u,u.$async)}function m(g){let h=x_(e,g);is(e,h,g,g.$async)}function p(g){let h=t.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,We.stringify)(g)}:{ref:g}),_=t.name("valid"),b=e.subschema({schema:g,dataTypes:[],schemaPath:We.nil,topSchemaRef:h,errSchemaPath:r},_);e.mergeEvaluated(b),e.ok(_)}}};function x_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,We._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Tr.getValidate=x_;function is(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?gn.default.this:We.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,We._)`await ${(0,$_.callValidateCode)(e,t,u)}`),p(t),a||o.assign(g,!0)},h=>{o.if((0,We._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),m(h),a||o.assign(g,!1)}),e.ok(g)}function d(){e.result((0,$_.callValidateCode)(e,t,u),()=>p(t),()=>m(t))}function m(g){let h=(0,We._)`${g}.errors`;o.assign(gn.default.vErrors,(0,We._)`${gn.default.vErrors} === null ? ${h} : ${gn.default.vErrors}.concat(${h})`),o.assign(gn.default.errors,(0,We._)`${gn.default.vErrors}.length`)}function p(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=os.mergeEvaluated.props(o,_.props,i.props));else{let b=o.var("props",(0,We._)`${g}.evaluated.props`);i.props=os.mergeEvaluated.props(o,b,i.props,We.Name)}if(i.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(i.items=os.mergeEvaluated.items(o,_.items,i.items));else{let b=o.var("items",(0,We._)`${g}.evaluated.items`);i.items=os.mergeEvaluated.items(o,b,i.items,We.Name)}}}Tr.callRef=is;Tr.default=$I});var S_=S(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});var bI=y_(),xI=k_(),kI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",bI.default,xI.default];wp.default=kI});var w_=S(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var as=W(),dr=as.operators,ss={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:e,schemaCode:t})=>(0,as.str)`must be ${ss[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,as._)`{comparison: ${ss[e].okStr}, limit: ${t}}`},wI={keyword:Object.keys(ss),type:"number",schemaType:"number",$data:!0,error:SI,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,as._)`${r} ${ss[t].fail} ${n} || isNaN(${r})`)}};zp.default=wI});var z_=S(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var ti=W(),zI={message:({schemaCode:e})=>(0,ti.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ti._)`{multipleOf: ${e}}`},II={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:zI,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,ti._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,ti._)`${a} !== parseInt(${a})`;e.fail$data((0,ti._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Ip.default=II});var E_=S(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});function I_(e){let t=e.length,r=0,n=0,o;for(;n=55296&&o<=56319&&n{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var Pr=W(),EI=re(),TI=E_(),PI={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Pr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Pr._)`{limit: ${e}}`},OI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:PI,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Pr.operators.GT:Pr.operators.LT,a=o.opts.unicode===!1?(0,Pr._)`${r}.length`:(0,Pr._)`${(0,EI.useFunc)(e.gen,TI.default)}(${r})`;e.fail$data((0,Pr._)`${a} ${i} ${n}`)}};Tp.default=OI});var P_=S(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var jI=at(),cs=W(),DI={message:({schemaCode:e})=>(0,cs.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,cs._)`{pattern: ${e}}`},NI={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:DI,code(e){let{data:t,$data:r,schema:n,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"",s=r?(0,cs._)`(new RegExp(${o}, ${a}))`:(0,jI.usePattern)(e,n);e.fail$data((0,cs._)`!${s}.test(${t})`)}};Pp.default=NI});var O_=S(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var ri=W(),RI={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ri.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ri._)`{limit: ${e}}`},AI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:RI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?ri.operators.GT:ri.operators.LT;e.fail$data((0,ri._)`Object.keys(${r}).length ${o} ${n}`)}};Op.default=AI});var j_=S(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var ni=at(),oi=W(),MI=re(),CI={message:({params:{missingProperty:e}})=>(0,oi.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,oi._)`{missingProperty: ${e}}`},UI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:CI,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if(p?.[h]===void 0&&!g.has(h)){let _=a.schemaEnv.baseId+a.errSchemaPath,b=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,MI.checkStrictMode)(a,b,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(oi.nil,d);else for(let p of r)(0,ni.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||i){let g=t.let("valid",!0);e.block$data(g,()=>m(p,g)),e.ok(g)}else t.if((0,ni.checkMissingProp)(e,r,p)),(0,ni.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,ni.noPropertyInData)(t,o,p,s.ownProperties),()=>e.error())})}function m(p,g){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(g,(0,ni.propertyInData)(t,o,p,s.ownProperties)),t.if((0,oi.not)(g),()=>{e.error(),t.break()})},oi.nil)}}};jp.default=UI});var D_=S(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var ii=W(),ZI={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,ii.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,ii._)`{limit: ${e}}`},LI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:ZI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?ii.operators.GT:ii.operators.LT;e.fail$data((0,ii._)`${r}.length ${o} ${n}`)}};Dp.default=LI});var us=S(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var N_=op();N_.code='require("ajv/dist/runtime/equal").default';Np.default=N_});var R_=S(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var Rp=Jo(),Ie=W(),qI=re(),FI=us(),VI={message:({params:{i:e,j:t}})=>(0,Ie.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ie._)`{i: ${e}, j: ${t}}`},JI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:VI,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Rp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Ie._)`${a} === false`),e.ok(c);function l(){let g=t.let("i",(0,Ie._)`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(c,!0),t.if((0,Ie._)`${g} > 1`,()=>(d()?m:p)(g,h))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,h){let _=t.name("item"),b=(0,Rp.checkDataTypes)(u,_,s.opts.strictNumbers,Rp.DataType.Wrong),E=t.const("indices",(0,Ie._)`{}`);t.for((0,Ie._)`;${g}--;`,()=>{t.let(_,(0,Ie._)`${r}[${g}]`),t.if(b,(0,Ie._)`continue`),u.length>1&&t.if((0,Ie._)`typeof ${_} == "string"`,(0,Ie._)`${_} += "_"`),t.if((0,Ie._)`typeof ${E}[${_}] == "number"`,()=>{t.assign(h,(0,Ie._)`${E}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,Ie._)`${E}[${_}] = ${g}`)})}function p(g,h){let _=(0,qI.useFunc)(t,FI.default),b=t.name("outer");t.label(b).for((0,Ie._)`;${g}--;`,()=>t.for((0,Ie._)`${h} = ${g}; ${h}--;`,()=>t.if((0,Ie._)`${_}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(b)})))}}};Ap.default=JI});var A_=S(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var Mp=W(),WI=re(),KI=us(),HI={message:"must be equal to constant",params:({schemaCode:e})=>(0,Mp._)`{allowedValue: ${e}}`},GI={keyword:"const",$data:!0,error:HI,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Mp._)`!${(0,WI.useFunc)(t,KI.default)}(${r}, ${o})`):e.fail((0,Mp._)`${i} !== ${r}`)}};Cp.default=GI});var M_=S(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var ai=W(),BI=re(),XI=us(),YI={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,ai._)`{allowedValues: ${e}}`},QI={keyword:"enum",schemaType:"array",$data:!0,error:YI,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;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,BI.useFunc)(t,XI.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=t.const("vSchema",i);l=(0,ai.or)(...o.map((g,h)=>m(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,p=>t.if((0,ai._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function m(p,g){let h=o[g];return typeof h=="object"&&h!==null?(0,ai._)`${u()}(${r}, ${p}[${g}])`:(0,ai._)`${r} === ${h}`}}};Up.default=QI});var C_=S(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var eE=w_(),tE=z_(),rE=T_(),nE=P_(),oE=O_(),iE=j_(),aE=D_(),sE=R_(),cE=A_(),uE=M_(),lE=[eE.default,tE.default,rE.default,nE.default,oE.default,iE.default,aE.default,sE.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},cE.default,uE.default];Zp.default=lE});var qp=S(si=>{"use strict";Object.defineProperty(si,"__esModule",{value:!0});si.validateAdditionalItems=void 0;var Or=W(),Lp=re(),dE={message:({params:{len:e}})=>(0,Or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Or._)`{limit: ${e}}`},pE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:dE,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Lp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}U_(e,n)}};function U_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Or._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Or._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Lp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${t.length}`);r.if((0,Or.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Lp.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}si.validateAdditionalItems=U_;si.default=pE});var Fp=S(ci=>{"use strict";Object.defineProperty(ci,"__esModule",{value:!0});ci.validateTuple=void 0;var Z_=W(),ls=re(),fE=at(),mE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return L_(e,"additionalItems",t);r.items=!0,!(0,ls.alwaysValidSchema)(r,t)&&e.ok((0,fE.validateArray)(e))}};function L_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=ls.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,Z_._)`${i}.length`);r.forEach((d,m)=>{(0,ls.alwaysValidSchema)(s,d)||(n.if((0,Z_._)`${u} > ${m}`,()=>e.subschema({keyword:a,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:p}=s,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let _=`"${a}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,ls.checkStrictMode)(s,_,m.strictTuples)}}}ci.validateTuple=L_;ci.default=mE});var q_=S(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var hE=Fp(),gE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,hE.validateTuple)(e,"items")};Vp.default=gE});var V_=S(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var F_=W(),vE=re(),_E=at(),yE=qp(),$E={message:({params:{len:e}})=>(0,F_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,F_._)`{limit: ${e}}`},bE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:$E,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,vE.alwaysValidSchema)(n,t)&&(o?(0,yE.validateAdditionalItems)(e,o):e.ok((0,_E.validateArray)(e)))}};Jp.default=bE});var J_=S(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var ct=W(),ds=re(),xE={message:({params:{min:e,max:t}})=>t===void 0?(0,ct.str)`must contain at least ${e} valid item(s)`:(0,ct.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ct._)`{minContains: ${e}}`:(0,ct._)`{minContains: ${e}, maxContains: ${t}}`},kE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:xE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,ct._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,ds.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,ds.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ds.alwaysValidSchema)(i,r)){let h=(0,ct._)`${l} >= ${a}`;s!==void 0&&(h=(0,ct._)`${h} && ${l} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,ct._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),_=t.let("count",0);p(h,()=>t.if(h,()=>g(_)))}function p(h,_){t.forRange("i",0,l,b=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:ds.Type.Num,compositeRule:!0},h),_()})}function g(h){t.code((0,ct._)`${h}++`),s===void 0?t.if((0,ct._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,ct._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,ct._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};Wp.default=kE});var H_=S(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.validateSchemaDeps=kt.validatePropertyDeps=kt.error=void 0;var Kp=W(),SE=re(),ui=at();kt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Kp.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Kp._)`{property: ${e}, missingProperty: ${n}, depsCount: ${t}, deps: ${r}}`};var wE={keyword:"dependencies",type:"object",schemaType:"object",error:kt.error,code(e){let[t,r]=zE(e);W_(e,t),K_(e,r)}};function zE({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function W_(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,ui.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,ui.checkReportMissingProp)(e,u)}):(r.if((0,Kp._)`${c} && (${(0,ui.checkMissingProp)(e,s,i)})`),(0,ui.reportMissingProp)(e,i),r.else())}}kt.validatePropertyDeps=W_;function K_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,SE.alwaysValidSchema)(i,t[s])||(r.if((0,ui.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}kt.validateSchemaDeps=K_;kt.default=wE});var B_=S(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var G_=W(),IE=re(),EE={message:"property name must be valid",params:({params:e})=>(0,G_._)`{propertyName: ${e.propertyName}}`},TE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:EE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,IE.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,G_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Hp.default=TE});var Bp=S(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var ps=at(),ht=W(),PE=Lt(),fs=re(),OE={message:"must NOT have additional properties",params:({params:e})=>(0,ht._)`{additionalProperty: ${e.additionalProperty}}`},jE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:OE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,fs.alwaysValidSchema)(a,r))return;let u=(0,ps.allSchemaProperties)(n.properties),l=(0,ps.allSchemaProperties)(n.patternProperties);d(),e.ok((0,ht._)`${i} === ${PE.default.errors}`);function d(){t.forIn("key",o,_=>{!u.length&&!l.length?g(_):t.if(m(_),()=>g(_))})}function m(_){let b;if(u.length>8){let E=(0,fs.schemaRefOrVal)(a,n.properties,"properties");b=(0,ps.isOwnProperty)(t,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,ps.usePattern)(e,E)}.test(${_})`))),(0,ht.not)(b)}function p(_){t.code((0,ht._)`delete ${o}[${_}]`)}function g(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,fs.alwaysValidSchema)(a,r)){let b=t.name("valid");c.removeAdditional==="failing"?(h(_,b,!1),t.if((0,ht.not)(b),()=>{e.reset(),p(_)})):(h(_,b),s||t.if((0,ht.not)(b),()=>t.break()))}}function h(_,b,E){let I={keyword:"additionalProperties",dataProp:_,dataPropType:fs.Type.Str};E===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(I,b)}}};Gp.default=jE});var Q_=S(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var DE=Go(),X_=at(),Xp=re(),Y_=Bp(),NE={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Y_.default.code(new DE.KeywordCxt(i,Y_.default,"additionalProperties"));let a=(0,X_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Xp.mergeEvaluated.props(t,(0,Xp.toHash)(a),i.props));let s=a.filter(d=>!(0,Xp.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,X_.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Yp.default=NE});var ny=S(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var ey=at(),ms=W(),ty=re(),ry=re(),RE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,ey.allSchemaProperties)(r),c=s.filter(h=>(0,ty.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=t.name("valid");i.props!==!0&&!(i.props instanceof ms.Name)&&(i.props=(0,ry.evaluatedPropsToName)(t,i.props));let{props:d}=i;m();function m(){for(let h of s)u&&p(h),i.allErrors?g(h):(t.var(l,!0),g(h),t.if(l))}function p(h){for(let _ in u)new RegExp(h).test(_)&&(0,ty.checkStrictMode)(i,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",n,_=>{t.if((0,ms._)`${(0,ey.usePattern)(e,h)}.test(${_})`,()=>{let b=c.includes(h);b||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:ry.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,ms._)`${d}[${_}]`,!0):!b&&!i.allErrors&&t.if((0,ms.not)(l),()=>t.break())})})}}};Qp.default=RE});var oy=S(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var AE=re(),ME={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,AE.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ef.default=ME});var iy=S(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var CE=at(),UE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:CE.validateUnion,error:{message:"must match a schema in anyOf"}};tf.default=UE});var ay=S(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var hs=W(),ZE=re(),LE={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,hs._)`{passingSchemas: ${e.passing}}`},qE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:LE,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let m;(0,ZE.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,hs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,hs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),m&&e.mergeEvaluated(m,hs.Name)})})}}};rf.default=qE});var sy=S(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var FE=re(),VE={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,FE.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};nf.default=VE});var ly=S(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var gs=W(),uy=re(),JE={message:({params:e})=>(0,gs.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,gs._)`{failingKeyword: ${e.ifClause}}`},WE={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:JE,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,uy.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=cy(n,"then"),i=cy(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,gs.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(m,a),d?t.assign(d,(0,gs._)`${l}`):e.setParams({ifClause:l})}}}};function cy(e,t){let r=e.schema[t];return r!==void 0&&!(0,uy.alwaysValidSchema)(e,r)}of.default=WE});var dy=S(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var KE=re(),HE={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,KE.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};af.default=HE});var py=S(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var GE=qp(),BE=q_(),XE=Fp(),YE=V_(),QE=J_(),eT=H_(),tT=B_(),rT=Bp(),nT=Q_(),oT=ny(),iT=oy(),aT=iy(),sT=ay(),cT=sy(),uT=ly(),lT=dy();function dT(e=!1){let t=[iT.default,aT.default,sT.default,cT.default,uT.default,lT.default,tT.default,rT.default,eT.default,nT.default,oT.default];return e?t.push(BE.default,YE.default):t.push(GE.default,XE.default),t.push(QE.default),t}sf.default=dT});var fy=S(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var _e=W(),pT={message:({schemaCode:e})=>(0,_e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,_e._)`{format: ${e}}`},fT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:pT,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?m():p();function m(){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)),e.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 && ${_} === ${t} && !${j}`}}function p(){let g=d.formats[i];if(!g){E();return}if(g===!0)return;let[h,_,b]=I(g);h===t&&e.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})`}}}};cf.default=fT});var my=S(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var mT=fy(),hT=[mT.default];uf.default=hT});var hy=S(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.contentVocabulary=vn.metadataVocabulary=void 0;vn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];vn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var vy=S(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var gT=S_(),vT=C_(),_T=py(),yT=my(),gy=hy(),$T=[gT.default,vT.default,(0,_T.default)(),yT.default,gy.metadataVocabulary,gy.contentVocabulary];lf.default=$T});var yy=S(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.DiscrError=void 0;var _y;(function(e){e.Tag="tag",e.Mapping="mapping"})(_y||(vs.DiscrError=_y={}))});var by=S(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var _n=W(),df=yy(),$y=Ya(),bT=Bo(),xT=re(),kT={message:({params:{discrError:e,tagName:t}})=>e===df.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,_n._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},ST={keyword:"discriminator",type:"object",schemaType:"object",error:kT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{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=t.let("valid",!1),u=t.const("tag",(0,_n._)`${r}${(0,_n.getProperty)(s)}`);t.if((0,_n._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:df.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=m();t.if(!1);for(let g in p)t.elseIf((0,_n._)`${u} === ${g}`),t.assign(c,d(p[g]));t.else(),e.error(!1,{discrError:df.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},g);return e.mergeEvaluated(h,_n.Name),g}function m(){var p;let g={},h=b(o),_=!0;for(let A=0;A{wT.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 mf=S((ge,ff)=>{"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 zT=__(),IT=vy(),ET=by(),ky=xy(),TT=["/properties"],_s="http://json-schema.org/draft-07/schema",yn=class extends zT.default{_addVocabularies(){super._addVocabularies(),IT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(ET.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(ky,TT):ky;this.addMetaSchema(t,_s,!1),this.refs["http://json-schema.org/schema"]=_s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_s)?_s:void 0)}};ge.Ajv=yn;ff.exports=ge=yn;ff.exports.Ajv=yn;Object.defineProperty(ge,"__esModule",{value:!0});ge.default=yn;var PT=Go();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return PT.KeywordCxt}});var $n=W();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return $n._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return $n.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return $n.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return $n.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return $n.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return $n.CodeGen}});var OT=Ba();Object.defineProperty(ge,"ValidationError",{enumerable:!0,get:function(){return OT.default}});var jT=Bo();Object.defineProperty(ge,"MissingRefError",{enumerable:!0,get:function(){return jT.default}})});var Oy=S(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.formatNames=wt.fastFormats=wt.fullFormats=void 0;function St(e,t){return{validate:e,compare:t}}wt.fullFormats={date:St(Iy,_f),time:St(gf(!0),yf),"date-time":St(Sy(!0),Ty),"iso-time":St(gf(),Ey),"iso-date-time":St(Sy(),Py),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:CT,"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:JT,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:UT,int32:{type:"number",validate:qT},int64:{type:"number",validate:FT},float:{type:"number",validate:zy},double:{type:"number",validate:zy},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,yf),"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,Ty),"iso-time":St(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Ey),"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,Py),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 DT(e){return e%4===0&&(e%100!==0||e%400===0)}var NT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,RT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Iy(e){let t=NT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&DT(r)?29:RT[n])}function _f(e,t){if(e&&t)return e>t?1:e23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&a<61}}function yf(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function Ey(e,t){if(!(e&&t))return;let r=hf.exec(e),n=hf.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e=ZT}function FT(e){return Number.isInteger(e)}function zy(){return!0}var VT=/[^\\]\\Z/;function JT(e){if(VT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var jy=S(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.formatLimitDefinition=void 0;var WT=mf(),gt=W(),pr=gt.operators,ys={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:e,schemaCode:t})=>(0,gt.str)`should be ${ys[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,gt._)`{comparison: ${ys[e].okStr}, limit: ${t}}`};bn.formatLimitDefinition={keyword:Object.keys(ys),type:"string",schemaType:"string",$data:!0,error:KT,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{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 m=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,gt._)`${m}[${c.schemaCode}]`);e.fail$data((0,gt.or)((0,gt._)`typeof ${p} != "object"`,(0,gt._)`${p} instanceof RegExp`,(0,gt._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let m=c.schema,p=s.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:p,code:a.code.formats?(0,gt._)`${a.code.formats}${(0,gt.getProperty)(m)}`:void 0});e.fail$data(d(g))}function d(m){return(0,gt._)`${m}.compare(${r}, ${n}) ${ys[o].fail} 0`}},dependencies:["format"]};var HT=e=>(e.addKeyword(bn.formatLimitDefinition),e);bn.default=HT});var Ay=S((li,Ry)=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});var xn=Oy(),GT=jy(),$f=W(),Dy=new $f.Name("fullFormats"),BT=new $f.Name("fastFormats"),bf=(e,t={keywords:!0})=>{if(Array.isArray(t))return Ny(e,t,xn.fullFormats,Dy),e;let[r,n]=t.mode==="fast"?[xn.fastFormats,BT]:[xn.fullFormats,Dy],o=t.formats||xn.formatNames;return Ny(e,o,r,n),t.keywords&&(0,GT.default)(e),e};bf.get=(e,t="full")=>{let n=(t==="fast"?xn.fastFormats:xn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function Ny(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,$f._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}Ry.exports=li=bf;Object.defineProperty(li,"__esModule",{value:!0});li.default=bf});var Et=require("fs"),zn=require("path"),Mf=require("os"),Rs=(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))(Rs||{}),Af=(0,zn.join)((0,Mf.homedir)(),".claude-mem"),As=class{level=null;useColor;logFilePath=null;logFileInitialized=!1;constructor(){this.useColor=process.stdout.isTTY??!1}ensureLogFileInitialized(){if(!this.logFileInitialized){this.logFileInitialized=!0;try{let t=(0,zn.join)(Af,"logs");(0,Et.existsSync)(t)||(0,Et.mkdirSync)(t,{recursive:!0});let r=new Date().toISOString().split("T")[0];this.logFilePath=(0,zn.join)(t,`claude-mem-${r}.log`)}catch(t){console.error("[LOGGER] Failed to initialize log file:",t),this.logFilePath=null}}}getLevel(){if(this.level===null)try{let t=(0,zn.join)(Af,"settings.json");if((0,Et.existsSync)(t)){let r=(0,Et.readFileSync)(t,"utf-8"),o=(JSON.parse(r).CLAUDE_MEM_LOG_LEVEL||"INFO").toUpperCase();this.level=Rs[o]??1}else this.level=1}catch{this.level=1}return this.level}correlationId(t,r){return`obs-${t}-${r}`}sessionId(t){return`session-${t}`}formatData(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return t.toString();if(typeof t=="object"){if(t instanceof Error)return this.getLevel()===0?`${t.message} ${t.stack}`:t.message;if(Array.isArray(t))return`[${t.length} items]`;let r=Object.keys(t);return r.length===0?"{}":r.length<=3?JSON.stringify(t):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(t)}formatTool(t,r){if(!r)return t;let n=r;if(typeof r=="string")try{n=JSON.parse(r)}catch{n=r}if(t==="Bash"&&n.command)return`${t}(${n.command})`;if(n.file_path)return`${t}(${n.file_path})`;if(n.notebook_path)return`${t}(${n.notebook_path})`;if(t==="Glob"&&n.pattern)return`${t}(${n.pattern})`;if(t==="Grep"&&n.pattern)return`${t}(${n.pattern})`;if(n.url)return`${t}(${n.url})`;if(n.query)return`${t}(${n.query})`;if(t==="Task"){if(n.subagent_type)return`${t}(${n.subagent_type})`;if(n.description)return`${t}(${n.description})`}return t==="Skill"&&n.skill?`${t}(${n.skill})`:t==="LSP"&&n.operation?`${t}(${n.operation})`:t}formatTimestamp(t){let r=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0"),c=String(t.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${o} ${i}:${a}:${s}.${c}`}log(t,r,n,o,i){if(t0&&(d=` {${Object.entries(_).map(([E,I])=>`${E}=${I}`).join(", ")}}`)}let m=`[${a}] [${s}] [${c}] ${u}${n}${d}${l}`;if(this.logFilePath)try{(0,Et.appendFileSync)(this.logFilePath,m+` `,"utf8")}catch(p){process.stderr.write(`[LOGGER] Failed to write to log file: ${p} `)}else process.stderr.write(m+` `)}debug(t,r,n,o){this.log(0,t,r,n,o)}info(t,r,n,o){this.log(1,t,r,n,o)}warn(t,r,n,o){this.log(2,t,r,n,o)}error(t,r,n,o){this.log(3,t,r,n,o)}dataIn(t,r,n,o){this.info(t,`\u2192 ${r}`,n,o)}dataOut(t,r,n,o){this.info(t,`\u2190 ${r}`,n,o)}success(t,r,n,o){this.info(t,`\u2713 ${r}`,n,o)}failure(t,r,n,o){this.error(t,`\u2717 ${r}`,n,o)}timing(t,r,n,o){this.info(t,`\u23F1 ${r}`,o,{duration:`${n}ms`})}happyPathError(t,r,n,o,i=""){let u=((new Error().stack||"").split(` `)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=u?`${u[1].split("/").pop()}:${u[2]}`:"unknown",d={...n,location:l};return this.warn(t,`[HAPPY-PATH] ${r}`,d,o),i}},ve=new As;var X;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.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},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.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)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(X||(X={}));var Cf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Cf||(Cf={}));var w=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tt=e=>{switch(typeof e){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(e)?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(e)?w.array:e===null?w.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?w.promise:typeof Map<"u"&&e instanceof Map?w.map:typeof Set<"u"&&e instanceof Set?w.set:typeof Date<"u"&&e 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 Ke=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||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(;cr.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(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ke.create=e=>new Ke(e);var g$=(e,t)=>{let r;switch(e.code){case y.invalid_type:e.received===w.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,X.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${X.joinValues(e.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${X.joinValues(e.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${X.joinValues(e.options)}, received '${e.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 e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:X.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case y.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case y.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.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 ${e.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=t.defaultError,X.assertNever(e)}return{message:r}},Ht=g$;var v$=Ht;function In(){return v$}var hi=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,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:t,defaultError:s}).message;return{...o,path:i,message:s}};function x(e,t){let r=In(),n=hi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ht?void 0:Ht].filter(o=>!!o)});e.common.issues.push(n)}var Ee=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return M;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return M;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},M=Object.freeze({status:"aborted"}),Dr=e=>({status:"dirty",value:e}),Ne=e=>({status:"valid",value:e}),Ms=e=>e.status==="aborted",Cs=e=>e.status==="dirty",fr=e=>e.status==="valid",En=e=>typeof Promise<"u"&&e instanceof Promise;var T;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(T||(T={}));var et=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,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}},Uf=(e,t)=>{if(fr(t))return{success:!0,data:t.value};if(!e.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 Ke(e.common.issues);return this._error=r,this._error}}};function L(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;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 K=class{get description(){return this._def.description}_getType(t){return Tt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ee,ctx:{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(En(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Uf(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,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:t,path:[],parent:r}).then(n=>fr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(En(o)?o:Promise.resolve(o));return Uf(n,i)}refine(t,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=t(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(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new lt({schema:this,typeName:D.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 jt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Bt.create(this)}promise(){return mr.create(this,this._def)}or(t){return Cr.create([this,t],this._def)}and(t){return Ur.create(this,t,this._def)}transform(t){return new lt({...L(this._def),schema:this,typeName:D.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Vr({...L(this._def),innerType:this,defaultValue:r,typeName:D.ZodDefault})}brand(){return new gi({typeName:D.ZodBranded,type:this,...L(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Jr({...L(this._def),innerType:this,catchValue:r,typeName:D.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return vi.create(this,t)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},_$=/^c[^\s-]{8,}$/i,y$=/^[0-9a-z]+$/,$$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,b$=/^[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,x$=/^[a-z0-9_-]{21}$/i,k$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,S$=/^[-+]?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)?)??$/,w$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Us,I$=/^(?:(?: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])$/,E$=/^(?:(?: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])$/,T$=/^(([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]))$/,P$=/^(([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])$/,O$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,j$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zf="((\\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])))",D$=new RegExp(`^${Zf}$`);function Lf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function N$(e){return new RegExp(`^${Lf(e)}$`)}function R$(e){let t=`${Zf}T${Lf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function A$(e,t){return!!((t==="v4"||!t)&&I$.test(e)||(t==="v6"||!t)&&T$.test(e))}function M$(e,t){if(!k$.test(e))return!1;try{let[r]=e.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||t&&o.alg!==t)}catch{return!1}}function C$(e,t){return!!((t==="v4"||!t)&&E$.test(e)||(t==="v6"||!t)&&P$.test(e))}var Rr=class e extends K{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==w.string){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.string,received:i.parsedType}),M}let n=new Ee,o;for(let i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(o=this._getOrReturnCtx(t,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=t.data.length>i.value,s=t.data.lengtht.test(o),{validation:r,code:y.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...T.errToObj(t)})}url(t){return this._addCheck({kind:"url",...T.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...T.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...T.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...T.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...T.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...T.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...T.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...T.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...T.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...T.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...T.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...T.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...T.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...T.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...T.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...T.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...T.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...T.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...T.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...T.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...T.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...T.errToObj(r)})}nonempty(t){return this.min(1,T.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew Rr({checks:[],typeName:D.ZodString,coerce:e?.coerce??!1,...L(e)});function U$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var Tn=class e extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==w.number){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.number,received:i.parsedType}),M}let n,o=new Ee;for(let i of this._def.checks)i.kind==="int"?X.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,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"?U$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_finite,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:T.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:T.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuet.kind==="int"||t.kind==="multipleOf"&&X.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.valuenew Tn({checks:[],typeName:D.ZodNumber,coerce:e?.coerce||!1,...L(e)});var Pn=class e extends K{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==w.bigint)return this._getInvalidInput(t);let n,o=new Ee;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),x(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):X.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return x(r,{code:y.invalid_type,expected:w.bigint,received:r.parsedType}),M}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew Pn({checks:[],typeName:D.ZodBigInt,coerce:e?.coerce??!1,...L(e)});var On=class extends K{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==w.boolean){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.boolean,received:n.parsedType}),M}return Ne(t.data)}};On.create=e=>new On({typeName:D.ZodBoolean,coerce:e?.coerce||!1,...L(e)});var jn=class e extends K{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==w.date){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_type,expected:w.date,received:i.parsedType}),M}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return x(i,{code:y.invalid_date}),M}let n=new Ee,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(o=this._getOrReturnCtx(t,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(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:T.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:T.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.valuenew jn({checks:[],coerce:e?.coerce||!1,typeName:D.ZodDate,...L(e)});var Dn=class extends K{_parse(t){if(this._getType(t)!==w.symbol){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.symbol,received:n.parsedType}),M}return Ne(t.data)}};Dn.create=e=>new Dn({typeName:D.ZodSymbol,...L(e)});var Ar=class extends K{_parse(t){if(this._getType(t)!==w.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.undefined,received:n.parsedType}),M}return Ne(t.data)}};Ar.create=e=>new Ar({typeName:D.ZodUndefined,...L(e)});var Mr=class extends K{_parse(t){if(this._getType(t)!==w.null){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.null,received:n.parsedType}),M}return Ne(t.data)}};Mr.create=e=>new Mr({typeName:D.ZodNull,...L(e)});var Nn=class extends K{constructor(){super(...arguments),this._any=!0}_parse(t){return Ne(t.data)}};Nn.create=e=>new Nn({typeName:D.ZodAny,...L(e)});var Gt=class extends K{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ne(t.data)}};Gt.create=e=>new Gt({typeName:D.ZodUnknown,...L(e)});var vt=class extends K{_parse(t){let r=this._getOrReturnCtx(t);return x(r,{code:y.invalid_type,expected:w.never,received:r.parsedType}),M}};vt.create=e=>new vt({typeName:D.ZodNever,...L(e)});var Rn=class extends K{_parse(t){if(this._getType(t)!==w.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.void,received:n.parsedType}),M}return Ne(t.data)}};Rn.create=e=>new Rn({typeName:D.ZodVoid,...L(e)});var Bt=class e extends K{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==w.array)return x(r,{code:y.invalid_type,expected:w.array,received:r.parsedType}),M;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.lengtho.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(t,r){return new e({...this._def,minLength:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:T.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:T.toString(r)}})}nonempty(t){return this.min(1,t)}};Bt.create=(e,t)=>new Bt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...L(t)});function Nr(e){if(e instanceof He){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ut.create(Nr(n))}return new He({...e._def,shape:()=>t})}else return e instanceof Bt?new Bt({...e._def,type:Nr(e.element)}):e instanceof ut?ut.create(Nr(e.unwrap())):e instanceof jt?jt.create(Nr(e.unwrap())):e instanceof Ot?Ot.create(e.items.map(t=>Nr(t))):e}var He=class e extends K{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=X.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==w.object){let u=this._getOrReturnCtx(t);return x(u,{code:y.invalid_type,expected:w.object,received:u.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(t),{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,m=await l.value;u.push({key:d,value:m,alwaysSet:l.alwaysSet})}return u}).then(u=>Ee.mergeObjectSync(n,u)):Ee.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return T.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:D.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of X.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of X.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Nr(this)}partial(t){let r={};for(let n of X.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of X.objectKeys(this.shape))if(t&&!t[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 e({...this._def,shape:()=>r})}keyof(){return qf(X.objectKeys(this.shape))}};He.create=(e,t)=>new He({shape:()=>e,unknownKeys:"strip",catchall:vt.create(),typeName:D.ZodObject,...L(t)});He.strictCreate=(e,t)=>new He({shape:()=>e,unknownKeys:"strict",catchall:vt.create(),typeName:D.ZodObject,...L(t)});He.lazycreate=(e,t)=>new He({shape:e,unknownKeys:"strip",catchall:vt.create(),typeName:D.ZodObject,...L(t)});var Cr=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),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 Ke(s.ctx.common.issues));return x(r,{code:y.invalid_union,unionErrors:a}),M}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 Ke(c));return x(r,{code:y.invalid_union,unionErrors:s}),M}}get options(){return this._def.options}};Cr.create=(e,t)=>new Cr({options:e,typeName:D.ZodUnion,...L(t)});var Pt=e=>e instanceof Zr?Pt(e.schema):e instanceof lt?Pt(e.innerType()):e instanceof Lr?[e.value]:e instanceof qr?e.options:e instanceof Fr?X.objectValues(e.enum):e instanceof Vr?Pt(e._def.innerType):e instanceof Ar?[void 0]:e instanceof Mr?[null]:e instanceof ut?[void 0,...Pt(e.unwrap())]:e instanceof jt?[null,...Pt(e.unwrap())]:e instanceof gi||e instanceof Wr?Pt(e.unwrap()):e instanceof Jr?Pt(e._def.innerType):[],Zs=class e extends K{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.object)return x(r,{code:y.invalid_type,expected:w.object,received:r.parsedType}),M;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]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=Pt(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:D.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...L(n)})}};function Ls(e,t){let r=Tt(e),n=Tt(t);if(e===t)return{valid:!0,data:e};if(r===w.object&&n===w.object){let o=X.objectKeys(t),i=X.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Ls(e[s],t[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(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i{if(Ms(i)||Ms(a))return M;let s=Ls(i.value,a.value);return s.valid?((Cs(i)||Cs(a))&&r.dirty(),{status:r.value,value:s.data}):(x(n,{code:y.invalid_intersection_types}),M)};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=(e,t,r)=>new Ur({left:e,right:t,typeName:D.ZodIntersection,...L(r)});var Ot=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.array)return x(n,{code:y.invalid_type,expected:w.array,received:n.parsedType}),M;if(n.data.lengththis._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(t){return new e({...this._def,rest:t})}};Ot.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ot({items:e,typeName:D.ZodTuple,rest:null,...L(t)})};var qs=class e extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.object)return x(n,{code:y.invalid_type,expected:w.object,received:n.parsedType}),M;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(t,r,n){return r instanceof K?new e({keyType:t,valueType:r,typeName:D.ZodRecord,...L(n)}):new e({keyType:Rr.create(),valueType:t,typeName:D.ZodRecord,...L(r)})}},An=class extends K{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.map)return x(n,{code:y.invalid_type,expected:w.map,received:n.parsedType}),M;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 M;(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 M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};An.create=(e,t,r)=>new An({valueType:t,keyType:e,typeName:D.ZodMap,...L(r)});var Mn=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==w.set)return x(n,{code:y.invalid_type,expected:w.set,received:n.parsedType}),M;let o=this._def;o.minSize!==null&&n.data.sizeo.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 M;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(t,r){return new e({...this._def,minSize:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:T.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Mn.create=(e,t)=>new Mn({valueType:e,minSize:null,maxSize:null,typeName:D.ZodSet,...L(t)});var Fs=class e extends K{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.function)return x(r,{code:y.invalid_type,expected:w.function,received:r.parsedType}),M;function n(s,c){return hi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,In(),Ht].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function o(s,c){return hi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,In(),Ht].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 Ne(async function(...c){let u=new Ke([]),l=await s._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let s=this;return Ne(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Ke([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Ke([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ot.create(t).rest(Gt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Ot.create([]).rest(Gt.create()),returns:r||Gt.create(),typeName:D.ZodFunction,...L(n)})}},Zr=class extends K{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Zr.create=(e,t)=>new Zr({getter:e,typeName:D.ZodLazy,...L(t)});var Lr=class extends K{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return x(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:t.data}}get value(){return this._def.value}};Lr.create=(e,t)=>new Lr({value:e,typeName:D.ZodLiteral,...L(t)});function qf(e,t){return new qr({values:e,typeName:D.ZodEnum,...L(t)})}var qr=class e extends K{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{expected:X.joinValues(n),received:r.parsedType,code:y.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{received:r.data,code:y.invalid_enum_value,options:n}),M}return Ne(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};qr.create=qf;var Fr=class extends K{_parse(t){let r=X.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);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}),M}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=X.objectValues(r);return x(n,{received:n.data,code:y.invalid_enum_value,options:o}),M}return Ne(t.data)}get enum(){return this._def.values}};Fr.create=(e,t)=>new Fr({values:e,typeName:D.ZodNativeEnum,...L(t)});var mr=class extends K{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==w.promise&&r.common.async===!1)return x(r,{code:y.invalid_type,expected:w.promise,received:r.parsedType}),M;let n=r.parsedType===w.promise?r.data:Promise.resolve(r.data);return Ne(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};mr.create=(e,t)=>new mr({type:e,typeName:D.ZodPromise,...L(t)});var lt=class extends K{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),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 M;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?Dr(c.value):r.value==="dirty"?Dr(c.value):c});{if(r.value==="aborted")return M;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?Dr(s.value):r.value==="dirty"?Dr(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"?M:(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"?M:(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 M;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})):M);X.assertNever(o)}};lt.create=(e,t,r)=>new lt({schema:e,typeName:D.ZodEffects,effect:t,...L(r)});lt.createWithPreprocess=(e,t,r)=>new lt({schema:t,effect:{type:"preprocess",transform:e},typeName:D.ZodEffects,...L(r)});var ut=class extends K{_parse(t){return this._getType(t)===w.undefined?Ne(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ut.create=(e,t)=>new ut({innerType:e,typeName:D.ZodOptional,...L(t)});var jt=class extends K{_parse(t){return this._getType(t)===w.null?Ne(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};jt.create=(e,t)=>new jt({innerType:e,typeName:D.ZodNullable,...L(t)});var Vr=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),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}};Vr.create=(e,t)=>new Vr({innerType:e,typeName:D.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...L(t)});var Jr=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return En(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ke(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ke(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:D.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...L(t)});var Cn=class extends K{_parse(t){if(this._getType(t)!==w.nan){let n=this._getOrReturnCtx(t);return x(n,{code:y.invalid_type,expected:w.nan,received:n.parsedType}),M}return{status:"valid",value:t.data}}};Cn.create=e=>new Cn({typeName:D.ZodNaN,...L(e)});var gi=class extends K{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},vi=class e extends K{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);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"?M:i.status==="dirty"?(r.dirty(),Dr(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"?M:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:D.ZodPipeline})}},Wr=class extends K{_parse(t){let r=this._def.innerType._parse(t),n=o=>(fr(o)&&(o.value=Object.freeze(o.value)),o);return En(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:D.ZodReadonly,...L(t)});var XP={object:He.lazycreate},D;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(D||(D={}));var YP=Rr.create,QP=Tn.create,eO=Cn.create,tO=Pn.create,rO=On.create,nO=jn.create,oO=Dn.create,iO=Ar.create,aO=Mr.create,sO=Nn.create,cO=Gt.create,uO=vt.create,lO=Rn.create,dO=Bt.create,Z$=He.create,pO=He.strictCreate,fO=Cr.create,mO=Zs.create,hO=Ur.create,gO=Ot.create,vO=qs.create,_O=An.create,yO=Mn.create,$O=Fs.create,bO=Zr.create,xO=Lr.create,kO=qr.create,SO=Fr.create,wO=mr.create,zO=lt.create,IO=ut.create,EO=jt.create,TO=lt.createWithPreprocess,PO=vi.create;var Ff=Object.freeze({status:"aborted"});function f(e,t,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(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;dr?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var _t=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},hr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},_i={};function be(e){return e&&Object.assign(_i,e),_i}var $={};wn($,{BIGINT_FORMAT_RANGES:()=>Ys,Class:()=>Js,NUMBER_FORMAT_RANGES:()=>Xs,aborted:()=>er,allowsEval:()=>Hs,assert:()=>K$,assertEqual:()=>F$,assertIs:()=>J$,assertNever:()=>W$,assertNotEqual:()=>V$,assignProp:()=>Yt,base64ToUint8Array:()=>Wf,base64urlToUint8Array:()=>lb,cached:()=>Hr,captureStackTrace:()=>$i,cleanEnum:()=>ub,cleanRegex:()=>Ln,clone:()=>Re,cloneDef:()=>G$,createTransparentProxy:()=>tb,defineLazy:()=>V,esc:()=>yi,escapeRegex:()=>tt,extend:()=>ob,finalizeIssue:()=>qe,floatSafeRemainder:()=>Ws,getElementAtPath:()=>B$,getEnumValues:()=>Zn,getLengthableOrigin:()=>Vn,getParsedType:()=>eb,getSizableOrigin:()=>Fn,hexToUint8Array:()=>pb,isObject:()=>gr,isPlainObject:()=>Qt,issue:()=>Gr,joinValues:()=>N,jsonStringifyReplacer:()=>Kr,merge:()=>ab,mergeDefs:()=>Dt,normalizeParams:()=>k,nullish:()=>Xt,numKeys:()=>Q$,objectClone:()=>H$,omit:()=>nb,optionalKeys:()=>Bs,parsedType:()=>C,partial:()=>sb,pick:()=>rb,prefixIssues:()=>Ge,primitiveTypes:()=>Gs,promiseAllObject:()=>X$,propertyKeyTypes:()=>qn,randomString:()=>Y$,required:()=>cb,safeExtend:()=>ib,shallowClone:()=>Jf,slugify:()=>Ks,stringifyPrimitive:()=>R,uint8ArrayToBase64:()=>Kf,uint8ArrayToBase64url:()=>db,uint8ArrayToHex:()=>fb,unwrapMessage:()=>Un});function F$(e){return e}function V$(e){return e}function J$(e){}function W$(e){throw new Error("Unexpected value in exhaustive check")}function K$(e){}function Zn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function N(e,t="|"){return e.map(r=>R(r)).join(t)}function Kr(e,t){return typeof t=="bigint"?t.toString():t}function Hr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Xt(e){return e==null}function Ln(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ws(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.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(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var Vf=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Vf)return n===void 0&&(n=Vf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function H$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Yt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Dt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function G$(e){return Dt(e._zod.def)}function B$(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function X$(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i{};function gr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Hs=Hr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Qt(e){if(gr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(gr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Jf(e){return Qt(e)?{...e}:Array.isArray(e)?[...e]:e}function Q$(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var eb=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},qn=new Set(["string","number","symbol"]),Gs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function tt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Re(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function k(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function tb(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function R(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Bs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Xs={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ys={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function rb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Dt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Yt(this,"shape",a),a},checks:[]});return Re(e,i)}function nb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Dt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Yt(this,"shape",a),a},checks:[]});return Re(e,i)}function ob(e,t){if(!Qt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Dt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Yt(this,"shape",i),i}});return Re(e,o)}function ib(e,t){if(!Qt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Dt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Yt(this,"shape",n),n}});return Re(e,r)}function ab(e,t){let r=Dt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Yt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Re(e,r)}function sb(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Dt(t._zod.def,{get shape(){let s=t._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]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Yt(this,"shape",c),c},checks:[]});return Re(t,a)}function cb(e,t,r){let n=Dt(t._zod.def,{get shape(){let o=t._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 e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Yt(this,"shape",i),i}});return Re(t,n)}function er(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Un(e){return typeof e=="string"?e:e?.message}function qe(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Un(e.inst?._zod.def?.error?.(e))??Un(t?.error?.(e))??Un(r.customError?.(e))??Un(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Fn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Vn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function C(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Gr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function ub(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Wf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;nt.toString(16).padStart(2,"0")).join("")}var Js=class{constructor(...t){}};var Hf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Kr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bi=f("$ZodError",Hf),Jn=f("$ZodError",Hf,{Parent:Error});function xi(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function ki(e,t=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(t(i));else{let a=r,s=0;for(;s(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new _t;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>qe(c,i,be())));throw $i(s,o?.callee),s}return a.value},Kn=Wn(Jn),Hn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>qe(c,i,be())));throw $i(s,o?.callee),s}return a.value},Gn=Hn(Jn),Bn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new _t;return i.issues.length?{success:!1,error:new(e??bi)(i.issues.map(a=>qe(a,o,be())))}:{success:!0,data:i.value}},Br=Bn(Jn),Xn=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>qe(a,o,be())))}:{success:!0,data:i.value}},Yn=Xn(Jn),Gf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Wn(e)(t,r,o)};var Bf=e=>(t,r,n)=>Wn(e)(t,r,n);var Xf=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Hn(e)(t,r,o)};var Yf=e=>async(t,r,n)=>Hn(e)(t,r,n);var Qf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bn(e)(t,r,o)};var em=e=>(t,r,n)=>Bn(e)(t,r,n);var tm=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,o)};var rm=e=>async(t,r,n)=>Xn(e)(t,r,n);var rt={};wn(rt,{base64:()=>mc,base64url:()=>Si,bigint:()=>$c,boolean:()=>xc,browserEmail:()=>xb,cidrv4:()=>pc,cidrv6:()=>fc,cuid:()=>Qs,cuid2:()=>ec,date:()=>gc,datetime:()=>_c,domain:()=>wb,duration:()=>ic,e164:()=>hc,email:()=>sc,emoji:()=>cc,extendedDuration:()=>hb,guid:()=>ac,hex:()=>zb,hostname:()=>Sb,html5Email:()=>yb,idnEmail:()=>bb,integer:()=>bc,ipv4:()=>uc,ipv6:()=>lc,ksuid:()=>nc,lowercase:()=>wc,mac:()=>dc,md5_base64:()=>Eb,md5_base64url:()=>Tb,md5_hex:()=>Ib,nanoid:()=>oc,null:()=>kc,number:()=>wi,rfc5322Email:()=>$b,sha1_base64:()=>Ob,sha1_base64url:()=>jb,sha1_hex:()=>Pb,sha256_base64:()=>Nb,sha256_base64url:()=>Rb,sha256_hex:()=>Db,sha384_base64:()=>Mb,sha384_base64url:()=>Cb,sha384_hex:()=>Ab,sha512_base64:()=>Zb,sha512_base64url:()=>Lb,sha512_hex:()=>Ub,string:()=>yc,time:()=>vc,ulid:()=>tc,undefined:()=>Sc,unicodeEmail:()=>nm,uppercase:()=>zc,uuid:()=>vr,uuid4:()=>gb,uuid6:()=>vb,uuid7:()=>_b,xid:()=>rc});var Qs=/^[cC][^\s-]{8,}$/,ec=/^[0-9a-z]+$/,tc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rc=/^[0-9a-vA-V]{20}$/,nc=/^[A-Za-z0-9]{27}$/,oc=/^[a-zA-Z0-9_-]{21}$/,ic=/^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)?)??$/,ac=/^([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=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gb=vr(4),vb=vr(6),_b=vr(7),sc=/^(?!\.)(?!.*\.\.)([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,}))$/,nm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,bb=nm,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 cc(){return new RegExp(kb,"u")}var uc=/^(?:(?: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])$/,lc=/^(([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}|:))$/,dc=e=>{let t=tt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},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])\/([0-9]|[1-2][0-9]|3[0-2])$/,fc=/^(([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])$/,mc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Si=/^[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,}$/,hc=/^\+[1-9]\d{6,14}$/,om="(?:(?:\\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])))",gc=new RegExp(`^${om}$`);function im(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function vc(e){return new RegExp(`^${im(e)}$`)}function _c(e){let t=im({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${om}T(?:${n})$`)}var yc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},$c=/^-?\d+n?$/,bc=/^-?\d+$/,wi=/^-?\d+(?:\.\d+)?$/,xc=/^(?:true|false)$/i,kc=/^null$/i;var Sc=/^undefined$/i;var wc=/^[^A-Z]*$/,zc=/^[^a-z]*$/,zb=/^[0-9a-fA-F]*$/;function Qn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function eo(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ib=/^[0-9a-fA-F]{32}$/,Eb=Qn(22,"=="),Tb=eo(22),Pb=/^[0-9a-fA-F]{40}$/,Ob=Qn(27,"="),jb=eo(27),Db=/^[0-9a-fA-F]{64}$/,Nb=Qn(43,"="),Rb=eo(43),Ab=/^[0-9a-fA-F]{96}$/,Mb=Qn(64,""),Cb=eo(64),Ub=/^[0-9a-fA-F]{128}$/,Zb=Qn(86,"=="),Lb=eo(86);var se=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),sm={number:"number",bigint:"bigint",object:"date"},Ic=f("$ZodCheckLessThan",(e,t)=>{se.init(e,t);let r=sm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?n.value<=t.value:n.value{se.init(e,t);let r=sm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cm=f("$ZodCheckMultipleOf",(e,t)=>{se.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ws(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),um=f("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Xs[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=bc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});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:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}si&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),lm=f("$ZodCheckBigIntFormat",(e,t)=>{se.init(e,t);let[r,n]=Ys[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;in&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),dm=f("$ZodCheckMaxSize",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Fn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),pm=f("$ZodCheckMinSize",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Fn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fm=f("$ZodCheckSizeEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Fn(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),mm=f("$ZodCheckMaxLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{let o=n.value;if(o.length<=t.maximum)return;let a=Vn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hm=f("$ZodCheckMinLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Vn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gm=f("$ZodCheckLengthEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Xt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Vn(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),to=f("$ZodCheckStringFormat",(e,t)=>{var r,n;se.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),vm=f("$ZodCheckRegex",(e,t)=>{to.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_m=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=wc),to.init(e,t)}),ym=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zc),to.init(e,t)}),$m=f("$ZodCheckIncludes",(e,t)=>{se.init(e,t);let r=tt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),bm=f("$ZodCheckStartsWith",(e,t)=>{se.init(e,t);let r=new RegExp(`^${tt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xm=f("$ZodCheckEndsWith",(e,t)=>{se.init(e,t);let r=new RegExp(`.*${tt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function am(e,t,r){e.issues.length&&t.issues.push(...Ge(r,e.issues))}var km=f("$ZodCheckProperty",(e,t)=>{se.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>am(o,r,t.property));am(n,r,t.property)}}),Sm=f("$ZodCheckMimeType",(e,t)=>{se.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),wm=f("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var zi=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(` `).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 t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(` `))}};var Im={major:4,minor:3,patch:4};var Z=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Im;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._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 m=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new _t;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==m&&(u||(u=er(a,m)))});else{if(a.issues.length===m)continue;u||(u=er(a,m))}}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=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._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=e._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)}}V(e,"~standard",()=>({validate:o=>{try{let i=Br(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Yn(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),_r=f("$ZodString",(e,t)=>{Z.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),oe=f("$ZodStringFormat",(e,t)=>{to.init(e,t),_r.init(e,t)}),Pc=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ac),oe.init(e,t)}),Oc=f("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=vr(n))}else t.pattern??(t.pattern=vr());oe.init(e,t)}),jc=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=sc),oe.init(e,t)}),Dc=f("$ZodURL",(e,t)=>{oe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Nc=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=cc()),oe.init(e,t)}),Rc=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=oc),oe.init(e,t)}),Ac=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qs),oe.init(e,t)}),Mc=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ec),oe.init(e,t)}),Cc=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=tc),oe.init(e,t)}),Uc=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rc),oe.init(e,t)}),Zc=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=nc),oe.init(e,t)}),Lc=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_c(t)),oe.init(e,t)}),qc=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=gc),oe.init(e,t)}),Fc=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=vc(t)),oe.init(e,t)}),Vc=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ic),oe.init(e,t)}),Jc=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=uc),oe.init(e,t),e._zod.bag.format="ipv4"}),Wc=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=lc),oe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Kc=f("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=dc(t.delimiter)),oe.init(e,t),e._zod.bag.format="mac"}),Hc=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pc),oe.init(e,t)}),Gc=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fc),oe.init(e,t),e._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:e,continue:!t.abort})}}});function Um(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Bc=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mc),oe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Um(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function qb(e){if(!Si.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Um(r)}var Xc=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Si),oe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{qb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Yc=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=hc),oe.init(e,t)});function Fb(e,t=null){try{let r=e.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||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Qc=f("$ZodJWT",(e,t)=>{oe.init(e,t),e._zod.check=r=>{Fb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),eu=f("$ZodCustomStringFormat",(e,t)=>{oe.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),ji=f("$ZodNumber",(e,t)=>{Z.init(e,t),e._zod.pattern=e._zod.bag.pattern??wi,e._zod.parse=(r,n)=>{if(t.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:e,...i?{received:i}:{}}),r}}),tu=f("$ZodNumberFormat",(e,t)=>{um.init(e,t),ji.init(e,t)}),ro=f("$ZodBoolean",(e,t)=>{Z.init(e,t),e._zod.pattern=xc,e._zod.parse=(r,n)=>{if(t.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:e}),r}}),Di=f("$ZodBigInt",(e,t)=>{Z.init(e,t),e._zod.pattern=$c,e._zod.parse=(r,n)=>{if(t.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:e}),r}}),ru=f("$ZodBigIntFormat",(e,t)=>{lm.init(e,t),Di.init(e,t)}),nu=f("$ZodSymbol",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),ou=f("$ZodUndefined",(e,t)=>{Z.init(e,t),e._zod.pattern=Sc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),iu=f("$ZodNull",(e,t)=>{Z.init(e,t),e._zod.pattern=kc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),au=f("$ZodAny",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),su=f("$ZodUnknown",(e,t)=>{Z.init(e,t),e._zod.parse=r=>r}),cu=f("$ZodNever",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),uu=f("$ZodVoid",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),lu=f("$ZodDate",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(t.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:e}),r}});function Em(e,t,r){e.issues.length&&t.issues.push(...Ge(r,e.issues)),t.value[r]=e.value}var du=f("$ZodArray",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;aEm(u,r,a))):Em(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Oi(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Ge(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Zm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Bs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Lm(e,t,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 t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let m=c.run({value:t[d],issues:[]},n);m instanceof Promise?e.push(m.then(p=>Oi(p,r,d,t,l))):Oi(m,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var qm=f("$ZodObject",(e,t)=>{if(Z.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Hr(()=>Zm(t));V(e._zod,"propValues",()=>{let s=t.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=t.catchall,a;e._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:e}),s;s.value={};let l=[],d=a.shape;for(let m of a.keys){let p=d[m],g=p._zod.optout==="optional",h=p._zod.run({value:u[m],issues:[]},c);h instanceof Promise?l.push(h.then(_=>Oi(_,s,m,u,g))):Oi(h,s,m,u,g)}return i?Lm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Fm=f("$ZodObjectJIT",(e,t)=>{qm.init(e,t);let r=e._zod.parse,n=Hr(()=>Zm(t)),o=m=>{let p=new zi(["shape","payload","ctx"]),g=n.value,h=I=>{let A=yi(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),b=0;for(let I of g.keys)_[I]=`key_${b++}`;p.write("const newResult = {};");for(let I of g.keys){let A=_[I],j=yi(I),de=m[I]?._zod?.optout==="optional";p.write(`const ${A} = ${h(I)};`),de?p.write(` if (${A}.issues.length) { if (${j} in input) { payload.issues = payload.issues.concat(${A}.issues.map(iss => ({ ...iss, path: iss.path ? [${j}, ...iss.path] : [${j}] }))); } } if (${A}.value === undefined) { if (${j} in input) { newResult[${j}] = undefined; } } else { newResult[${j}] = ${A}.value; } `):p.write(` if (${A}.issues.length) { payload.issues = payload.issues.concat(${A}.issues.map(iss => ({ ...iss, path: iss.path ? [${j}, ...iss.path] : [${j}] }))); } if (${A}.value === undefined) { if (${j} in input) { newResult[${j}] = undefined; } } else { newResult[${j}] = ${A}.value; } `)}p.write("payload.value = newResult;"),p.write("return payload;");let E=p.compile();return(I,A)=>E(m,I,A)},i,a=gr,s=!_i.jitless,u=s&&Hs.value,l=t.catchall,d;e._zod.parse=(m,p)=>{d??(d=n.value);let g=m.value;return a(g)?s&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),m=i(m,p),l?Lm([],g,m,p,d,e):m):r(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Tm(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!er(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>qe(a,n,be())))}),t)}var no=f("$ZodUnion",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Ln(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.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=>Tm(c,o,e,i)):Tm(s,o,e,i)}});function Pm(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>qe(a,n,be())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var pu=f("$ZodXor",(e,t)=>{no.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.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=>Pm(c,o,e,i)):Pm(s,o,e,i)}}),fu=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,no.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.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=Hr(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.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});e._zod.parse=(o,i)=>{let a=o.value;if(!gr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),mu=f("$ZodIntersection",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Om(r,c,u)):Om(r,i,a)}});function Tc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Qt(e)&&Qt(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Tc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;ns.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),er(e))return e;let a=Tc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Ni=f("$ZodTuple",(e,t)=>{Z.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,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(!t.rest){let l=i.length>r.length,d=i.length=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(m=>Ii(m,n,u))):Ii(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let m=t.rest._zod.run({value:d,issues:[]},o);m instanceof Promise?a.push(m.then(p=>Ii(p,n,u))):Ii(m,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Ii(e,t,r){e.issues.length&&t.issues.push(...Ge(r,e.issues)),t.value[r]=e.value}var hu=f("$ZodRecord",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Qt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.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=t.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:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.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"&&wi.test(s)&&c.issues.length&&c.issues.some(d=>d.code==="invalid_type"&&d.expected==="number")){let d=t.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){t.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:e});continue}let l=t.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}}),gu=f("$ZodMap",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{jm(l,d,r,a,o,e,n)})):jm(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function jm(e,t,r,n,o,i,a){e.issues.length&&(qn.has(typeof n)?r.issues.push(...Ge(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>qe(s,a,be()))})),t.issues.length&&(qn.has(typeof n)?r.issues.push(...Ge(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>qe(s,a,be()))})),r.value.set(e.value,t.value)}var vu=f("$ZodSet",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>Dm(c,r))):Dm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Dm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var _u=f("$ZodEnum",(e,t)=>{Z.init(e,t);let r=Zn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>qn.has(typeof o)).map(o=>typeof o=="string"?tt(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),yu=f("$ZodLiteral",(e,t)=>{if(Z.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?tt(n):n?tt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),$u=f("$ZodFile",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),bu=f("$ZodTransform",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new hr(e.constructor.name);let o=t.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 Nm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ri=f("$ZodOptional",(e,t)=>{Z.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ln(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Nm(i,r.value)):Nm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),xu=f("$ZodExactOptional",(e,t)=>{Ri.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ku=f("$ZodNullable",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ln(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Su=f("$ZodDefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Rm(i,t)):Rm(o,t)}});function Rm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var wu=f("$ZodPrefault",(e,t)=>{Z.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),zu=f("$ZodNonOptional",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Am(i,e)):Am(o,e)}});function Am(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Iu=f("$ZodSuccess",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new hr("ZodSuccess");let o=t.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)}}),Eu=f("$ZodCatch",(e,t)=>{Z.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.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=t.catchValue({...r,error:{issues:o.issues.map(i=>qe(i,n,be()))},input:r.value}),r.issues=[]),r)}}),Tu=f("$ZodNaN",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Pu=f("$ZodPipe",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ei(a,t.in,n)):Ei(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Ei(i,t.out,n)):Ei(o,t.out,n)}});function Ei(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var oo=f("$ZodCodec",(e,t)=>{Z.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Ti(a,t,n)):Ti(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ti(a,t,n)):Ti(i,t,n)}}});function Ti(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Pi(e,i,t.out,r)):Pi(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Pi(e,i,t.in,r)):Pi(e,o,t.in,r)}}function Pi(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Ou=f("$ZodReadonly",(e,t)=>{Z.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType?._zod?.optin),V(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Mm):Mm(o)}});function Mm(e){return e.value=Object.freeze(e.value),e}var ju=f("$ZodTemplateLiteral",(e,t)=>{Z.init(e,t);let r=[];for(let n of t.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||Gs.has(typeof n))r.push(tt(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Du=f("$ZodFunction",(e,t)=>(Z.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?Kn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Kn(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await Gn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Gn(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Ni({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Nu=f("$ZodPromise",(e,t)=>{Z.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),Ru=f("$ZodLazy",(e,t)=>{Z.init(e,t),V(e._zod,"innerType",()=>t.getter()),V(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),V(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),V(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),V(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Au=f("$ZodCustom",(e,t)=>{se.init(e,t),Z.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Cm(i,r,n,e));Cm(o,r,n,e)}});function Cm(e,t,r,n){if(!e){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),t.issues.push(Gr(o))}}var Jb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[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 ${R(o.values[0])}`:`Invalid option: expected one of ${N(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(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=t(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":""}: ${N(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 Vm;var Uu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Zu(){return new Uu}(Vm=globalThis).__zod_globalRegistry??(Vm.__zod_globalRegistry=Zu());var Ae=globalThis.__zod_globalRegistry;function Lu(e,t){return new e({type:"string",...k(t)})}function Ai(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...k(t)})}function io(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...k(t)})}function Mi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...k(t)})}function Ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(t)})}function Ui(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(t)})}function Zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(t)})}function ao(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...k(t)})}function Li(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...k(t)})}function qi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(t)})}function Fi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...k(t)})}function Vi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(t)})}function Ji(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...k(t)})}function Wi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...k(t)})}function Ki(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(t)})}function Hi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(t)})}function Gi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(t)})}function qu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...k(t)})}function Bi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(t)})}function Xi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(t)})}function Yi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...k(t)})}function Qi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...k(t)})}function ea(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...k(t)})}function ta(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...k(t)})}function Fu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(t)})}function Vu(e,t){return new e({type:"string",format:"date",check:"string_format",...k(t)})}function Ju(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...k(t)})}function Wu(e,t){return new e({type:"string",format:"duration",check:"string_format",...k(t)})}function Ku(e,t){return new e({type:"number",checks:[],...k(t)})}function Hu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...k(t)})}function Gu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...k(t)})}function Bu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...k(t)})}function Xu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...k(t)})}function Yu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...k(t)})}function Qu(e,t){return new e({type:"boolean",...k(t)})}function el(e,t){return new e({type:"bigint",...k(t)})}function tl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...k(t)})}function rl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...k(t)})}function nl(e,t){return new e({type:"symbol",...k(t)})}function ol(e,t){return new e({type:"undefined",...k(t)})}function il(e,t){return new e({type:"null",...k(t)})}function al(e){return new e({type:"any"})}function sl(e){return new e({type:"unknown"})}function cl(e,t){return new e({type:"never",...k(t)})}function ul(e,t){return new e({type:"void",...k(t)})}function ll(e,t){return new e({type:"date",...k(t)})}function dl(e,t){return new e({type:"nan",...k(t)})}function Nt(e,t){return new Ic({check:"less_than",...k(t),value:e,inclusive:!1})}function Be(e,t){return new Ic({check:"less_than",...k(t),value:e,inclusive:!0})}function Rt(e,t){return new Ec({check:"greater_than",...k(t),value:e,inclusive:!1})}function Me(e,t){return new Ec({check:"greater_than",...k(t),value:e,inclusive:!0})}function pl(e){return Rt(0,e)}function fl(e){return Nt(0,e)}function ml(e){return Be(0,e)}function hl(e){return Me(0,e)}function yr(e,t){return new cm({check:"multiple_of",...k(t),value:e})}function $r(e,t){return new dm({check:"max_size",...k(t),maximum:e})}function At(e,t){return new pm({check:"min_size",...k(t),minimum:e})}function Xr(e,t){return new fm({check:"size_equals",...k(t),size:e})}function Yr(e,t){return new mm({check:"max_length",...k(t),maximum:e})}function tr(e,t){return new hm({check:"min_length",...k(t),minimum:e})}function Qr(e,t){return new gm({check:"length_equals",...k(t),length:e})}function so(e,t){return new vm({check:"string_format",format:"regex",...k(t),pattern:e})}function co(e){return new _m({check:"string_format",format:"lowercase",...k(e)})}function uo(e){return new ym({check:"string_format",format:"uppercase",...k(e)})}function lo(e,t){return new $m({check:"string_format",format:"includes",...k(t),includes:e})}function po(e,t){return new bm({check:"string_format",format:"starts_with",...k(t),prefix:e})}function fo(e,t){return new xm({check:"string_format",format:"ends_with",...k(t),suffix:e})}function gl(e,t,r){return new km({check:"property",property:e,schema:t,...k(r)})}function mo(e,t){return new Sm({check:"mime_type",mime:e,...k(t)})}function yt(e){return new wm({check:"overwrite",tx:e})}function ho(e){return yt(t=>t.normalize(e))}function go(){return yt(e=>e.trim())}function vo(){return yt(e=>e.toLowerCase())}function _o(){return yt(e=>e.toUpperCase())}function ra(){return yt(e=>Ks(e))}function Jm(e,t,r){return new e({type:"array",element:t,...k(r)})}function vl(e,t){return new e({type:"file",...k(t)})}function _l(e,t,r){let n=k(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function yl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...k(r)})}function $l(e){let t=Gb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Gr(n,r.value,t._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=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Gr(o))}},e(r.value,r)));return t}function Gb(e,t){let r=new se({check:"custom",...k(t)});return r._zod.check=e,r}function bl(e){let t=new se({check:"describe"});return t._zod.onattach=[r=>{let n=Ae.get(r)??{};Ae.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function xl(e){let t=new se({check:"meta"});return t._zod.onattach=[r=>{let n=Ae.get(r)??{};Ae.add(r,{...n,...e})}],t._zod.check=()=>{},t}function kl(e,t){let r=k(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),a=new Set(o),s=e.Codec??oo,c=e.Boolean??ro,u=e.String??_r,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),m=new s({type:"pipe",in:l,out:d,transform:((p,g)=>{let h=p;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:m,continue:!1}),{})}),reverseTransform:((p,g)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return m}function en(e,t,r,n={}){let o=k(n),i={...k(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}function na(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ae,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function pe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let m=a.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),pe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Ce(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function oa(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.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=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,m=e.external.uri??(g=>g);if(d)return{ref:m(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${m("__shared")}#/${s}/${p}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.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(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function ia(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.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 m=e.seen.get(l),p=m.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(p.$ref)for(let h in c)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(c[h])===JSON.stringify(m.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let p in c)p==="$ref"||p==="allOf"||p in m.def&&JSON.stringify(c[p])===JSON.stringify(m.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:yo(t,"input",e.processors),output:yo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ce(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._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 Wm=(e,t={})=>r=>{let n=na({...r,processors:t});return pe(e,n),oa(n,e),ia(n,e)},yo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=na({...o??{},target:i,io:t,processors:r});return pe(e,a),oa(a,e),ia(a,e)};var Bb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Km=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=Bb[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=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Hm=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Gm=(e,t,r,n)=>{r.type="boolean"},Bm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Xm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Ym=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Qm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},eh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},th=(e,t,r,n)=>{r.not={}},rh=(e,t,r,n)=>{},nh=(e,t,r,n)=>{},oh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ih=(e,t,r,n)=>{let o=e._zod.def,i=Zn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},ah=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.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,t.target==="draft-04"||t.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},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},uh=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._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)},lh=(e,t,r,n)=>{r.type="boolean"},dh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},ph=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},fh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},gh=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=pe(i.element,t,{...n,path:[...n.path,"items"]})},vh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=pe(a[u],t,{...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 t.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,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Sl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>pe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},_h=(e,t,r,n)=>{let o=e._zod.def,i=pe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=pe(o.right,t,{...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},yh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,p)=>pe(m,t,{...n,path:[...n.path,a,p]})),u=i.rest?pe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.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}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},$h=(e,t,r,n)=>{let o=r,i=e._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,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=pe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=pe(i.valueType,t,{...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)}},bh=(e,t,r,n)=>{let o=e._zod.def,i=pe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},xh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},kh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Sh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},wh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);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},zh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;pe(i,t,n);let a=t.seen.get(e);a.ref=i},Ih=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Eh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},wl=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Th=(e,t,r,n)=>{let o=e._zod.innerType;pe(o,t,n);let i=t.seen.get(e);i.ref=o};function tn(e){return!!e._zod}function rr(e,t){return tn(e)?Br(e,t):e.safeParse(t)}function aa(e){if(!e)return;let t;if(tn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Dh(e){if(tn(e)){let i=e._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=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var $o={};wn($o,{ZodAny:()=>Xh,ZodArray:()=>tg,ZodBase64:()=>Gl,ZodBase64URL:()=>Bl,ZodBigInt:()=>ha,ZodBigIntFormat:()=>Ql,ZodBoolean:()=>ma,ZodCIDRv4:()=>Kl,ZodCIDRv6:()=>Hl,ZodCUID:()=>Zl,ZodCUID2:()=>Ll,ZodCatch:()=>bg,ZodCodec:()=>ad,ZodCustom:()=>$a,ZodCustomStringFormat:()=>xo,ZodDate:()=>td,ZodDefault:()=>hg,ZodDiscriminatedUnion:()=>ng,ZodE164:()=>Xl,ZodEmail:()=>Ml,ZodEmoji:()=>Cl,ZodEnum:()=>bo,ZodExactOptional:()=>pg,ZodFile:()=>lg,ZodFunction:()=>Pg,ZodGUID:()=>ca,ZodIPv4:()=>Jl,ZodIPv6:()=>Wl,ZodIntersection:()=>og,ZodJWT:()=>Yl,ZodKSUID:()=>Vl,ZodLazy:()=>Ig,ZodLiteral:()=>ug,ZodMAC:()=>Kh,ZodMap:()=>sg,ZodNaN:()=>kg,ZodNanoID:()=>Ul,ZodNever:()=>Qh,ZodNonOptional:()=>od,ZodNull:()=>Bh,ZodNullable:()=>mg,ZodNumber:()=>fa,ZodNumberFormat:()=>rn,ZodObject:()=>ga,ZodOptional:()=>nd,ZodPipe:()=>id,ZodPrefault:()=>vg,ZodPromise:()=>Tg,ZodReadonly:()=>Sg,ZodRecord:()=>ya,ZodSet:()=>cg,ZodString:()=>da,ZodStringFormat:()=>ce,ZodSuccess:()=>$g,ZodSymbol:()=>Hh,ZodTemplateLiteral:()=>zg,ZodTransform:()=>dg,ZodTuple:()=>ig,ZodType:()=>q,ZodULID:()=>ql,ZodURL:()=>pa,ZodUUID:()=>Mt,ZodUndefined:()=>Gh,ZodUnion:()=>va,ZodUnknown:()=>Yh,ZodVoid:()=>eg,ZodXID:()=>Fl,ZodXor:()=>rg,_ZodString:()=>Al,_default:()=>gg,_function:()=>mk,any:()=>Bx,array:()=>G,base64:()=>Dx,base64url:()=>Nx,bigint:()=>Jx,boolean:()=>ye,catch:()=>xg,check:()=>hk,cidrv4:()=>Ox,cidrv6:()=>jx,codec:()=>dk,cuid:()=>kx,cuid2:()=>Sx,custom:()=>sd,date:()=>Yx,describe:()=>gk,discriminatedUnion:()=>_a,e164:()=>Rx,email:()=>fx,emoji:()=>bx,enum:()=>Pe,exactOptional:()=>fg,file:()=>sk,float32:()=>Lx,float64:()=>qx,function:()=>mk,guid:()=>mx,hash:()=>Zx,hex:()=>Ux,hostname:()=>Cx,httpUrl:()=>$x,instanceof:()=>_k,int:()=>Rl,int32:()=>Fx,int64:()=>Wx,intersection:()=>So,ipv4:()=>Ex,ipv6:()=>Px,json:()=>$k,jwt:()=>Ax,keyof:()=>Qx,ksuid:()=>Ix,lazy:()=>Eg,literal:()=>P,looseObject:()=>Te,looseRecord:()=>nk,mac:()=>Tx,map:()=>ok,meta:()=>vk,nan:()=>lk,nanoid:()=>xx,nativeEnum:()=>ak,never:()=>ed,nonoptional:()=>yg,null:()=>ko,nullable:()=>ua,nullish:()=>ck,number:()=>ne,object:()=>z,optional:()=>me,partialRecord:()=>rk,pipe:()=>la,prefault:()=>_g,preprocess:()=>ba,promise:()=>fk,readonly:()=>wg,record:()=>fe,refine:()=>Og,set:()=>ik,strictObject:()=>ek,string:()=>v,stringFormat:()=>Mx,stringbool:()=>yk,success:()=>uk,superRefine:()=>jg,symbol:()=>Hx,templateLiteral:()=>pk,transform:()=>rd,tuple:()=>ag,uint32:()=>Vx,uint64:()=>Kx,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 sa={};wn(sa,{endsWith:()=>fo,gt:()=>Rt,gte:()=>Me,includes:()=>lo,length:()=>Qr,lowercase:()=>co,lt:()=>Nt,lte:()=>Be,maxLength:()=>Yr,maxSize:()=>$r,mime:()=>mo,minLength:()=>tr,minSize:()=>At,multipleOf:()=>yr,negative:()=>fl,nonnegative:()=>hl,nonpositive:()=>ml,normalize:()=>ho,overwrite:()=>yt,positive:()=>pl,property:()=>gl,regex:()=>so,size:()=>Xr,slugify:()=>ra,startsWith:()=>po,toLowerCase:()=>vo,toUpperCase:()=>_o,trim:()=>go,uppercase:()=>uo});var br={};wn(br,{ZodISODate:()=>Tl,ZodISODateTime:()=>Il,ZodISODuration:()=>Dl,ZodISOTime:()=>Ol,date:()=>Pl,datetime:()=>El,duration:()=>Nl,time:()=>jl});var Il=f("ZodISODateTime",(e,t)=>{Lc.init(e,t),ce.init(e,t)});function El(e){return Fu(Il,e)}var Tl=f("ZodISODate",(e,t)=>{qc.init(e,t),ce.init(e,t)});function Pl(e){return Vu(Tl,e)}var Ol=f("ZodISOTime",(e,t)=>{Fc.init(e,t),ce.init(e,t)});function jl(e){return Ju(Ol,e)}var Dl=f("ZodISODuration",(e,t)=>{Vc.init(e,t),ce.init(e,t)});function Nl(e){return Wu(Dl,e)}var Nh=(e,t)=>{bi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ki(e,r)},flatten:{value:r=>xi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Kr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Kr,2)}},isEmpty:{get(){return e.issues.length===0}}})},RR=f("ZodError",Nh),Xe=f("ZodError",Nh,{Parent:Error});var Rh=Wn(Xe),Ah=Hn(Xe),Mh=Bn(Xe),Ch=Xn(Xe),Uh=Gf(Xe),Zh=Bf(Xe),Lh=Xf(Xe),qh=Yf(Xe),Fh=Qf(Xe),Vh=em(Xe),Jh=tm(Xe),Wh=rm(Xe);var q=f("ZodType",(e,t)=>(Z.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:yo(e,"input"),output:yo(e,"output")}}),e.toJSONSchema=Wm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone($.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Re(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Rh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Mh(e,r,n),e.parseAsync=async(r,n)=>Ah(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ch(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Uh(e,r,n),e.decode=(r,n)=>Zh(e,r,n),e.encodeAsync=async(r,n)=>Lh(e,r,n),e.decodeAsync=async(r,n)=>qh(e,r,n),e.safeEncode=(r,n)=>Fh(e,r,n),e.safeDecode=(r,n)=>Vh(e,r,n),e.safeEncodeAsync=async(r,n)=>Jh(e,r,n),e.safeDecodeAsync=async(r,n)=>Wh(e,r,n),e.refine=(r,n)=>e.check(Og(r,n)),e.superRefine=r=>e.check(jg(r)),e.overwrite=r=>e.check(yt(r)),e.optional=()=>me(e),e.exactOptional=()=>fg(e),e.nullable=()=>ua(e),e.nullish=()=>me(ua(e)),e.nonoptional=r=>yg(e,r),e.array=()=>G(e),e.or=r=>ie([e,r]),e.and=r=>So(e,r),e.transform=r=>la(e,rd(r)),e.default=r=>gg(e,r),e.prefault=r=>_g(e,r),e.catch=r=>xg(e,r),e.pipe=r=>la(e,r),e.readonly=()=>wg(e),e.describe=r=>{let n=e.clone();return Ae.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ae.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ae.get(e);let n=e.clone();return Ae.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Al=f("_ZodString",(e,t)=>{_r.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Km(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(so(...n)),e.includes=(...n)=>e.check(lo(...n)),e.startsWith=(...n)=>e.check(po(...n)),e.endsWith=(...n)=>e.check(fo(...n)),e.min=(...n)=>e.check(tr(...n)),e.max=(...n)=>e.check(Yr(...n)),e.length=(...n)=>e.check(Qr(...n)),e.nonempty=(...n)=>e.check(tr(1,...n)),e.lowercase=n=>e.check(co(n)),e.uppercase=n=>e.check(uo(n)),e.trim=()=>e.check(go()),e.normalize=(...n)=>e.check(ho(...n)),e.toLowerCase=()=>e.check(vo()),e.toUpperCase=()=>e.check(_o()),e.slugify=()=>e.check(ra())}),da=f("ZodString",(e,t)=>{_r.init(e,t),Al.init(e,t),e.email=r=>e.check(Ai(Ml,r)),e.url=r=>e.check(ao(pa,r)),e.jwt=r=>e.check(ta(Yl,r)),e.emoji=r=>e.check(Li(Cl,r)),e.guid=r=>e.check(io(ca,r)),e.uuid=r=>e.check(Mi(Mt,r)),e.uuidv4=r=>e.check(Ci(Mt,r)),e.uuidv6=r=>e.check(Ui(Mt,r)),e.uuidv7=r=>e.check(Zi(Mt,r)),e.nanoid=r=>e.check(qi(Ul,r)),e.guid=r=>e.check(io(ca,r)),e.cuid=r=>e.check(Fi(Zl,r)),e.cuid2=r=>e.check(Vi(Ll,r)),e.ulid=r=>e.check(Ji(ql,r)),e.base64=r=>e.check(Yi(Gl,r)),e.base64url=r=>e.check(Qi(Bl,r)),e.xid=r=>e.check(Wi(Fl,r)),e.ksuid=r=>e.check(Ki(Vl,r)),e.ipv4=r=>e.check(Hi(Jl,r)),e.ipv6=r=>e.check(Gi(Wl,r)),e.cidrv4=r=>e.check(Bi(Kl,r)),e.cidrv6=r=>e.check(Xi(Hl,r)),e.e164=r=>e.check(ea(Xl,r)),e.datetime=r=>e.check(El(r)),e.date=r=>e.check(Pl(r)),e.time=r=>e.check(jl(r)),e.duration=r=>e.check(Nl(r))});function v(e){return Lu(da,e)}var ce=f("ZodStringFormat",(e,t)=>{oe.init(e,t),Al.init(e,t)}),Ml=f("ZodEmail",(e,t)=>{jc.init(e,t),ce.init(e,t)});function fx(e){return Ai(Ml,e)}var ca=f("ZodGUID",(e,t)=>{Pc.init(e,t),ce.init(e,t)});function mx(e){return io(ca,e)}var Mt=f("ZodUUID",(e,t)=>{Oc.init(e,t),ce.init(e,t)});function hx(e){return Mi(Mt,e)}function gx(e){return Ci(Mt,e)}function vx(e){return Ui(Mt,e)}function _x(e){return Zi(Mt,e)}var pa=f("ZodURL",(e,t)=>{Dc.init(e,t),ce.init(e,t)});function yx(e){return ao(pa,e)}function $x(e){return ao(pa,{protocol:/^https?$/,hostname:rt.domain,...$.normalizeParams(e)})}var Cl=f("ZodEmoji",(e,t)=>{Nc.init(e,t),ce.init(e,t)});function bx(e){return Li(Cl,e)}var Ul=f("ZodNanoID",(e,t)=>{Rc.init(e,t),ce.init(e,t)});function xx(e){return qi(Ul,e)}var Zl=f("ZodCUID",(e,t)=>{Ac.init(e,t),ce.init(e,t)});function kx(e){return Fi(Zl,e)}var Ll=f("ZodCUID2",(e,t)=>{Mc.init(e,t),ce.init(e,t)});function Sx(e){return Vi(Ll,e)}var ql=f("ZodULID",(e,t)=>{Cc.init(e,t),ce.init(e,t)});function wx(e){return Ji(ql,e)}var Fl=f("ZodXID",(e,t)=>{Uc.init(e,t),ce.init(e,t)});function zx(e){return Wi(Fl,e)}var Vl=f("ZodKSUID",(e,t)=>{Zc.init(e,t),ce.init(e,t)});function Ix(e){return Ki(Vl,e)}var Jl=f("ZodIPv4",(e,t)=>{Jc.init(e,t),ce.init(e,t)});function Ex(e){return Hi(Jl,e)}var Kh=f("ZodMAC",(e,t)=>{Kc.init(e,t),ce.init(e,t)});function Tx(e){return qu(Kh,e)}var Wl=f("ZodIPv6",(e,t)=>{Wc.init(e,t),ce.init(e,t)});function Px(e){return Gi(Wl,e)}var Kl=f("ZodCIDRv4",(e,t)=>{Hc.init(e,t),ce.init(e,t)});function Ox(e){return Bi(Kl,e)}var Hl=f("ZodCIDRv6",(e,t)=>{Gc.init(e,t),ce.init(e,t)});function jx(e){return Xi(Hl,e)}var Gl=f("ZodBase64",(e,t)=>{Bc.init(e,t),ce.init(e,t)});function Dx(e){return Yi(Gl,e)}var Bl=f("ZodBase64URL",(e,t)=>{Xc.init(e,t),ce.init(e,t)});function Nx(e){return Qi(Bl,e)}var Xl=f("ZodE164",(e,t)=>{Yc.init(e,t),ce.init(e,t)});function Rx(e){return ea(Xl,e)}var Yl=f("ZodJWT",(e,t)=>{Qc.init(e,t),ce.init(e,t)});function Ax(e){return ta(Yl,e)}var xo=f("ZodCustomStringFormat",(e,t)=>{eu.init(e,t),ce.init(e,t)});function Mx(e,t,r={}){return en(xo,e,t,r)}function Cx(e){return en(xo,"hostname",rt.hostname,e)}function Ux(e){return en(xo,"hex",rt.hex,e)}function Zx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=rt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return en(xo,n,o,t)}var fa=f("ZodNumber",(e,t)=>{ji.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Hm(e,n,o,i),e.gt=(n,o)=>e.check(Rt(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Nt(n,o)),e.lte=(n,o)=>e.check(Be(n,o)),e.max=(n,o)=>e.check(Be(n,o)),e.int=n=>e.check(Rl(n)),e.safe=n=>e.check(Rl(n)),e.positive=n=>e.check(Rt(0,n)),e.nonnegative=n=>e.check(Me(0,n)),e.negative=n=>e.check(Nt(0,n)),e.nonpositive=n=>e.check(Be(0,n)),e.multipleOf=(n,o)=>e.check(yr(n,o)),e.step=(n,o)=>e.check(yr(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ne(e){return Ku(fa,e)}var rn=f("ZodNumberFormat",(e,t)=>{tu.init(e,t),fa.init(e,t)});function Rl(e){return Hu(rn,e)}function Lx(e){return Gu(rn,e)}function qx(e){return Bu(rn,e)}function Fx(e){return Xu(rn,e)}function Vx(e){return Yu(rn,e)}var ma=f("ZodBoolean",(e,t)=>{ro.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o)});function ye(e){return Qu(ma,e)}var ha=f("ZodBigInt",(e,t)=>{Di.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Bm(e,n,o,i),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.gt=(n,o)=>e.check(Rt(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Nt(n,o)),e.lte=(n,o)=>e.check(Be(n,o)),e.max=(n,o)=>e.check(Be(n,o)),e.positive=n=>e.check(Rt(BigInt(0),n)),e.negative=n=>e.check(Nt(BigInt(0),n)),e.nonpositive=n=>e.check(Be(BigInt(0),n)),e.nonnegative=n=>e.check(Me(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(yr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Jx(e){return el(ha,e)}var Ql=f("ZodBigIntFormat",(e,t)=>{ru.init(e,t),ha.init(e,t)});function Wx(e){return tl(Ql,e)}function Kx(e){return rl(Ql,e)}var Hh=f("ZodSymbol",(e,t)=>{nu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o)});function Hx(e){return nl(Hh,e)}var Gh=f("ZodUndefined",(e,t)=>{ou.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o)});function Gx(e){return ol(Gh,e)}var Bh=f("ZodNull",(e,t)=>{iu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o)});function ko(e){return il(Bh,e)}var Xh=f("ZodAny",(e,t)=>{au.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o)});function Bx(){return al(Xh)}var Yh=f("ZodUnknown",(e,t)=>{su.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nh(e,r,n,o)});function ue(){return sl(Yh)}var Qh=f("ZodNever",(e,t)=>{cu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o)});function ed(e){return cl(Qh,e)}var eg=f("ZodVoid",(e,t)=>{uu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o)});function Xx(e){return ul(eg,e)}var td=f("ZodDate",(e,t)=>{lu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>oh(e,n,o,i),e.min=(n,o)=>e.check(Me(n,o)),e.max=(n,o)=>e.check(Be(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Yx(e){return ll(td,e)}var tg=f("ZodArray",(e,t)=>{du.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(tr(r,n)),e.nonempty=r=>e.check(tr(1,r)),e.max=(r,n)=>e.check(Yr(r,n)),e.length=(r,n)=>e.check(Qr(r,n)),e.unwrap=()=>e.element});function G(e,t){return Jm(tg,e,t)}function Qx(e){let t=e._zod.def.shape;return Pe(Object.keys(t))}var ga=f("ZodObject",(e,t)=>{Fm.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o),$.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ue()}),e.loose=()=>e.clone({...e._zod.def,catchall:ue()}),e.strict=()=>e.clone({...e._zod.def,catchall:ed()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>$.extend(e,r),e.safeExtend=r=>$.safeExtend(e,r),e.merge=r=>$.merge(e,r),e.pick=r=>$.pick(e,r),e.omit=r=>$.omit(e,r),e.partial=(...r)=>$.partial(nd,e,r[0]),e.required=(...r)=>$.required(od,e,r[0])});function z(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new ga(r)}function ek(e,t){return new ga({type:"object",shape:e,catchall:ed(),...$.normalizeParams(t)})}function Te(e,t){return new ga({type:"object",shape:e,catchall:ue(),...$.normalizeParams(t)})}var va=f("ZodUnion",(e,t)=>{no.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sl(e,r,n,o),e.options=t.options});function ie(e,t){return new va({type:"union",options:e,...$.normalizeParams(t)})}var rg=f("ZodXor",(e,t)=>{va.init(e,t),pu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sl(e,r,n,o),e.options=t.options});function tk(e,t){return new rg({type:"union",options:e,inclusive:!1,...$.normalizeParams(t)})}var ng=f("ZodDiscriminatedUnion",(e,t)=>{va.init(e,t),fu.init(e,t)});function _a(e,t,r){return new ng({type:"union",options:t,discriminator:e,...$.normalizeParams(r)})}var og=f("ZodIntersection",(e,t)=>{mu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o)});function So(e,t){return new og({type:"intersection",left:e,right:t})}var ig=f("ZodTuple",(e,t)=>{Ni.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function ag(e,t,r){let n=t instanceof Z,o=n?r:t,i=n?t:null;return new ig({type:"tuple",items:e,rest:i,...$.normalizeParams(o)})}var ya=f("ZodRecord",(e,t)=>{hu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function fe(e,t,r){return new ya({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}function rk(e,t,r){let n=Re(e);return n._zod.values=void 0,new ya({type:"record",keyType:n,valueType:t,...$.normalizeParams(r)})}function nk(e,t,r){return new ya({type:"record",keyType:e,valueType:t,mode:"loose",...$.normalizeParams(r)})}var sg=f("ZodMap",(e,t)=>{gu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check($r(...r)),e.size=(...r)=>e.check(Xr(...r))});function ok(e,t,r){return new sg({type:"map",keyType:e,valueType:t,...$.normalizeParams(r)})}var cg=f("ZodSet",(e,t)=>{vu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o),e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check($r(...r)),e.size=(...r)=>e.check(Xr(...r))});function ik(e,t){return new cg({type:"set",valueType:e,...$.normalizeParams(t)})}var bo=f("ZodEnum",(e,t)=>{_u.init(e,t),q.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ih(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new bo({...t,checks:[],...$.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.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 bo({...t,checks:[],...$.normalizeParams(o),entries:i})}});function Pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bo({type:"enum",entries:r,...$.normalizeParams(t)})}function ak(e,t){return new bo({type:"enum",entries:e,...$.normalizeParams(t)})}var ug=f("ZodLiteral",(e,t)=>{yu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function P(e,t){return new ug({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(t)})}var lg=f("ZodFile",(e,t)=>{$u.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o),e.min=(r,n)=>e.check(At(r,n)),e.max=(r,n)=>e.check($r(r,n)),e.mime=(r,n)=>e.check(mo(Array.isArray(r)?r:[r],n))});function sk(e){return vl(lg,e)}var dg=f("ZodTransform",(e,t)=>{bu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fh(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new hr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push($.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function rd(e){return new dg({type:"transform",transform:e})}var nd=f("ZodOptional",(e,t)=>{Ri.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function me(e){return new nd({type:"optional",innerType:e})}var pg=f("ZodExactOptional",(e,t)=>{xu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fg(e){return new pg({type:"optional",innerType:e})}var mg=f("ZodNullable",(e,t)=>{ku.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ua(e){return new mg({type:"nullable",innerType:e})}function ck(e){return me(ua(e))}var hg=f("ZodDefault",(e,t)=>{Su.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gg(e,t){return new hg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var vg=f("ZodPrefault",(e,t)=>{wu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _g(e,t){return new vg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var od=f("ZodNonOptional",(e,t)=>{zu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yg(e,t){return new od({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var $g=f("ZodSuccess",(e,t)=>{Iu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function uk(e){return new $g({type:"success",innerType:e})}var bg=f("ZodCatch",(e,t)=>{Eu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xg(e,t){return new bg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var kg=f("ZodNaN",(e,t)=>{Tu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o)});function lk(e){return dl(kg,e)}var id=f("ZodPipe",(e,t)=>{Pu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zh(e,r,n,o),e.in=t.in,e.out=t.out});function la(e,t){return new id({type:"pipe",in:e,out:t})}var ad=f("ZodCodec",(e,t)=>{id.init(e,t),oo.init(e,t)});function dk(e,t,r){return new ad({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Sg=f("ZodReadonly",(e,t)=>{Ou.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function wg(e){return new Sg({type:"readonly",innerType:e})}var zg=f("ZodTemplateLiteral",(e,t)=>{ju.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o)});function pk(e,t){return new zg({type:"template_literal",parts:e,...$.normalizeParams(t)})}var Ig=f("ZodLazy",(e,t)=>{Ru.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Eg(e){return new Ig({type:"lazy",getter:e})}var Tg=f("ZodPromise",(e,t)=>{Nu.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fk(e){return new Tg({type:"promise",innerType:e})}var Pg=f("ZodFunction",(e,t)=>{Du.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o)});function mk(e){return new Pg({type:"function",input:Array.isArray(e?.input)?ag(e?.input):e?.input??G(ue()),output:e?.output??ue()})}var $a=f("ZodCustom",(e,t)=>{Au.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o)});function hk(e){let t=new se({check:"custom"});return t._zod.check=e,t}function sd(e,t){return _l($a,e??(()=>!0),t)}function Og(e,t={}){return yl($a,e,t)}function jg(e){return $l(e)}var gk=bl,vk=xl;function _k(e,t={}){let r=new $a({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...$.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var yk=(...e)=>kl({Codec:ad,Boolean:ma,String:da},...e);function $k(e){let t=Eg(()=>ie([v(e),ne(),ye(),ko(),G(t),fe(v(),t)]));return t}function ba(e,t){return la(rd(e),t)}var Dg;Dg||(Dg={});var FR={...$o,...sa,iso:br};be(Mu());var ud="2025-11-25";var Ng=[ud,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nr="io.modelcontextprotocol/related-task",ka="2.0",xe=sd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Rg=ie([v(),ne().int()]),Ag=v(),c1=Te({ttl:ie([ne(),ko()]).optional(),pollInterval:ne().optional()}),Sk=z({ttl:ne().optional()}),wk=z({taskId:v()}),ld=Te({progressToken:Rg.optional(),[nr]:wk.optional()}),Ye=z({_meta:ld.optional()}),wo=Ye.extend({task:Sk.optional()}),Mg=e=>wo.safeParse(e).success,ke=z({method:v(),params:Ye.loose().optional()}),nt=z({_meta:ld.optional()}),ot=z({method:v(),params:nt.loose().optional()}),Se=Te({_meta:ld.optional()}),Sa=ie([v(),ne().int()]),Cg=z({jsonrpc:P(ka),id:Sa,...ke.shape}).strict(),dd=e=>Cg.safeParse(e).success,Ug=z({jsonrpc:P(ka),...ot.shape}).strict(),Zg=e=>Ug.safeParse(e).success,pd=z({jsonrpc:P(ka),id:Sa,result:Se}).strict(),zo=e=>pd.safeParse(e).success;var Y;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Y||(Y={}));var fd=z({jsonrpc:P(ka),id:Sa.optional(),error:z({code:ne().int(),message:v(),data:ue().optional()})}).strict();var Lg=e=>fd.safeParse(e).success;var qg=ie([Cg,Ug,pd,fd]),u1=ie([pd,fd]),wa=Se.strict(),zk=nt.extend({requestId:Sa.optional(),reason:v().optional()}),za=ot.extend({method:P("notifications/cancelled"),params:zk}),Ik=z({src:v(),mimeType:v().optional(),sizes:G(v()).optional(),theme:Pe(["light","dark"]).optional()}),Io=z({icons:G(Ik).optional()}),nn=z({name:v(),title:v().optional()}),Fg=nn.extend({...nn.shape,...Io.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Ek=So(z({applyDefaults:ye().optional()}),fe(v(),ue())),Tk=ba(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,So(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:ye().optional()}).optional(),tasks:Pk.optional()}),Dk=Ye.extend({protocolVersion:v(),capabilities:jk,clientInfo:Fg}),md=ke.extend({method:P("initialize"),params:Dk});var Nk=z({experimental:fe(v(),xe).optional(),logging:xe.optional(),completions:xe.optional(),prompts:z({listChanged:ye().optional()}).optional(),resources:z({subscribe:ye().optional(),listChanged:ye().optional()}).optional(),tools:z({listChanged:ye().optional()}).optional(),tasks:Ok.optional()}),Rk=Se.extend({protocolVersion:v(),capabilities:Nk,serverInfo:Fg,instructions:v().optional()}),hd=ot.extend({method:P("notifications/initialized"),params:nt.optional()});var Ia=ke.extend({method:P("ping"),params:Ye.optional()}),Ak=z({progress:ne(),total:me(ne()),message:me(v())}),Mk=z({...nt.shape,...Ak.shape,progressToken:Rg}),Ea=ot.extend({method:P("notifications/progress"),params:Mk}),Ck=Ye.extend({cursor:Ag.optional()}),Eo=ke.extend({params:Ck.optional()}),To=Se.extend({nextCursor:Ag.optional()}),Uk=Pe(["working","input_required","completed","failed","cancelled"]),Po=z({taskId:v(),status:Uk,ttl:ie([ne(),ko()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:me(ne()),statusMessage:me(v())}),on=Se.extend({task:Po}),Zk=nt.merge(Po),Oo=ot.extend({method:P("notifications/tasks/status"),params:Zk}),Ta=ke.extend({method:P("tasks/get"),params:Ye.extend({taskId:v()})}),Pa=Se.merge(Po),Oa=ke.extend({method:P("tasks/result"),params:Ye.extend({taskId:v()})}),l1=Se.loose(),ja=Eo.extend({method:P("tasks/list")}),Da=To.extend({tasks:G(Po)}),Na=ke.extend({method:P("tasks/cancel"),params:Ye.extend({taskId:v()})}),Vg=Se.merge(Po),Jg=z({uri:v(),mimeType:me(v()),_meta:fe(v(),ue()).optional()}),Wg=Jg.extend({text:v()}),gd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Kg=Jg.extend({blob:gd}),jo=Pe(["user","assistant"]),an=z({audience:G(jo).optional(),priority:ne().min(0).max(1).optional(),lastModified:br.datetime({offset:!0}).optional()}),Hg=z({...nn.shape,...Io.shape,uri:v(),description:me(v()),mimeType:me(v()),annotations:an.optional(),_meta:me(Te({}))}),Lk=z({...nn.shape,...Io.shape,uriTemplate:v(),description:me(v()),mimeType:me(v()),annotations:an.optional(),_meta:me(Te({}))}),qk=Eo.extend({method:P("resources/list")}),Fk=To.extend({resources:G(Hg)}),Vk=Eo.extend({method:P("resources/templates/list")}),Jk=To.extend({resourceTemplates:G(Lk)}),vd=Ye.extend({uri:v()}),Wk=vd,Kk=ke.extend({method:P("resources/read"),params:Wk}),Hk=Se.extend({contents:G(ie([Wg,Kg]))}),Gk=ot.extend({method:P("notifications/resources/list_changed"),params:nt.optional()}),Bk=vd,Xk=ke.extend({method:P("resources/subscribe"),params:Bk}),Yk=vd,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(ye())}),nS=z({...nn.shape,...Io.shape,description:me(v()),arguments:me(G(rS)),_meta:me(Te({}))}),oS=Eo.extend({method:P("prompts/list")}),iS=To.extend({prompts:G(nS)}),aS=Ye.extend({name:v(),arguments:fe(v(),v()).optional()}),sS=ke.extend({method:P("prompts/get"),params:aS}),_d=z({type:P("text"),text:v(),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),yd=z({type:P("image"),data:gd,mimeType:v(),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),$d=z({type:P("audio"),data:gd,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([Wg,Kg]),annotations:an.optional(),_meta:fe(v(),ue()).optional()}),lS=Hg.extend({type:P("resource_link")}),bd=ie([_d,yd,$d,lS,uS]),dS=z({role:jo,content:bd}),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:ye().optional(),destructiveHint:ye().optional(),idempotentHint:ye().optional(),openWorldHint:ye().optional()}),hS=z({taskSupport:Pe(["required","optional","forbidden"]).optional()}),Gg=z({...nn.shape,...Io.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()}),xd=Eo.extend({method:P("tools/list")}),gS=To.extend({tools:G(Gg)}),Ra=Se.extend({content:G(bd).default([]),structuredContent:fe(v(),ue()).optional(),isError:ye().optional()}),d1=Ra.or(Se.extend({toolResult:ue()})),vS=wo.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()}),p1=z({autoRefresh:ye().default(!0),debounceMs:ne().int().nonnegative().default(300)}),No=Pe(["debug","info","notice","warning","error","critical","alert","emergency"]),yS=Ye.extend({level:No}),kd=ke.extend({method:P("logging/setLevel"),params:yS}),$S=nt.extend({level:No,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(bd).default([]),structuredContent:z({}).loose().optional(),isError:ye().optional(),_meta:fe(v(),ue()).optional()}),zS=_a("type",[_d,yd,$d]),xa=_a("type",[_d,yd,$d,cS,wS]),IS=z({role:jo,content:ie([xa,G(xa)]),_meta:fe(v(),ue()).optional()}),ES=wo.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(Gg).optional(),toolChoice:SS.optional()}),TS=ke.extend({method:P("sampling/createMessage"),params:ES}),Sd=Se.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens"]).or(v())),role:jo,content:zS}),wd=Se.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:jo,content:ie([xa,G(xa)])}),PS=z({type:P("boolean"),title:v().optional(),description:v().optional(),default:ye().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()}),DS=z({type:P("string"),title:v().optional(),description:v().optional(),enum:G(v()),default:v().optional()}),NS=z({type:P("string"),title:v().optional(),description:v().optional(),oneOf:G(z({const:v(),title:v()})),default:v().optional()}),RS=z({type:P("string"),title:v().optional(),description:v().optional(),enum:G(v()),enumNames:G(v()).optional(),default:v().optional()}),AS=ie([DS,NS]),MS=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([MS,CS]),ZS=ie([RS,AS,US]),LS=ie([ZS,PS,OS,jS]),qS=wo.extend({mode:P("form").optional(),message:v(),requestedSchema:z({type:P("object"),properties:fe(v(),LS),required:G(v()).optional()})}),FS=wo.extend({mode:P("url"),message:v(),elicitationId:v(),url:v().url()}),VS=ie([qS,FS]),JS=ke.extend({method:P("elicitation/create"),params:VS}),WS=nt.extend({elicitationId:v()}),KS=ot.extend({method:P("notifications/elicitation/complete"),params:WS}),Aa=Se.extend({action:Pe(["accept","decline","cancel"]),content:ba(e=>e===null?void 0:e,fe(v(),ie([v(),ne(),ye(),G(v())])).optional())}),HS=z({type:P("ref/resource"),uri:v()});var GS=z({type:P("ref/prompt"),name:v()}),BS=Ye.extend({ref:ie([GS,HS]),argument:z({name:v(),value:v()}),context:z({arguments:fe(v(),v()).optional()}).optional()}),XS=ke.extend({method:P("completion/complete"),params:BS});var YS=Se.extend({completion:Te({values:G(v()).max(100),total:me(ne().int()),hasMore:me(ye())})}),QS=z({uri:v().startsWith("file://"),name:v().optional(),_meta:fe(v(),ue()).optional()}),ew=ke.extend({method:P("roots/list"),params:Ye.optional()}),zd=Se.extend({roots:G(QS)}),tw=ot.extend({method:P("notifications/roots/list_changed"),params:nt.optional()}),f1=ie([Ia,md,XS,kd,sS,oS,qk,Vk,Kk,Xk,Qk,Do,xd,Ta,Oa,ja,Na]),m1=ie([za,Ea,hd,tw,Oo]),h1=ie([wa,Sd,wd,Aa,zd,Pa,Da,on]),g1=ie([Ia,TS,JS,ew,Ta,Oa,ja,Na]),v1=ie([za,Ea,bS,tS,Gk,_S,fS,Oo,KS]),_1=ie([wa,Rk,YS,pS,iS,Fk,Jk,Hk,Ra,gS,Pa,Da,on]),J=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===Y.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new cd(o.elicitations,r)}return new e(t,r,n)}},cd=class extends J{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(Y.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function or(e){return e==="completed"||e==="failed"||e==="cancelled"}var Y1=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Id(e){let r=aa(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Dh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ed(e,t){let r=rr(e,t);if(!r.success)throw r.error;return r.data}var sw=6e4,Ma=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(za,r=>{this._oncancel(r)}),this.setNotificationHandler(Ea,r=>{this._onprogress(r)}),this.setRequestHandler(Ia,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ta,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new J(Y.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Oa,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,m=new J(d.error.code,d.error.message,d.error.data);l(m)}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 J(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(ja,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 J(Y.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Na,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new J(Y.InvalidParams,`Task not found: ${r.params.taskId}`);if(or(o.status))throw new J(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 J(Y.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof J?o:new J(Y.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),J.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(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;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),zo(i)||Lg(i)?this._onresponse(i):dd(i)?this._onrequest(i,a):Zg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=J.fromError(Y.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[nr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.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(t.id,a);let s=Mg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,m)=>{let p={...m,relatedRequestId:t.id};i&&!p.relatedTask&&(p.relatedTask={taskId:i});let g=p.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,p)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.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:t.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.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.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(t)}`));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(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),zo(t))n(t);else{let a=new J(t.error.code,t.error.message,t.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(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(zo(t)&&t.result&&typeof t.result=="object"){let a=t.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),zo(t))o(t);else{let a=J.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof J?a:new J(Y.InternalError,String(a))}}return}let i;try{let a=await this.request(t,on,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new J(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 J(Y.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new J(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 J?a:new J(Y.InternalError,String(a))}}}request(t,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(t.method),s&&this.assertTaskCapability(t.method)}catch(E){d(E);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[nr]:c}});let g=E=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(E)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let I=E instanceof J?E:new J(Y.RequestTimeout,String(E));l(I)};this._responseHandlers.set(m,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(J.fromError(Y.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(m,h,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let E=I=>{let A=this._responseHandlers.get(m);A?A(I):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,E),this._enqueueTaskMessage(b,{type:"request",message:p,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(m),l(I)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(E=>{this._cleanupTimeout(m),l(E)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Pa,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Da,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Vg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[nr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,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={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[nr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Id(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Ed(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Id(t);this._notificationHandlers.set(n,o=>{let i=Ed(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,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(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&dd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new J(Y.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new J(Y.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new J(Y.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new J(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=Oo.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 J(Y.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(or(s.status))throw new J(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=Oo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),or(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Bg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Xg(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];Bg(a)&&Bg(i)?r[o]={...a,...i}:r[o]=i}return r}var My=mi(mf(),1),Cy=mi(Ay(),1);function XT(){let e=new My.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Cy.default)(e),e}var $s=class{constructor(t){this._ajv=t??XT()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var bs=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function Uy(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Zy(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var xs=class extends Ma{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(No.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._oninitialize(n)),this.setNotificationHandler(hd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(kd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=No.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new bs(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Xg(this._capabilities,t)}setRequestHandler(t,r){let o=aa(t)?.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 J(Y.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,m=await Promise.resolve(r(c,u));if(d.task){let g=rr(on,m);if(!g.success){let h=g.error instanceof Error?g.error.message:String(g.error);throw new J(Y.InvalidParams,`Invalid task creation result: ${h}`)}return g.data}let p=rr(Ra,m);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new J(Y.InvalidParams,`Invalid tools/call result: ${g}`)}return p.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){Zy(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&Uy(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Ng.includes(r)?r:ud,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"},wa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.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 t.tools?this.request({method:"sampling/createMessage",params:t},wd,r):this.request({method:"sampling/createMessage",params:t},Sd,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Aa,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},Aa,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new J(Y.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof J?a:new J(Y.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},zd,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var xf=mi(require("node:process"),1);var ks=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(` `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),YT(r)}clear(){this._buffer=void 0}};function YT(e){return qg.parse(JSON.parse(e))}function Ly(e){return JSON.stringify(e)+` `}var Ss=class{constructor(t=xf.default.stdin,r=xf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new ks,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 t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=Ly(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var zf=mi(require("path"),1);var kf={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 qy(e){return process.platform==="win32"?Math.round(e*kf.WINDOWS_MULTIPLIER):e}var zt=require("fs"),ws=require("path"),Fy=require("os"),jr=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_CLAUDE_AUTH_METHOD:"cli",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"xiaomi/mimo-v2-flash:free",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_OPENROUTER_MAX_CONTEXT_MESSAGES:"20",CLAUDE_MEM_OPENROUTER_MAX_TOKENS:"100000",CLAUDE_MEM_DATA_DIR:(0,ws.join)((0,Fy.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"false",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_FULL_COUNT:"0",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false",CLAUDE_MEM_CONTEXT_SHOW_TERMINAL_OUTPUT:"true",CLAUDE_MEM_FOLDER_CLAUDEMD_ENABLED:"false",CLAUDE_MEM_MAX_CONCURRENT_AGENTS:"2",CLAUDE_MEM_EXCLUDED_PROJECTS:"",CLAUDE_MEM_FOLDER_MD_EXCLUDE:"[]",CLAUDE_MEM_CHROMA_ENABLED:"true",CLAUDE_MEM_CHROMA_MODE:"local",CLAUDE_MEM_CHROMA_HOST:"127.0.0.1",CLAUDE_MEM_CHROMA_PORT:"8000",CLAUDE_MEM_CHROMA_SSL:"false",CLAUDE_MEM_CHROMA_API_KEY:"",CLAUDE_MEM_CHROMA_TENANT:"default_tenant",CLAUDE_MEM_CHROMA_DATABASE:"default_database"};static getAllDefaults(){return{...this.DEFAULTS}}static get(t){return process.env[t]??this.DEFAULTS[t]}static getInt(t){let r=this.get(t);return parseInt(r,10)}static getBool(t){let r=this.get(t);return r==="true"||r===!0}static applyEnvOverrides(t){let r={...t};for(let n of Object.keys(this.DEFAULTS))process.env[n]!==void 0&&(r[n]=process.env[n]);return r}static loadFromFile(t){try{if(!(0,zt.existsSync)(t)){let a=this.getAllDefaults();try{let s=(0,ws.dirname)(t);(0,zt.existsSync)(s)||(0,zt.mkdirSync)(s,{recursive:!0}),(0,zt.writeFileSync)(t,JSON.stringify(a,null,2),"utf-8"),console.log("[SETTINGS] Created settings file with defaults:",t)}catch(s){console.warn("[SETTINGS] Failed to create settings file, using in-memory defaults:",t,s)}return this.applyEnvOverrides(a)}let r=(0,zt.readFileSync)(t,"utf-8"),n=JSON.parse(r),o=n;if(n.env&&typeof n.env=="object"){o=n.env;try{(0,zt.writeFileSync)(t,JSON.stringify(o,null,2),"utf-8"),console.log("[SETTINGS] Migrated settings file from nested to flat schema:",t)}catch(a){console.warn("[SETTINGS] Failed to auto-migrate settings file:",t,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:",t,r),this.applyEnvOverrides(this.getAllDefaults())}}};var $e=require("path"),Sf=require("os"),wf=require("fs");var Vy=require("url");var rP={};function QT(){return typeof __dirname<"u"?__dirname:(0,$e.dirname)((0,Vy.fileURLToPath)(rP.url))}var jU=QT();function eP(){if(process.env.CLAUDE_MEM_DATA_DIR)return process.env.CLAUDE_MEM_DATA_DIR;let e=(0,$e.join)((0,Sf.homedir)(),".claude-mem"),t=(0,$e.join)(e,"settings.json");try{if((0,wf.existsSync)(t)){let{readFileSync:r}=require("fs"),n=JSON.parse(r(t,"utf-8")),o=n.env??n;if(o.CLAUDE_MEM_DATA_DIR)return o.CLAUDE_MEM_DATA_DIR}}catch{}return e}var Vt=eP(),zs=process.env.CLAUDE_CONFIG_DIR||(0,$e.join)((0,Sf.homedir)(),".claude"),tP=(0,$e.join)(zs,"plugins","marketplaces","thedotmack"),DU=(0,$e.join)(Vt,"archives"),NU=(0,$e.join)(Vt,"logs"),RU=(0,$e.join)(Vt,"trash"),AU=(0,$e.join)(Vt,"backups"),MU=(0,$e.join)(Vt,"modes"),CU=(0,$e.join)(Vt,"settings.json"),UU=(0,$e.join)(Vt,"claude-mem.db"),ZU=(0,$e.join)(Vt,"vector-db"),LU=(0,$e.join)(Vt,"observer-sessions"),qU=(0,$e.join)(zs,"settings.json"),FU=(0,$e.join)(zs,"commands"),VU=(0,$e.join)(zs,"CLAUDE.md");var nP=(()=>{let e=process.env.CLAUDE_MEM_HEALTH_TIMEOUT_MS;if(e){let t=parseInt(e,10);if(Number.isFinite(t)&&t>=500&&t<=3e5)return t;ve.warn("SYSTEM","Invalid CLAUDE_MEM_HEALTH_TIMEOUT_MS, using default",{value:e,min:500,max:3e5})}return qy(kf.HEALTH_CHECK)})();function oP(e,t={},r){return new Promise((n,o)=>{let i=setTimeout(()=>o(new Error(`Request timed out after ${r}ms`)),r);fetch(e,t).then(a=>{clearTimeout(i),n(a)},a=>{clearTimeout(i),o(a)})})}var Is=null,Es=null;function iP(){if(Is!==null)return Is;let e=zf.default.join(jr.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),t=jr.loadFromFile(e);return Is=parseInt(t.CLAUDE_MEM_WORKER_PORT,10),Is}function aP(){if(Es!==null)return Es;let e=zf.default.join(jr.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return Es=jr.loadFromFile(e).CLAUDE_MEM_WORKER_HOST,Es}function sP(e){return`http://${aP()}:${iP()}${e}`}function Ts(e,t={}){let r=t.method??"GET",n=t.timeoutMs??nP,o=sP(e),i={method:r};return t.headers&&(i.headers=t.headers),t.body&&(i.body=t.body),n>0?oP(o,i,n):fetch(o,i)}var Sn=require("node:fs/promises"),pi=require("node:path");var Wy=require("node:child_process"),It=require("node:fs"),Jt=require("node:path"),Pf=require("node:os"),Tf=require("node:module"),$P={},Ky=typeof __filename<"u"?(0,Tf.createRequire)(__filename):(0,Tf.createRequire)($P.url),cP={".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 Hy(e){let t=e.slice(e.lastIndexOf("."));return cP[t]||"unknown"}var uP={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 Gy(e){let t=uP[e];if(!t)return null;try{let r=Ky.resolve(t+"/package.json");return(0,Jt.dirname)(r)}catch{return null}}var lP={jsts:` (function_declaration name: (identifier) @name) @func (lexical_declaration (variable_declarator name: (identifier) @name value: [(arrow_function) (function_expression)])) @const_func (class_declaration name: (type_identifier) @name) @cls (method_definition name: (property_identifier) @name) @method (interface_declaration name: (type_identifier) @name) @iface (type_alias_declaration name: (type_identifier) @name) @tdef (enum_declaration name: (identifier) @name) @enm (import_statement) @imp (export_statement) @exp `,python:` (function_definition name: (identifier) @name) @func (class_definition name: (identifier) @name) @cls (import_statement) @imp (import_from_statement) @imp `,go:` (function_declaration name: (identifier) @name) @func (method_declaration name: (field_identifier) @name) @method (type_declaration (type_spec name: (type_identifier) @name)) @tdef (import_declaration) @imp `,rust:` (function_item name: (identifier) @name) @func (struct_item name: (type_identifier) @name) @struct_def (enum_item name: (type_identifier) @name) @enm (trait_item name: (type_identifier) @name) @trait_def (impl_item type: (type_identifier) @name) @impl_def (use_declaration) @imp `,ruby:` (method name: (identifier) @name) @func (class name: (constant) @name) @cls (module name: (constant) @name) @cls (call method: (identifier) @name) @imp `,java:` (method_declaration name: (identifier) @name) @method (class_declaration name: (identifier) @name) @cls (interface_declaration name: (identifier) @name) @iface (enum_declaration name: (identifier) @name) @enm (import_declaration) @imp `,generic:` (function_declaration name: (identifier) @name) @func (function_definition name: (identifier) @name) @func (class_declaration name: (identifier) @name) @cls (class_definition name: (identifier) @name) @cls (import_statement) @imp (import_declaration) @imp `};function By(e){switch(e){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 If=null,Ef=new Map;function Xy(e){if(Ef.has(e))return Ef.get(e);If||(If=(0,It.mkdtempSync)((0,Jt.join)((0,Pf.tmpdir)(),"smart-read-queries-")));let t=(0,Jt.join)(If,`${e}.scm`);return(0,It.writeFileSync)(t,lP[e]),Ef.set(e,t),t}var di=null;function dP(){if(di)return di;try{let e=Ky.resolve("tree-sitter-cli/package.json"),t=(0,Jt.join)((0,Jt.dirname)(e),"tree-sitter");if((0,It.existsSync)(t))return di=t,t}catch{}return di="tree-sitter",di}function pP(e,t,r){return Yy(e,[t],r).get(t)||[]}function Yy(e,t,r){if(t.length===0)return new Map;let n=dP(),o=["query","-p",r,e,...t],i;try{i=(0,Wy.execFileSync)(n,o,{encoding:"utf-8",timeout:3e4,stdio:["pipe","pipe","pipe"]})}catch{return new Map}return fP(i)}function fP(e){let t=new Map,r=null,n=null;for(let o of e.split(` `)){if(o.length>0&&!o.startsWith(" ")&&!o.startsWith(" ")){r=o.trim(),t.has(r)||t.set(r,[]),n=null;continue}if(!r)continue;let i=o.match(/^\s+pattern:\s+(\d+)/);if(i){n={pattern:parseInt(i[1]),captures:[]},t.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 t}var Jy={func:"function",const_func:"function",cls:"class",method:"method",iface:"interface",tdef:"type",enm:"enum",struct_def:"struct",trait_def:"trait",impl_def:"impl"},mP=new Set(["class","struct","impl","trait"]);function hP(e,t,r,n=200){let i=e[t]||"";if(!i.trimEnd().endsWith("{")&&!i.trimEnd().endsWith(":")){let a=e.slice(t,Math.min(t+10,r+1)).join(` `),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 gP(e,t){let r=[],n=!1;for(let o=t-1;o>=0;o--){let i=e[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(e[o]),n=!0;else break}return r.length>0?r.join(` `).trim():void 0}function vP(e,t,r){for(let n=t+1;n<=Math.min(t+3,r);n++){let o=e[n]?.trim();if(o){if(o.startsWith('"""')||o.startsWith("'''"))return o;break}}}function _P(e,t,r,n,o,i){switch(i){case"javascript":case"typescript":case"tsx":return n.some(a=>t>=a.startRow&&r<=a.endRow);case"python":return!e.startsWith("_");case"go":return e.length>0&&e[0]===e[0].toUpperCase()&&e[0]!==e[0].toLowerCase();case"rust":return o[t]?.trimStart().startsWith("pub")??!1;default:return!0}}function Qy(e,t,r){let n=[],o=[],i=[],a=[];for(let c of e)for(let u of c.captures)u.tag==="exp"&&i.push({startRow:u.startRow,endRow:u.endRow}),u.tag==="imp"&&o.push(u.text||t[u.startRow]?.trim()||"");for(let c of e){let u=c.captures.find(E=>Jy[E.tag]),l=c.captures.find(E=>E.tag==="name");if(!u)continue;let d=l?.text||"anonymous",m=u.startRow,p=u.endRow,g=Jy[u.tag],h=gP(t,m),_=r==="python"?vP(t,m,p):void 0,b={name:d,kind:g,signature:hP(t,m,p),jsdoc:h||_,lineStart:m,lineEnd:p,exported:_P(d,m,p,i,t,r)};mP.has(g)&&(b.children=[],a.push({sym:b,startRow:m,endRow:p})),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 Ps(e,t){let r=Hy(t),n=e.split(` `),o=Gy(r);if(!o)return{filePath:t,language:r,symbols:[],imports:[],totalLines:n.length,foldedTokenEstimate:50};let i=By(r),a=Xy(i),s=t.slice(t.lastIndexOf("."))||".txt",c=(0,It.mkdtempSync)((0,Jt.join)((0,Pf.tmpdir)(),"smart-src-")),u=(0,Jt.join)(c,`source${s}`);(0,It.writeFileSync)(u,e);try{let l=pP(a,u,o),d=Qy(l,n,r),m=kn({filePath:t,language:r,symbols:d.symbols,imports:d.imports,totalLines:n.length,foldedTokenEstimate:0});return{filePath:t,language:r,symbols:d.symbols,imports:d.imports,totalLines:n.length,foldedTokenEstimate:Math.ceil(m.length/4)}}finally{(0,It.rmSync)(c,{recursive:!0,force:!0})}}function e$(e){let t=new Map,r=new Map;for(let n of e){let o=Hy(n.relativePath);r.has(o)||r.set(o,[]),r.get(o).push(n)}for(let[n,o]of r){let i=Gy(n);if(!i){for(let l of o){let d=l.content.split(` `);t.set(l.relativePath,{filePath:l.relativePath,language:n,symbols:[],imports:[],totalLines:d.length,foldedTokenEstimate:50})}continue}let a=By(n),s=Xy(a),c=o.map(l=>l.absolutePath),u=Yy(s,c,i);for(let l of o){let d=l.content.split(` `),m=u.get(l.absolutePath)||[],p=Qy(m,d,n),g=kn({filePath:l.relativePath,language:n,symbols:p.symbols,imports:p.imports,totalLines:d.length,foldedTokenEstimate:0});t.set(l.relativePath,{filePath:l.relativePath,language:n,symbols:p.symbols,imports:p.imports,totalLines:d.length,foldedTokenEstimate:Math.ceil(g.length/4)})}}return t}function kn(e){let t=[];if(t.push(`\u{1F4C1} ${e.filePath} (${e.language}, ${e.totalLines} lines)`),t.push(""),e.imports.length>0){t.push(` \u{1F4E6} Imports: ${e.imports.length} statements`);for(let r of e.imports.slice(0,10))t.push(` ${r}`);e.imports.length>10&&t.push(` ... +${e.imports.length-10} more`),t.push("")}for(let r of e.symbols)t.push(t$(r," "));return t.join(` `)}function t$(e,t){let r=[],n=yP(e.kind),o=e.exported?" [exported]":"",i=e.lineStart===e.lineEnd?`L${e.lineStart+1}`:`L${e.lineStart+1}-${e.lineEnd+1}`;if(r.push(`${t}${n} ${e.name}${o} (${i})`),r.push(`${t} ${e.signature}`),e.jsdoc){let s=e.jsdoc.split(` `).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(`${t} \u{1F4AC} ${c}`)}}if(e.children&&e.children.length>0)for(let a of e.children)r.push(t$(a,t+" "));return r.join(` `)}function yP(e){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"}[e]||"\xB7"}function r$(e,t,r){let n=Ps(e,t),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=e.split(` `),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(` `);return`// \u{1F4CD} ${t} L${s+1}-${i.lineEnd+1} ${c}`}var bP=new Set([".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".go",".rs",".rb",".java",".cs",".cpp",".c",".h",".hpp",".swift",".kt",".php",".vue",".svelte"]),xP=new Set(["node_modules",".git","dist","build",".next","__pycache__",".venv","venv","env",".env","target","vendor",".cache",".turbo","coverage",".nyc_output",".claude",".smart-file-read"]),kP=512*1024;async function*n$(e,t,r=20){if(r<=0)return;let n;try{n=await(0,Sn.readdir)(e,{withFileTypes:!0})}catch{return}for(let o of n){if(o.name.startsWith(".")&&o.name!=="."||xP.has(o.name))continue;let i=(0,pi.join)(e,o.name);if(o.isDirectory())yield*n$(i,t,r-1);else if(o.isFile()){let a=o.name.slice(o.name.lastIndexOf("."));bP.has(a)&&(yield i)}}}async function SP(e){try{let t=await(0,Sn.stat)(e);if(t.size>kP||t.size===0)return null;let r=await(0,Sn.readFile)(e,"utf-8");return r.slice(0,1e3).includes("\0")?null:r}catch{return null}}async function o$(e,t,r={}){let n=r.maxResults||20,o=t.toLowerCase(),i=o.split(/[\s_\-./]+/).filter(h=>h.length>0),a=[];for await(let h of n$(e,e)){if(r.filePattern&&!(0,pi.relative)(e,h).toLowerCase().includes(r.filePattern.toLowerCase()))continue;let _=await SP(h);_&&a.push({absolutePath:h,relativePath:(0,pi.relative)(e,h),content:_})}let s=e$(a),c=[],u=[],l=0;for(let[h,_]of s){l+=wP(_);let E=Os(h.toLowerCase(),i)>0,I=[],A=(j,Le)=>{for(let de of j){let Wt=0,Qe="",Kt=Os(de.name.toLowerCase(),i);Kt>0&&(Wt+=Kt*3,Qe="name match"),de.signature.toLowerCase().includes(o)&&(Wt+=2,Qe=Qe?`${Qe} + signature`:"signature match"),de.jsdoc&&de.jsdoc.toLowerCase().includes(o)&&(Wt+=1,Qe=Qe?`${Qe} + jsdoc`:"jsdoc match"),Wt>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=Os(h.symbolName.toLowerCase(),i);return Os(_.symbolName.toLowerCase(),i)-b});let d=u.slice(0,n),m=new Set(d.map(h=>h.filePath)),p=c.filter(h=>m.has(h.filePath)).slice(0,n),g=p.reduce((h,_)=>h+_.foldedTokenEstimate,0);return{foldedFiles:p,matchingSymbols:d,totalFilesScanned:a.length,totalSymbolsFound:l,tokenEstimate:g}}function Os(e,t){let r=0;for(let n of t)if(e===n)r+=10;else if(e.includes(n))r+=5;else{let o=0,i=0;for(let a of n){let s=e.indexOf(a,o);s!==-1&&(i++,o=s+1)}i===n.length&&(r+=1)}return r}function wP(e){let t=e.symbols.length;for(let r of e.symbols)r.children&&(t+=r.children.length);return t}function i$(e,t){let r=[];if(r.push(`\u{1F50D} Smart Search: "${t}"`),r.push(` Scanned ${e.totalFilesScanned} files, found ${e.totalSymbolsFound} symbols`),r.push(` ${e.matchingSymbols.length} matches across ${e.foldedFiles.length} files (~${e.tokenEstimate} tokens for folded view)`),r.push(""),e.matchingSymbols.length===0)return r.push(" No matching symbols found."),r.join(` `);r.push("\u2500\u2500 Matching Symbols \u2500\u2500"),r.push("");for(let n of e.matchingSymbols){if(r.push(` ${n.kind} ${n.symbolName} (${n.filePath}:${n.lineStart+1})`),r.push(` ${n.signature}`),n.jsdoc){let o=n.jsdoc.split(` `).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 e.foldedFiles)r.push(kn(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(` `)}var Of=require("node:fs/promises"),js=require("node:path"),zP="10.7.0";console.log=(...e)=>{ve.error("CONSOLE","Intercepted console output (MCP protocol protection)",void 0,{args:e})};var a$={search:"/api/search",timeline:"/api/timeline"};async function s$(e,t){ve.debug("SYSTEM","\u2192 Worker API",void 0,{endpoint:e,params:t});try{let r=new URLSearchParams;for(let[a,s]of Object.entries(t))s!=null&&r.append(a,String(s));let n=`${e}?${r}`,o=await Ts(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:e}),i}catch(r){return ve.error("SYSTEM","\u2190 Worker API error",{endpoint:e},r),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function IP(e,t){ve.debug("HTTP","Worker API request (POST)",void 0,{endpoint:e});try{let r=await Ts(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});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:e}),{content:[{type:"text",text:JSON.stringify(n,null,2)}]}}catch(r){return ve.error("HTTP","Worker API error (POST)",{endpoint:e},r),{content:[{type:"text",text:`Error calling Worker API: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}}async function EP(){try{return(await Ts("/api/health")).ok}catch(e){return ve.debug("SYSTEM","Worker health check failed",{},e),!1}}var c$=[{name:"__IMPORTANT",description:`3-LAYER WORKFLOW (ALWAYS FOLLOW): 1. search(query) \u2192 Get index with IDs (~50-100 tokens/result) 2. timeline(anchor=ID) \u2192 Get context around interesting results 3. get_observations([IDs]) \u2192 Fetch full details ONLY for filtered IDs NEVER fetch full details without filtering first. 10x token savings.`,inputSchema:{type:"object",properties:{}},handler:async()=>({content:[{type:"text",text:`# Memory Search Workflow **3-Layer Pattern (ALWAYS follow this):** 1. **Search** - Get index of results with IDs \`search(query="...", limit=20, project="...")\` Returns: Table with IDs, titles, dates (~50-100 tokens/result) 2. **Timeline** - Get context around interesting results \`timeline(anchor=, depth_before=3, depth_after=3)\` Returns: Chronological context showing what was happening 3. **Fetch** - Get full details ONLY for relevant IDs \`get_observations(ids=[...])\` # ALWAYS batch for 2+ items Returns: Complete details (~500-1000 tokens/result) **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 e=>{let t=a$.search;return await s$(t,e)}},{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 e=>{let t=a$.timeline;return await s$(t,e)}},{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 e=>await IP("/api/observations/batch",e)},{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 e=>{let t=(0,js.resolve)(e.path||process.cwd()),r=await o$(t,e.query,{maxResults:e.max_results||20,filePattern:e.file_pattern});return{content:[{type:"text",text:i$(r,e.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 e=>{let t=(0,js.resolve)(e.file_path),r=await(0,Of.readFile)(t,"utf-8"),n=r$(r,t,e.symbol_name);if(n)return{content:[{type:"text",text:n}]};let o=Ps(r,t);if(o.symbols.length>0){let i=o.symbols.map(a=>` - ${a.name} (${a.kind})`).join(` `);return{content:[{type:"text",text:`Symbol "${e.symbol_name}" not found in ${e.file_path}. Available symbols: ${i}`}]}}return{content:[{type:"text",text:`Could not parse ${e.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 e=>{let t=(0,js.resolve)(e.file_path),r=await(0,Of.readFile)(t,"utf-8"),n=Ps(r,t);return n.symbols.length>0?{content:[{type:"text",text:kn(n)}]}:{content:[{type:"text",text:`Could not parse ${e.file_path}. File may use an unsupported language or be empty.`}]}}}],jf=new xs({name:"claude-mem",version:zP},{capabilities:{tools:{}}});jf.setRequestHandler(xd,async()=>({tools:c$.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))}));jf.setRequestHandler(Do,async e=>{let t=c$.find(r=>r.name===e.params.name);if(!t)throw new Error(`Unknown tool: ${e.params.name}`);try{return await t.handler(e.params.arguments||{})}catch(r){return ve.error("SYSTEM","Tool execution failed",{tool:e.params.name},r),{content:[{type:"text",text:`Tool execution failed: ${r instanceof Error?r.message:String(r)}`}],isError:!0}}});var TP=3e4,fi=null;function PP(){if(process.platform==="win32")return;let e=process.ppid;fi=setInterval(()=>{(process.ppid===1||process.ppid!==e)&&(ve.info("SYSTEM","Parent process died, self-exiting to prevent orphan",{initialPpid:e,currentPpid:process.ppid}),Df())},TP),fi.unref&&fi.unref()}function Df(){fi&&clearInterval(fi),ve.info("SYSTEM","MCP server shutting down"),process.exit(0)}process.on("SIGTERM",Df);process.on("SIGINT",Df);async function OP(){let e=new Ss;await jf.connect(e),ve.info("SYSTEM","Claude-mem search server started"),PP(),setTimeout(async()=>{await EP()?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)}OP().catch(e=>{ve.error("SYSTEM","Fatal error",void 0,e),process.exit(0)});